STIR  6.2.0
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin< TargetT > Class Template Reference

Class for PET list mode data from static images for a scanner with discrete detectors. More...

#include "stir/recon_buildblock/PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin.h"

Inheritance diagram for stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin< TargetT >:
Inheritance graph
[legend]

Public Member Functions

double actual_compute_objective_function_without_penalty (const TargetT &current_estimate, const int subset_num) override
 Computes the value of the objective function at the current_estimate. More...
 
void actual_compute_subset_gradient_without_penalty (TargetT &gradient, const TargetT &current_estimate, const int subset_num, const bool add_sensitivity) override
 Computes the gradient of the objective function at the current_estimate overwriting gradient. More...
 
Succeeded actual_accumulate_sub_Hessian_times_input_without_penalty (TargetT &output, const TargetT &current_image_estimate, const TargetT &input, const int subset_num) const override
 Implementation of the function computes the sub-Hessian and multiplies by a vector. More...
 
TargetT * construct_target_ptr () const override
 Creates a suitable target as determined by the parameters. More...
 
int set_num_subsets (const int new_num_subsets) override
 Attempts to change the number of subsets. More...
 
const shared_ptr< BinNormalisation > & get_normalisation_sptr () const
 
unique_ptr< ExamInfoget_exam_info_uptr_for_target () const override
 
void set_proj_matrix (const shared_ptr< ProjMatrixByBin > &)
 
void set_skip_balanced_subsets (const bool arg)
 
STIR_DEPRECATED void set_max_ring_difference (const int arg)
 
- Public Member Functions inherited from stir::RegisteredParsingObject< PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin< TargetT >, GeneralisedObjectiveFunction< TargetT >, PoissonLogLikelihoodWithLinearModelForMeanAndListModeData< TargetT > >
std::string get_registered_name () const override
 Returns Derived::registered_name.
 
std::string parameter_info () override
 Returns a string with all parameters and their values, in a form suitable for parsing again.
 
- Public Member Functions inherited from stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeData< TargetT >
void set_normalisation_sptr (const shared_ptr< BinNormalisation > &) override
 set_normalisation_sptr More...
 
void set_additive_proj_data_sptr (const shared_ptr< ExamData > &) override
 set_additive_proj_data_sptr More...
 
void set_input_data (const shared_ptr< ExamData > &) override
 set_input_data More...
 
const ListModeDataget_input_data () const override
 get input data More...
 
void set_max_segment_num_to_process (int)
 set maximum segment_number (in listmode data) to process More...
 
int get_max_segment_num_to_process () const
 get maximum segment_number (from listmode data) to process More...
 
virtual void set_cache_path (const std::string &cache_path)
 Set the directory where data will be cached. More...
 
virtual std::string get_cache_path () const
 Get the directory where data will be cached.
 
virtual std::string get_cache_filename (unsigned int icache) const
 Get the filename for a cache file. More...
 
void set_recompute_cache (bool)
 Set if existing cache files should be used or not. More...
 
bool get_recompute_cache () const
 
void set_skip_lm_input_file (const bool arg)
 Skip reading of listmode file entirely, only read from cache (broken!) More...
 
virtual void set_cache_max_size (const unsigned long int arg)
 Set maximum size (in bytes) of cache in memory. More...
 
virtual unsigned long int get_cache_max_size () const
 Get maximum size (in bytes) of cache.
 
- Public Member Functions inherited from stir::PoissonLogLikelihoodWithLinearModelForMean< TargetT >
void compute_sub_gradient_without_penalty (TargetT &gradient, const TargetT &current_estimate, const int subset_num) override
 Compute the subset gradient of the (unregularised) objective function. More...
 
virtual void compute_sub_gradient_without_penalty_plus_sensitivity (TargetT &gradient, const TargetT &current_estimate, const int subset_num)
 This should compute the subset gradient of the (unregularised) objective function plus the subset sensitivity. More...
 
Succeeded set_up (shared_ptr< TargetT > const &target_sptr) override
 set-up sensitivity etc if possible More...
 
const TargetT & get_sensitivity () const
 Get a const reference to the total sensitivity.
 
const TargetT & get_subset_sensitivity (const int subset_num) const
 Get a const reference to the sensitivity for a subset.
 
bool get_use_subset_sensitivities () const
 find out if subset_sensitivities are used More...
 
bool get_recompute_sensitivity () const
 find current value of recompute_sensitivity
 
std::string get_sensitivity_filename () const
 get filename to read (or write) the total sensitivity More...
 
std::string get_subsensitivity_filenames () const
 get filename pattern to read (or write) the subset sensitivities More...
 
void fill_nonidentifiable_target_parameters (TargetT &target, const float value) const override
 
void set_recompute_sensitivity (const bool)
 
void set_subset_sensitivity_sptr (const shared_ptr< TargetT > &, const int subset_num)
 
void set_use_subset_sensitivities (const bool)
 See get_use_subset_sensitivities()
 
void set_sensitivity_filename (const std::string &)
 set filename to read (or write) the total sensitivity More...
 
void set_subsensitivity_filenames (const std::string &)
 set filename pattern to read (or write) the subset sensitivities More...
 
- Public Member Functions inherited from stir::GeneralisedObjectiveFunction< TargetT >
virtual void compute_sub_gradient (TargetT &gradient, const TargetT &current_estimate, const int subset_num)
 Compute the subset-gradient of the objective function at current_estimate. More...
 
virtual void compute_gradient (TargetT &gradient, const TargetT &current_estimate)
 Compute the gradient of the objective function at the current_estimate. More...
 
virtual void compute_gradient_without_penalty (TargetT &gradient, const TargetT &current_estimate)
 Compute the gradient of the unregularised objective function at the current_estimate. More...
 
virtual double compute_objective_function_without_penalty (const TargetT &current_estimate, const int subset_num)
 Compute the value of the unregularised sub-objective function at the current_estimate. More...
 
virtual double compute_objective_function_without_penalty (const TargetT &current_estimate)
 Compute the value of the unregularised objective function at the current_estimate. More...
 
double compute_penalty (const TargetT &current_estimate, const int subset_num)
 Compute the value of the sub-penalty at the current_estimate. More...
 
double compute_penalty (const TargetT &current_estimate)
 Compute the value of the penalty at the current_estimate. More...
 
double compute_objective_function (const TargetT &current_estimate, const int subset_num)
 Compute the value of the sub-objective function at the current_estimate. More...
 
double compute_objective_function (const TargetT &current_estimate)
 Compute the value of the objective function at the current_estimate. More...
 
double compute_value (const TargetT &current_estimate)
 Alias for compute_objective_function(const TargetT&)
 
std::string get_objective_function_values_report (const TargetT &current_estimate)
 Construct a string with info on the value of objective function with and without penalty.
 
int get_num_subsets () const
 Return the number of subsets in-use.
 
bool subsets_are_approximately_balanced () const
 Checks of the current subset scheme is approximately balanced. More...
 
bool subsets_are_approximately_balanced (std::string &warning_message) const
 Checks of the current subset scheme is approximately balanced and constructs a warning message. More...
 
bool prior_is_zero () const
 check if the prior is set (or the penalisation factor is 0)
 
GeneralisedPrior< TargetT > *const get_prior_ptr () const
 Read-only access to the prior. More...
 
shared_ptr< GeneralisedPrior< TargetT > > get_prior_sptr ()
 
void set_prior_sptr (const shared_ptr< GeneralisedPrior< TargetT >> &)
 Change the prior. More...
 
Succeeded add_multiplication_with_approximate_sub_Hessian_without_penalty (TargetT &output, const TargetT &input, const int subset_num) const
 Functions that multiply the approximate (sub)Hessian with a \'vector\'. More...
 
Succeeded add_multiplication_with_approximate_sub_Hessian (TargetT &output, const TargetT &input, const int subset_num) const
 
Succeeded add_multiplication_with_approximate_Hessian_without_penalty (TargetT &output, const TargetT &input) const
 
Succeeded add_multiplication_with_approximate_Hessian (TargetT &output, const TargetT &input) const
 
Succeeded accumulate_Hessian_times_input (TargetT &output, const TargetT &current_image_estimate, const TargetT &input) const
 Functions that multiply the True (sub)Hessian with a \'vector\'. More...
 
Succeeded accumulate_Hessian_times_input_without_penalty (TargetT &output, const TargetT &current_image_estimate, const TargetT &input) const
 
Succeeded accumulate_sub_Hessian_times_input (TargetT &output, const TargetT &current_image_estimate, const TargetT &input, const int subset_num) const
 
Succeeded accumulate_sub_Hessian_times_input_without_penalty (TargetT &output, const TargetT &current_image_estimate, const TargetT &input, const int subset_num) const
 
- Public Member Functions inherited from stir::ParsingObject
 ParsingObject (const ParsingObject &)
 
ParsingObjectoperator= (const ParsingObject &)
 
void ask_parameters ()
 
bool parse (std::istream &f)
 
bool parse (const char *const filename)
 

Static Public Attributes

static const char *const registered_name = "PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin"
 Name which will be used when parsing a GeneralisedObjectiveFunction object.
 

Protected Member Functions

Succeeded set_up_before_sensitivity (shared_ptr< const TargetT > const &target_sptr) override
 set-up specifics for the derived class
 
void add_subset_sensitivity (TargetT &sensitivity, const int subset_num) const override
 Add subset sensitivity to existing data.
 
void set_defaults () override
 sets any default values
 
void initialise_keymap () override
 sets keys for parsing
 
bool post_processing () override
 This will be called at the end of the parsing. More...
 
bool actual_subsets_are_approximately_balanced (std::string &warning_message) const override
 Implementation of function that checks subset balancing. More...
 
- Protected Member Functions inherited from stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeData< TargetT >
virtual void start_new_time_frame (const unsigned int new_frame_num)
 will be called when a new time frame starts More...
 
- Protected Member Functions inherited from stir::PoissonLogLikelihoodWithLinearModelForMean< TargetT >
void compute_sensitivities ()
 compute subset and total sensitivity More...
 
- Protected Member Functions inherited from stir::GeneralisedObjectiveFunction< TargetT >
virtual Succeeded actual_add_multiplication_with_approximate_sub_Hessian_without_penalty (TargetT &output, const TargetT &input, const int subset_num) const
 Implementation of the function that multiplies the approximate sub-Hessian with a vector. 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

int max_ring_difference_num_to_process
 Maximum ring difference to take into account. More...
 
bool use_tofsens
 Triggers calculation of sensitivity using time-of-flight.
 
shared_ptr< ProjMatrixByBinPM_sptr
 Stores the projectors that are used for the computations.
 
shared_ptr< ProjectorByBinPairprojector_pair_sptr
 Stores the projectors that are used for the computations.
 
shared_ptr< BackProjectorByBinsens_backprojector_sptr
 Backprojector used for sensitivity computation.
 
shared_ptr< ProjDataInfosens_proj_data_info_sptr
 Proj data info to be used for sensitivity calculations. More...
 
bool skip_balanced_subsets
 If you know, or have previously checked that the number of subsets is balanced for your Scanner geometry, you can skip future checks.
 
- Protected Attributes inherited from stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeData< TargetT >
std::string frame_defs_filename
 
std::string list_mode_filename
 Filename with input projection data.
 
shared_ptr< ProjDataadditive_proj_data_sptr
 
std::string additive_projection_data_filename
 filename for additive data (only used when parsing)
 
bool reduce_memory_usage
 If true, the additive sinogram will not be read in memory.
 
shared_ptr< BinNormalisationnormalisation_sptr
 
shared_ptr< ListModeDatalist_mode_data_sptr
 Listmode pointer.
 
unsigned int current_frame_num
 
long int num_events_to_use
 This is part of some functionality I transfer from LmToProjData.
 
bool do_time_frame
 Reconstruct based on time frames.
 
ParseAndCreateFrom< TargetT, ListModeDatatarget_parameter_parser
 
unsigned long int cache_size
 This is the number of records to be cached. If this parameter is more than zero, then the flag cache_lm_file will be set to true. The listmode file up to this size will be loaded in the RAM, alongside with any additive sinograms.
 
bool cache_lm_file
 This flag is true when cache_size is more than zero.
 
bool recompute_cache
 On the first cached run, the cache will be written in the cache_path. If recompute_cache is set to zero then every consecutive reconstruction will use that cache file. If you want to create a new, either delete the previous or set this 1. More...
 
bool skip_lm_input_file
 This flag is set when we don't set an input lm filename and rely only on the cache file.
 
std::string cache_path
 Path to read/write the cached listmode file. More...
 
bool has_add
 The data set has additive corrections.
 
shared_ptr< ProjDataInfoproj_data_info_sptr
 ProjDataInfo. More...
 
- Protected Attributes inherited from stir::GeneralisedObjectiveFunction< TargetT >
int num_subsets
 
bool already_set_up
 
shared_ptr< GeneralisedPrior< TargetT > > prior_sptr
 
- Protected Attributes inherited from stir::ParsingObject
KeyParser parser
 

Additional Inherited Members

- Static Public Member Functions inherited from stir::RegisteredParsingObject< PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin< TargetT >, GeneralisedObjectiveFunction< TargetT >, PoissonLogLikelihoodWithLinearModelForMeanAndListModeData< TargetT > >
static GeneralisedObjectiveFunction< TargetT > * read_from_stream (std::istream *)
 Construct a new object (of type Derived) by parsing the istream. More...
 
- Static Public Member Functions inherited from stir::RegisteredObject< GeneralisedObjectiveFunction< TargetT > >
static GeneralisedObjectiveFunction< TargetT > * read_registered_object (std::istream *in, const std::string &registered_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 GeneralisedObjectiveFunction< 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...
 
- Public Attributes inherited from stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeData< TargetT >
TimeFrameDefinitions frame_defs
 time frame definitions More...
 
- Protected Types inherited from stir::RegisteredObject< GeneralisedObjectiveFunction< TargetT > >
typedef GeneralisedObjectiveFunction< 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_lessRegistryType
 The type of the registry.
 
- Static Protected Member Functions inherited from stir::RegisteredObject< GeneralisedObjectiveFunction< TargetT > >
static RegistryTyperegistry ()
 Static function returning the registry. More...
 

Detailed Description

template<typename TargetT>
class stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin< TargetT >

Class for PET list mode data from static images for a scanner with discrete detectors.

If the scanner has discrete (and stationary) detectors, it can be modeled via ProjMatrixByBin and BinNormalisation.

See also
PoissonLogLikelihoodWithLinearModelForMeanAndProjData

If the list mode data is binned (with LmToProjData) without merging any bins, then the log likelihood computed from list mode data and projection data will be identical.

Currently, the subset scheme is the same for the projection data and listmode data, i.e. based on views. This is suboptimal for listmode data.

Todo:
implement a subset scheme based on events

Member Function Documentation

◆ actual_compute_objective_function_without_penalty()

template<typename TargetT >
double stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin< TargetT >::actual_compute_objective_function_without_penalty ( const TargetT &  current_estimate,
const int  subset_num 
)
overridevirtual

Computes the value of the objective function at the current_estimate.

Warning
If add_sensitivity = false and use_subset_sensitivities = false will return an error because the value will not be correct. Try use_subset_sensitivities = true.

Implements stir::GeneralisedObjectiveFunction< TargetT >.

References stir::error(), stir::inner_product(), and stir::LM_distributable_computation().

◆ actual_compute_subset_gradient_without_penalty()

template<typename TargetT >
void stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin< TargetT >::actual_compute_subset_gradient_without_penalty ( TargetT &  gradient,
const TargetT &  current_estimate,
const int  subset_num,
const bool  add_sensitivity 
)
overridevirtual

Computes the gradient of the objective function at the current_estimate overwriting gradient.

Warning
If add_sensitivity = false and use_subset_sensitivities = false will return an error because the gradient will not be correct. Try use_subset_sensitivities = true.

Implements stir::PoissonLogLikelihoodWithLinearModelForMean< TargetT >.

References stir::error().

◆ actual_accumulate_sub_Hessian_times_input_without_penalty()

template<typename TargetT >
Succeeded stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin< TargetT >::actual_accumulate_sub_Hessian_times_input_without_penalty ( TargetT &  output,
const TargetT &  current_image_estimate,
const TargetT &  input,
const int  subset_num 
) const
overridevirtual

Implementation of the function computes the sub-Hessian and multiplies by a vector.

See also
accumulate_sub_Hessian_times_input_without_penalty(TargetT&,const TargetT&, TargetT&, const int).
Warning
The default implementation just calls error(). This behaviour has to be overloaded by the derived classes.
Developer\'s note

The reason we have this function is that overloading a function in a derived class, hides all functions of the same name.

Reimplemented from stir::GeneralisedObjectiveFunction< TargetT >.

References stir::error().

◆ construct_target_ptr()

template<typename TargetT >
TargetT * stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin< TargetT >::construct_target_ptr ( ) const
overridevirtual

Creates a suitable target as determined by the parameters.

Warning
This should not check already_set_up (unfortunately), as it is currently called in Reconstruction::reconstruct() before calling set_up().

Implements stir::GeneralisedObjectiveFunction< TargetT >.

◆ set_num_subsets()

template<typename TargetT >
int stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin< TargetT >::set_num_subsets ( const int  num_subsets)
overridevirtual

Attempts to change the number of subsets.

Returns
The number of subsets that will be used later, which is not guaranteed to be what you asked for.

Implements stir::GeneralisedObjectiveFunction< TargetT >.

References stir::ExamData::get_exam_info_sptr(), and stir::ProjData::get_proj_data_info_sptr().

Referenced by stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBinTests::run_tests_for_objective_function().

◆ post_processing()

template<typename TargetT >
bool stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin< TargetT >::post_processing ( )
overrideprotectedvirtual

This will be called at the end of the parsing.

Returns
false if everything OK, true if not

Reimplemented from stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeData< TargetT >.

References stir::error(), stir::FilePath::get_as_string(), stir::info(), stir::FilePath::is_regular_file(), and stir::warning().

◆ actual_subsets_are_approximately_balanced()

template<typename TargetT >
bool stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin< TargetT >::actual_subsets_are_approximately_balanced ( std::string &  warning_message) const
overrideprotectedvirtual

Implementation of function that checks subset balancing.

See also
subsets_are_approximately_balanced(std::string&)
Developer\'s note

The reason we have this function is that overloading subsets_are_approximately_balanced(std::string&) in a derived class would hide subsets_are_approximately_balanced().

Implements stir::GeneralisedObjectiveFunction< TargetT >.

References stir::Array< num_dimensions, elemT >::fill(), stir::DataSymmetriesForBins::num_related_bins(), and stir::warning().

Member Data Documentation

◆ max_ring_difference_num_to_process

template<typename TargetT>
int stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin< TargetT >::max_ring_difference_num_to_process
protected

Maximum ring difference to take into account.

Deprecated:

◆ sens_proj_data_info_sptr

template<typename TargetT>
shared_ptr<ProjDataInfo> stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin< TargetT >::sens_proj_data_info_sptr
protected

Proj data info to be used for sensitivity calculations.

This is set to non-TOF data if use_tofsens == false


The documentation for this class was generated from the following files: