STIR
6.2.0
|
base class for iterative reconstruction objectsThis is the base class for all iterative reconstruction methods. It provides the basic iteration mechanisms. What each iteration does has to be implemented in a derived class. More...
#include "stir/recon_buildblock/IterativeReconstruction.h"
Public Member Functions | |
int | get_subiteration_num () const |
accessor for the subiteration counter | |
int | get_subset_num () |
accessor for finding the current subset number More... | |
virtual TargetT * | get_initial_data_ptr () const |
Gets a pointer to the initial data. More... | |
Succeeded | reconstruct () override |
executes the reconstruction More... | |
Succeeded | reconstruct (shared_ptr< TargetT > const &target_data_sptr) override |
executes the reconstruction with target_data_sptr as initial value More... | |
std::string | make_filename_prefix_subiteration_num (const std::string &filename_prefix) const |
A utility function that creates a filename_prefix by appending the current subiteration number. More... | |
std::string | make_filename_prefix_subiteration_num () const |
A utility function that creates the output filename_prefix for the current subiteration number. More... | |
Succeeded | set_up (shared_ptr< TargetT > const &target_data_ptr) override |
operations prior to the reconstruction More... | |
virtual void | update_estimate (TargetT ¤t_estimate)=0 |
the principal operations for updating the data iterates at each iteration | |
Functions to get parameters | |
| |
GeneralisedObjectiveFunction< TargetT > const & | get_objective_function () const |
shared_ptr< GeneralisedObjectiveFunction< TargetT > > | get_objective_function_sptr () const |
const int | get_max_num_full_iterations () const |
the maximum allowed number of full iterations | |
const int | get_num_subsets () const |
the number of ordered subsets | |
const int | get_num_subiterations () const |
the number of subiterations | |
const int | get_start_subiteration_num () const |
value with which to initialize the subiteration counter | |
const int | get_start_subset_num () const |
the starting subset number | |
const int | get_save_interval () const |
subiteration interval at which data will be saved | |
const bool | get_randomise_subset_order () const |
signals whether to randomise the subset order in each iteration | |
const DataProcessor< TargetT > & | get_inter_iteration_filter () const |
inter-iteration filter | |
shared_ptr< DataProcessor< TargetT > > | get_inter_iteration_filter_sptr () |
const int | get_inter_iteration_filter_interval () const |
subiteration interval at which to apply inter-iteration filters | |
const int | get_report_objective_function_values_interval () const |
subiteration interval at which to report the values of the objective function | |
Functions to set parameters | |
This can be used as alternative to the parsing mechanism.
| |
void | set_objective_function_sptr (const shared_ptr< GeneralisedObjectiveFunction< TargetT >> &) |
The objective function that will be optimised. | |
void | set_max_num_full_iterations (const int) |
the maximum allowed number of full iterations | |
void | set_num_subsets (const int) |
the number of ordered subsets | |
void | set_num_subiterations (const int) |
the number of subiterations | |
void | set_start_subiteration_num (const int) |
value with which to initialize the subiteration counter | |
void | set_start_subset_num (const int) |
the starting subset number | |
void | set_save_interval (const int) |
subiteration interval at which data will be saved | |
void | set_randomise_subset_order (const bool) |
signals whether to randomise the subset order in each iteration | |
void | set_inter_iteration_filter_ptr (const shared_ptr< DataProcessor< TargetT >> &) |
inter-iteration filter | |
void | set_inter_iteration_filter_interval (const int) |
subiteration interval at which to apply inter-iteration filters | |
void | set_report_objective_function_values_interval (const int) |
subiteration interval at which to report the values of the objective function | |
void | set_input_data (const shared_ptr< ExamData > &arg) override |
set_input_data More... | |
const ExamData & | get_input_data () const override |
get input data More... | |
Public Member Functions inherited from stir::Reconstruction< TargetT > | |
Reconstruction () | |
default constructor (calls set_defaults()) | |
~Reconstruction () override | |
virtual destructor | |
virtual std::string | method_info () const =0 |
gives method information | |
void | set_disable_output (bool _val) |
set_disable_output More... | |
shared_ptr< TargetT > | get_target_image () |
get_reconstructed_image More... | |
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 | |
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 | end_of_iteration_processing (TargetT ¤t_estimate) |
operations for the end of the iteration More... | |
virtual void | ask_parameters () |
prompts the user to enter parameter values manually | |
void | set_defaults () override |
Set defaults before parsing. | |
void | initialise_keymap () override |
Initialise all keywords. | |
bool | post_processing () override |
used to check acceptable parameter ranges, etc... | |
Protected Member Functions inherited from stir::Reconstruction< TargetT > | |
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 | |
shared_ptr< GeneralisedObjectiveFunction< TargetT > > | objective_function_sptr |
int | subiteration_num |
the subiteration counter | |
bool | terminate_iterations |
used to abort the loop over iterations | |
int | max_num_full_iterations |
the maximum allowed number of full iterations | |
int | num_subsets |
the number of ordered subsets | |
int | num_subiterations |
the number of subiterations | |
int | start_subiteration_num |
value with which to initialize the subiteration counter | |
std::string | initial_data_filename |
name of the file containing the data for intializing the reconstruction | |
int | start_subset_num |
the starting subset number | |
int | save_interval |
subiteration interval at which data will be saved | |
bool | randomise_subset_order |
signals whether to randomise the subset order in each iteration | |
shared_ptr< DataProcessor< TargetT > > | inter_iteration_filter_ptr |
inter-iteration filter | |
int | inter_iteration_filter_interval |
subiteration interval at which to apply inter-iteration filters | |
int | report_objective_function_values_interval |
subiteration interval at which to report the values of the objective function More... | |
Protected Attributes inherited from stir::Reconstruction< TargetT > | |
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 iterative reconstruction objects
This is the base class for all iterative reconstruction methods. It provides the basic iteration mechanisms. What each iteration does has to be implemented in a derived class.
; any parameters from Reconstruction<TargetT> ; see GeneralisedObjectiveFunction<TargetT> objective function type:= number of subsets:= 1 start at subset:= 0 number of subiterations:= 1 save images at subiteration intervals:= 1 start at subiteration number:=2 initial image := enforce initial positivity condition:=1 ; specify processing after every few subiterations, see DataProcessor<TargetT> inter-iteration filter subiteration interval:= inter-iteration filter type := ; write objective function value to stderr at certain subiterations ; default value of 0 means: do not write it at all. report_objective_function_values_interval:=0
move subset things somewhere else
all the compute
functions should be const
.
int stir::IterativeReconstruction< TargetT >::get_subset_num | ( | ) |
accessor for finding the current subset number
The subset number is determined from the subiteration number. If randomise_subset_order is false, the subset number is found as follows:
When randomise subsets are used, a new random order is initialised before every full iteration. In this case, start_subset_num is ignored (as it doesn't make any sense).
|
virtual |
Gets a pointer to the initial data.
This is either read from file, or constructed by construct_target_ptr(). In the latter case, its values are set to 0 or 1, depending on the value of IterativeReconstruction::initial_data_filename.
Dependency on explicit strings "1" or "0" in IterativeReconstruction::initial_data_filename is not nice.
should not return a 'bare' pointer.
Referenced by stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBinTests::run_tests(), and stir::PoissonLogLikelihoodWithLinearModelForMeanAndProjDataTests::run_tests().
|
overridevirtual |
executes the reconstruction
Calls get_initial_data_ptr() and then reconstruct(shared_ptr<TargetT>const&). See end_of_iteration_processing() for info on saving to file.
Implements stir::Reconstruction< TargetT >.
|
overridevirtual |
executes the reconstruction with target_data_sptr as initial value
After calling set_up(), repeatedly calls update_estimate(); end_of_iteration_processing(); See end_of_iteration_processing() for info on saving to file.
Final reconstruction is saved in target_data_sptr
Implements stir::Reconstruction< TargetT >.
References stir::info().
std::string stir::IterativeReconstruction< TargetT >::make_filename_prefix_subiteration_num | ( | const std::string & | filename_prefix | ) | const |
A utility function that creates a filename_prefix by appending the current subiteration number.
Only works when no extension is present.
std::string stir::IterativeReconstruction< TargetT >::make_filename_prefix_subiteration_num | ( | ) | const |
A utility function that creates the output filename_prefix for the current subiteration number.
Uses output_filename_prefix. Only works when no extension is present.
|
overridevirtual |
set_input_data
Implements stir::Reconstruction< TargetT >.
|
overridevirtual |
get input data
Will throw an exception if it wasn't set first
Implements stir::Reconstruction< TargetT >.
|
overridevirtual |
operations prior to the reconstruction
Will do various consistency checks and return Succeeded::no if something is wrong.
Reimplemented from stir::Reconstruction< TargetT >.
References stir::error().
|
protectedvirtual |
operations for the end of the iteration
At specific subiteration numbers, this
If your derived class redefines this virtual function, you will probably want to call IterativeReconstruction::end_of_iteration_processing() in there anyway.
|
protected |
subiteration interval at which to report the values of the objective function