|
STIR 6.4.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 | |
| virtual Succeeded | reconstruct (shared_ptr< TargetT > const &target_image_sptr)=0 |
executes the reconstruction storing result in target_image_sptr | |
| virtual Succeeded | set_up (shared_ptr< TargetT > const &target_data_sptr) |
| operations prior to the reconstruction | |
Public Member Functions inherited from stir::RegisteredObjectBase | |
| virtual std::string | get_registered_name () const =0 |
| Returns the name of the type of the object. | |
Public Member Functions inherited from stir::ParsingObject | |
| ParsingObject (const ParsingObject &) | |
| ParsingObject & | operator= (const ParsingObject &) |
| bool | parse (std::istream &f) |
| bool | parse (const char *const filename) |
| void | ask_parameters () |
| virtual std::string | parameter_info () |
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 | |
| void | start_timers (bool do_reset=false) const |
| start all timers kept by this object | |
| 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) | |
Functions to set parameters | |
This can be used as alternative to the parsing mechanism.
| |
| 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 | |
| int | _verbosity |
| Verbosity level. | |
| 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 | |
| void | set_disable_output (bool _val) |
| set_disable_output | |
| shared_ptr< TargetT > | get_target_image () |
| get_reconstructed_image | |
| virtual void | check (TargetT const &target_data) const |
| do consistency checks | |
| 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). | |
| 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 | |
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. | |
| static Reconstruction< TargetT > * | ask_type_and_parameters () |
| ask the user for the type, and then calls read_registered_object(0, type) | |
| static void | list_registered_names (std::ostream &stream) |
| List all possible registered names to the stream. | |
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. | |
| virtual void | set_key_values () |
| This will be called before parsing or parameter_info is called. | |
Static Protected Member Functions inherited from stir::RegisteredObject< Reconstruction< TargetT > > | |
| static RegistryType & | registry () |
| Static function returning the registry. | |
| KeyParser | parser |
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 |
gives method information
Implemented in stir::FBP2DReconstruction, stir::FBP3DRPReconstruction, stir::OSMAPOSLReconstruction< TargetT >, stir::OSSPSReconstruction< TargetT >, stir::SRT2DReconstruction, and stir::SRT2DSPECTReconstruction.
Referenced by stir::IterativeReconstruction< TargetT >::end_of_iteration_processing().
|
pure virtual |
executes the reconstruction
Implemented in stir::AnalyticReconstruction, and stir::IterativeReconstruction< TargetT >.
|
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::AnalyticReconstruction, and stir::IterativeReconstruction< TargetT >.
References set_output_file_format_ptr(), set_output_filename_prefix(), set_post_processor_sptr(), set_up(), and target_data_sptr.
|
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 >, and stir::OSSPSReconstruction< TargetT >.
References stir::info(), post_filter_sptr, set_up(), target_data_sptr, and stir::warning().
Referenced by reconstruct(), stir::IterativeReconstruction< TargetT >::set_up(), and set_up().
|
pure virtual |
set input data
Implemented in stir::AnalyticReconstruction, and stir::IterativeReconstruction< TargetT >.
|
pure virtual |
get input data
Will throw an exception if it wasn't set first
Implemented in stir::AnalyticReconstruction, and stir::IterativeReconstruction< TargetT >.
References get_target_image(), and set_disable_output().
| 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.
References set_disable_output().
Referenced by get_input_data(), and set_disable_output().
| shared_ptr< TargetT > stir::Reconstruction< TargetT >::get_target_image | ( | ) |
get_reconstructed_image
References get_target_image(), and target_data_sptr.
Referenced by get_input_data(), and get_target_image().
|
protectedvirtual |
do consistency checks
calls error() if anything is wrong, in particular when set_up() hasn't been called yet.
If overriding this function in a derived class, you need to call this one.
References check(), stir::error(), and target_data_sptr.
Referenced by check(), stir::IterativeReconstruction< TargetT >::reconstruct(), stir::OSMAPOSLReconstruction< TargetT >::update_estimate(), and stir::OSSPSReconstruction< TargetT >::update_estimate().
|
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.
References stir::error(), initialise(), and set_defaults().
Referenced by initialise(), stir::KOSMAPOSLReconstruction< TargetT >::KOSMAPOSLReconstruction(), stir::OSMAPOSLReconstruction< TargetT >::OSMAPOSLReconstruction(), and stir::OSSPSReconstruction< TargetT >::OSSPSReconstruction().
|
overrideprotectedvirtual |
Set defaults before parsing.
Reimplemented from stir::ParsingObject.
References _disable_output, _verbosity, stir::OutputFileFormat< DataT >::default_sptr(), output_file_format_ptr, output_filename_prefix, post_filter_sptr, and set_defaults().
Referenced by initialise(), Reconstruction(), stir::AnalyticReconstruction::set_defaults(), stir::IterativeReconstruction< TargetT >::set_defaults(), and set_defaults().
|
overrideprotectedvirtual |
Initialise all keywords.
Reimplemented from stir::ParsingObject.
References _disable_output, _verbosity, initialise_keymap(), output_file_format_ptr, output_filename_prefix, and post_filter_sptr.
Referenced by stir::AnalyticReconstruction::initialise_keymap(), stir::IterativeReconstruction< TargetT >::initialise_keymap(), and initialise_keymap().
|
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.
References _disable_output, stir::RegisteredObjectBase::get_registered_name(), post_processing(), and stir::warning().
Referenced by stir::AnalyticReconstruction::post_processing(), stir::IterativeReconstruction< TargetT >::post_processing(), and post_processing().
|
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.
Referenced by stir::IterativeReconstruction< TargetT >::end_of_iteration_processing(), initialise_keymap(), post_processing(), set_defaults(), and stir::OSMAPOSLReconstruction< TargetT >::update_estimate().