STIR
6.2.0
|
base class for all ReconstructionsAs there is not a lot of commonality between different reconstruction algorithms, this base class is rather basic. It essentially takes care of constructing a target image, calls the virtual reconstruct() function, and writes the result to file. More...
#include "stir/recon_buildblock/Reconstruction.h"
Public Member Functions | |
Reconstruction () | |
default constructor (calls set_defaults()) | |
~Reconstruction () override | |
virtual destructor | |
virtual std::string | method_info () const =0 |
gives method information | |
virtual Succeeded | reconstruct ()=0 |
executes the reconstruction More... | |
virtual Succeeded | reconstruct (shared_ptr< TargetT > const &target_image_sptr)=0 |
executes the reconstruction storing result in target_image_sptr More... | |
virtual Succeeded | set_up (shared_ptr< TargetT > const &target_data_sptr) |
operations prior to the reconstruction More... | |
void | set_disable_output (bool _val) |
set_disable_output More... | |
shared_ptr< TargetT > | get_target_image () |
get_reconstructed_image More... | |
Functions to set parameters | |
This can be used as alternative to the parsing mechanism.
| |
void | set_output_filename_prefix (const std::string &) |
file name for output reconstructed images | |
void | set_output_file_format_ptr (const shared_ptr< OutputFileFormat< TargetT >> &) |
defines the format of the output files | |
void | set_post_processor_sptr (const shared_ptr< DataProcessor< TargetT >> &) |
post-filter | |
virtual void | set_input_data (const shared_ptr< ExamData > &)=0 |
set input data | |
virtual const ExamData & | get_input_data () const =0 |
get input data More... | |
Public Member Functions inherited from stir::RegisteredObjectBase | |
virtual std::string | get_registered_name () const =0 |
Returns the name of the type of the object. More... | |
Public Member Functions inherited from stir::ParsingObject | |
ParsingObject (const ParsingObject &) | |
ParsingObject & | operator= (const ParsingObject &) |
void | ask_parameters () |
virtual std::string | parameter_info () |
bool | parse (std::istream &f) |
bool | parse (const char *const filename) |
Public Member Functions inherited from stir::TimedObject | |
void | reset_timers () |
reset all timers kept by this object | |
void | stop_timers () const |
stop all timers kept by this object More... | |
void | start_timers (bool do_reset=false) const |
start all timers kept by this object More... | |
double | get_CPU_timer_value () const |
get current value of the CPU timer (since first use or last reset) | |
double | get_wall_clock_timer_value () const |
get current value of the wall-clock timer (since first use or last reset) | |
Protected Member Functions | |
virtual void | check (TargetT const &target_data) const |
do consistency checks More... | |
void | initialise (const std::string ¶meter_filename) |
This function initialises all parameters, either via parsing, or by calling ask_parameters() (when parameter_filename is the empty string). More... | |
void | set_defaults () override |
Set defaults before parsing. | |
void | initialise_keymap () override |
Initialise all keywords. | |
bool | post_processing () override |
used to check acceptable parameters after parsing More... | |
Protected Member Functions inherited from stir::ParsingObject | |
virtual void | set_key_values () |
This will be called before parsing or parameter_info is called. More... | |
Protected Attributes | |
std::string | output_filename_prefix |
file name for output reconstructed images | |
shared_ptr< OutputFileFormat< TargetT > > | output_file_format_ptr |
defines the format of the output files | |
shared_ptr< DataProcessor< TargetT > > | post_filter_sptr |
post-filter | |
bool | _already_set_up |
shared_ptr< TargetT > | target_data_sptr |
target_data_sptr | |
bool | _disable_output |
_disable_output More... | |
int | _verbosity |
Verbosity level. | |
Protected Attributes inherited from stir::ParsingObject | |
KeyParser | parser |
Additional Inherited Members | |
Static Public Member Functions inherited from stir::RegisteredObject< Reconstruction< TargetT > > | |
static Reconstruction< TargetT > * | read_registered_object (std::istream *in, const std::string ®istered_name) |
Construct a new object (of a type derived from Root, its actual type determined by the registered_name parameter) by parsing the istream. More... | |
static Reconstruction< TargetT > * | ask_type_and_parameters () |
ask the user for the type, and then calls read_registered_object(0, type) More... | |
static void | list_registered_names (std::ostream &stream) |
List all possible registered names to the stream. More... | |
Protected Types inherited from stir::RegisteredObject< Reconstruction< TargetT > > | |
typedef Reconstruction< TargetT > *(* | RootFactory) (std::istream *) |
The type of a root factory is a function, taking an istream* as argument, and returning a Root*. | |
typedef FactoryRegistry< std::string, RootFactory, interfile_less > | RegistryType |
The type of the registry. | |
Static Protected Member Functions inherited from stir::RegisteredObject< Reconstruction< TargetT > > | |
static RegistryType & | registry () |
Static function returning the registry. More... | |
base class for all Reconstructions
As there is not a lot of commonality between different reconstruction algorithms, this base class is rather basic. It essentially takes care of constructing a target image, calls the virtual reconstruct() function, and writes the result to file.
For convenience, the class is derived from TimedObject. It is the responsibility of the derived class to run these timers though.
; post-processing after image reconstruction,see DataProcessor<TargetT> ; defaults to no processing ("None") post-filter type := ; output file(s) will be written with the following file name output filename prefix := ; output file(s) will use the following file format ; see OutputFileFormat<TargetT> output file format :=
|
pure virtual |
executes the reconstruction
Implemented in stir::IterativeReconstruction< TargetT >, and stir::AnalyticReconstruction.
|
pure virtual |
executes the reconstruction storing result in target_image_sptr
target_image_sptr | The result of the reconstruction is stored in *target_image_sptr . |
Because of C++ rules, overloading one of the reconstruct() functions in a derived class, will hide the other. So you have to overload both.
Implemented in stir::IterativeReconstruction< TargetT >, and stir::AnalyticReconstruction.
|
virtual |
operations prior to the reconstruction
Will do various consistency checks and return Succeeded::no if something is wrong.
Reimplemented in stir::IterativeReconstruction< TargetT >, stir::OSMAPOSLReconstruction< TargetT >, stir::OSSPSReconstruction< TargetT >, and stir::FBP2DReconstruction.
|
pure virtual |
get input data
Will throw an exception if it wasn't set first
Implemented in stir::IterativeReconstruction< TargetT >, and stir::AnalyticReconstruction.
void stir::Reconstruction< TargetT >::set_disable_output | ( | bool | _val | ) |
set_disable_output
_val |
This function is called if the user deside to mute any output images. The best way to do this is to use the "disable output" key in the par file.
shared_ptr< TargetT > stir::Reconstruction< TargetT >::get_target_image | ( | ) |
get_reconstructed_image
|
protectedvirtual |
|
protected |
This function initialises all parameters, either via parsing, or by calling ask_parameters() (when parameter_filename is the empty string).
It should be called in the constructor of the last class in the hierarchy. At that time, all Interfile keys will have been initialised, and ask_parameters() will be the appropriate virtual function, such that questions are asked for all parameters.
|
overrideprotectedvirtual |
used to check acceptable parameters after parsing
The function should be used to set members that have are not set directly by the parsing. For example, parsing might set input_filename
, and post_processing()
might then read in the data and set the corresponding Reconstruction parameter.
Consistency checks mostly belong in set_up()
. The reason for this is that for instance a GUI might not use the parsing mechanism and set parameters by calling various set_
functions (such as set_post_processor_sptr()
).
Reimplemented from stir::ParsingObject.
|
protected |
_disable_output
This member mutes the creatation and write into an output image. You want to use it if you call for reconstruction from within some other code and want to use directly the output image.