Skip to content

Commit 2a9fe54

Browse files
web-flowKrisThielemans
authored andcommitted
run clang-format
1 parent d38d7b7 commit 2a9fe54

File tree

1,181 files changed

+108941
-117090
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,181 files changed

+108941
-117090
lines changed

examples/C++/General_Reconstruction/General_Reconstruction.cxx

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,47 @@
55
#include <iostream>
66
START_NAMESPACE_STIR
77

8-
General_Reconstruction::
9-
General_Reconstruction()
10-
{
11-
this->set_defaults();
12-
}
8+
General_Reconstruction::General_Reconstruction() { this->set_defaults(); }
139

1410
void
1511
General_Reconstruction::set_defaults()
16-
{
17-
18-
}
12+
{}
1913

2014
void
2115
General_Reconstruction::initialise_keymap()
2216
{
23-
this->parser.add_start_key("General reconstruction");
24-
this->parser.add_stop_key("End General reconstruction");
17+
this->parser.add_start_key("General reconstruction");
18+
this->parser.add_stop_key("End General reconstruction");
2519

26-
this->parser.add_parsing_key("reconstruction method", &this->reconstruction_method_sptr);
20+
this->parser.add_parsing_key("reconstruction method", &this->reconstruction_method_sptr);
2721
}
2822

2923
bool
3024
General_Reconstruction::post_processing()
3125
{
32-
return false;
26+
return false;
3327
}
3428

3529
Succeeded
3630
General_Reconstruction::process_data()
3731
{
38-
HighResWallClockTimer t;
39-
t.reset();
40-
t.start();
41-
42-
//return reconstruction_object.reconstruct() == Succeeded::yes ?
43-
// EXIT_SUCCESS : EXIT_FAILURE;
44-
if (reconstruction_method_sptr->reconstruct() == Succeeded::yes)
45-
{
46-
t.stop();
47-
std::cout << "Total Wall clock time: " << t.value() << " seconds" << std::endl;
48-
return Succeeded::yes;
49-
}
50-
else
51-
{
52-
t.stop();
53-
return Succeeded::no;
54-
}
32+
HighResWallClockTimer t;
33+
t.reset();
34+
t.start();
35+
36+
// return reconstruction_object.reconstruct() == Succeeded::yes ?
37+
// EXIT_SUCCESS : EXIT_FAILURE;
38+
if (reconstruction_method_sptr->reconstruct() == Succeeded::yes)
39+
{
40+
t.stop();
41+
std::cout << "Total Wall clock time: " << t.value() << " seconds" << std::endl;
42+
return Succeeded::yes;
43+
}
44+
else
45+
{
46+
t.stop();
47+
return Succeeded::no;
48+
}
5549
}
5650

5751
END_NAMESPACE_STIR

examples/C++/General_Reconstruction/General_Reconstruction.h

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,27 @@
1616
#include "stir/CartesianCoordinate3D.h"
1717
#include "Reconstruction.h"
1818

19-
2019
START_NAMESPACE_STIR
2120

2221
class Succeeded;
2322

2423
class General_Reconstruction : public ParsingObject
2524
{
2625
public:
27-
//!
28-
//! \brief General_Reconstuction
29-
//! \details Default constructor
30-
General_Reconstruction();
26+
//!
27+
//! \brief General_Reconstuction
28+
//! \details Default constructor
29+
General_Reconstruction();
3130

32-
virtual Succeeded process_data();
33-
protected:
31+
virtual Succeeded process_data();
3432

35-
void set_defaults();
36-
void initialise_keymap();
37-
bool post_processing();
33+
protected:
34+
void set_defaults();
35+
void initialise_keymap();
36+
bool post_processing();
3837

3938
private:
40-
41-
shared_ptr < Reconstruction < DiscretisedDensity < 3, float > > >
42-
reconstruction_method_sptr;
43-
39+
shared_ptr<Reconstruction<DiscretisedDensity<3, float>>> reconstruction_method_sptr;
4440
};
4541

4642
END_NAMESPACE_STIR

examples/C++/using_STIR_LOCAL/demo1.cxx

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66
\brief A simple program that backprojects some projection data.
77
88
It illustrates
9-
- basic interaction with the user,
10-
- reading of images and projection data
11-
- construction of a specified type of back-projector,
12-
- how to use back-project all projection data
13-
- output of images
9+
- basic interaction with the user,
10+
- reading of images and projection data
11+
- construction of a specified type of back-projector,
12+
- how to use back-project all projection data
13+
- output of images
1414
1515
See README.txt in the directory where this file is located.
1616
17-
\author Kris Thielemans
17+
\author Kris Thielemans
1818
*/
1919
/*
2020
Copyright (C) 2004- 2011, Hammersmith Imanet Ltd
2121
22-
This software is distributed under the terms
22+
This software is distributed under the terms
2323
of the GNU General Public Licence (GPL)
2424
See STIR/LICENSE.txt for details
2525
*/
@@ -35,25 +35,21 @@
3535
#include "stir/utilities.h"
3636
#include "stir/Succeeded.h"
3737

38-
int main()
38+
int
39+
main()
3940
{
4041
using namespace stir;
41-
42+
4243
/////////////// input sinogram
43-
const std::string input_filename =
44-
ask_filename_with_extension("Input file",".hs");
44+
const std::string input_filename = ask_filename_with_extension("Input file", ".hs");
4545

46-
shared_ptr<ProjData>
47-
proj_data_sptr(ProjData::read_from_file(input_filename));
48-
shared_ptr<ProjDataInfo>
49-
proj_data_info_sptr(proj_data_sptr->get_proj_data_info_sptr()->clone());
46+
shared_ptr<ProjData> proj_data_sptr(ProjData::read_from_file(input_filename));
47+
shared_ptr<ProjDataInfo> proj_data_info_sptr(proj_data_sptr->get_proj_data_info_sptr()->clone());
5048

5149
/////////////// template image (for sizes etc)
52-
const std::string template_filename =
53-
ask_filename_with_extension("Template image file",".hv");
50+
const std::string template_filename = ask_filename_with_extension("Template image file", ".hv");
5451

55-
shared_ptr<DiscretisedDensity<3,float> >
56-
density_sptr(read_from_file<DiscretisedDensity<3,float> >(template_filename));
52+
shared_ptr<DiscretisedDensity<3, float>> density_sptr(read_from_file<DiscretisedDensity<3, float>>(template_filename));
5753

5854
density_sptr->fill(0);
5955

examples/C++/using_STIR_LOCAL/demo2.cxx

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44
\file
55
\ingroup examples
66
\brief A small modification of demo1.cxx to ask the user for the
7-
back projector she wants to use.
7+
back projector she wants to use.
88
99
It illustrates
10-
- how to ask the user for objects for which different types
11-
exist (e.g. back-projector, forward-projectors, image processors
12-
etc), anything based on the RegisteredObject hierarchy.
13-
- that STIR is able to select basic processing units at run-time
14-
- how to use the (very) basic display facilities in STIR
10+
- how to ask the user for objects for which different types
11+
exist (e.g. back-projector, forward-projectors, image processors
12+
etc), anything based on the RegisteredObject hierarchy.
13+
- that STIR is able to select basic processing units at run-time
14+
- how to use the (very) basic display facilities in STIR
1515
1616
See README.txt in the directory where this file is located.
1717
18-
\author Kris Thielemans
18+
\author Kris Thielemans
1919
*/
2020
/*
2121
Copyright (C) 2004- 2012, Hammersmith Imanet Ltd
2222
23-
This software is distributed under the terms
23+
This software is distributed under the terms
2424
of the GNU General Public Licence (GPL)
2525
See STIR/LICENSE.txt for details
2626
*/
@@ -34,31 +34,26 @@
3434
#include "stir/Succeeded.h"
3535
#include "stir/display.h"
3636

37-
int main()
37+
int
38+
main()
3839
{
3940
using namespace stir;
40-
41+
4142
/////////////// input sinogram
42-
const std::string input_filename =
43-
ask_filename_with_extension("Input file",".hs");
43+
const std::string input_filename = ask_filename_with_extension("Input file", ".hs");
4444

45-
shared_ptr<ProjData>
46-
proj_data_sptr(ProjData::read_from_file(input_filename));
47-
shared_ptr<ProjDataInfo>
48-
proj_data_info_sptr(proj_data_sptr->get_proj_data_info_sptr()->clone());
45+
shared_ptr<ProjData> proj_data_sptr(ProjData::read_from_file(input_filename));
46+
shared_ptr<ProjDataInfo> proj_data_info_sptr(proj_data_sptr->get_proj_data_info_sptr()->clone());
4947

5048
/////////////// template image (for sizes etc)
51-
const std::string template_filename =
52-
ask_filename_with_extension("Template image file",".hv");
49+
const std::string template_filename = ask_filename_with_extension("Template image file", ".hv");
5350

54-
shared_ptr<DiscretisedDensity<3,float> >
55-
density_sptr(read_from_file<DiscretisedDensity<3,float> >(template_filename));
51+
shared_ptr<DiscretisedDensity<3, float>> density_sptr(read_from_file<DiscretisedDensity<3, float>>(template_filename));
5652

5753
density_sptr->fill(0);
5854

5955
/////////////// back project
60-
shared_ptr<BackProjectorByBin> back_projector_sptr
61-
(BackProjectorByBin::ask_type_and_parameters());
56+
shared_ptr<BackProjectorByBin> back_projector_sptr(BackProjectorByBin::ask_type_and_parameters());
6257

6358
back_projector_sptr->set_up(proj_data_info_sptr, density_sptr);
6459

examples/C++/using_STIR_LOCAL/demo3.cxx

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@
66
\brief A modification of demo2.cxx that parses all parameters from a parameter file.
77
88
It illustrates
9-
- basic class derivation principles
10-
- how to use ParsingObject to have automatic capabilities of parsing
11-
parameters files (and interactive questions to the user)
12-
- how most STIR programs parse the parameter files.
9+
- basic class derivation principles
10+
- how to use ParsingObject to have automatic capabilities of parsing
11+
parameters files (and interactive questions to the user)
12+
- how most STIR programs parse the parameter files.
1313
1414
Note that the same functionality could be provided without deriving
1515
a new class from ParsingObject. One could have a KeyParser object
1616
in main() and fill it in directly.
1717
1818
See README.txt in the directory where this file is located.
1919
20-
\author Kris Thielemans
20+
\author Kris Thielemans
2121
*/
2222
/*
2323
Copyright (C) 2004- 2012, Hammersmith Imanet Ltd
2424
25-
This software is distributed under the terms
25+
This software is distributed under the terms
2626
of the GNU General Public Licence (GPL)
2727
See STIR/LICENSE.txt for details
2828
*/
@@ -39,9 +39,10 @@
3939
#include "stir/display.h"
4040
#include <stdio.h>
4141

42-
namespace stir {
42+
namespace stir
43+
{
4344

44-
class MyStuff: public ParsingObject
45+
class MyStuff : public ParsingObject
4546
{
4647
public:
4748
void set_defaults();
@@ -52,18 +53,18 @@ class MyStuff: public ParsingObject
5253
std::string input_filename;
5354
std::string template_filename;
5455
shared_ptr<BackProjectorByBin> back_projector_sptr;
55-
shared_ptr<OutputFileFormat<DiscretisedDensity<3,float> > > output_file_format_sptr;
56+
shared_ptr<OutputFileFormat<DiscretisedDensity<3, float>>> output_file_format_sptr;
5657
};
5758

5859
void
5960
MyStuff::set_defaults()
6061
{
6162
auto projection_matrix_sptr = std::make_shared<ProjMatrixByBinUsingRayTracing>();
6263
back_projector_sptr = std::make_shared<BackProjectorByBinUsingProjMatrixByBin>(projection_matrix_sptr);
63-
output_file_format_sptr = OutputFileFormat<DiscretisedDensity<3,float> >::default_sptr();
64+
output_file_format_sptr = OutputFileFormat<DiscretisedDensity<3, float>>::default_sptr();
6465
}
6566

66-
void
67+
void
6768
MyStuff::initialise_keymap()
6869
{
6970
parser.add_start_key("MyStuff parameters");
@@ -78,13 +79,10 @@ void
7879
MyStuff::run(const bool display_off)
7980
{
8081

81-
shared_ptr<ProjData>
82-
proj_data_sptr(ProjData::read_from_file(input_filename));
83-
shared_ptr<ProjDataInfo>
84-
proj_data_info_sptr(proj_data_sptr->get_proj_data_info_sptr()->clone());
82+
shared_ptr<ProjData> proj_data_sptr(ProjData::read_from_file(input_filename));
83+
shared_ptr<ProjDataInfo> proj_data_info_sptr(proj_data_sptr->get_proj_data_info_sptr()->clone());
8584

86-
shared_ptr<DiscretisedDensity<3,float> >
87-
density_sptr(read_from_file<DiscretisedDensity<3,float> >(template_filename));
85+
shared_ptr<DiscretisedDensity<3, float>> density_sptr(read_from_file<DiscretisedDensity<3, float>>(template_filename));
8886

8987
density_sptr->fill(0);
9088

@@ -100,28 +98,29 @@ MyStuff::run(const bool display_off)
10098
display(*density_sptr, density_sptr->find_max(), "Output");
10199
}
102100

103-
}// end of namespace stir
101+
} // end of namespace stir
104102

105-
int main(int argc, char **argv)
103+
int
104+
main(int argc, char** argv)
106105
{
107106
using namespace stir;
108107

109108
MyStuff my_stuff;
110109
my_stuff.set_defaults();
111110
bool display_off = false;
112-
if (argc<2)
113-
{
114-
std::cerr << "Normal usage: " << argv[0] << " parameter-file [--display_off]\n";
115-
std::cerr << "I will now ask you the questions interactively\n";
116-
my_stuff.ask_parameters();
117-
}
111+
if (argc < 2)
112+
{
113+
std::cerr << "Normal usage: " << argv[0] << " parameter-file [--display_off]\n";
114+
std::cerr << "I will now ask you the questions interactively\n";
115+
my_stuff.ask_parameters();
116+
}
118117
else
119-
{
120-
my_stuff.parse(argv[1]);
121-
if (argc>=3)
122-
// Set the display_off to true if the second argument is "--display_off"
123-
display_off = (strcmp(argv[2], "--display_off")==0);
124-
}
118+
{
119+
my_stuff.parse(argv[1]);
120+
if (argc >= 3)
121+
// Set the display_off to true if the second argument is "--display_off"
122+
display_off = (strcmp(argv[2], "--display_off") == 0);
123+
}
125124
my_stuff.run(display_off);
126125
return EXIT_SUCCESS;
127126
}

0 commit comments

Comments
 (0)