STIR  6.2.0
PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin.h
Go to the documentation of this file.
1 //
2 //
3 /*
4  Copyright (C) 2003- 2011, Hammersmith Imanet Ltd
5  Copyright (C) 2015, Univ. of Leeds
6  Copyright (C) 2016, 2022, 2024 UCL
7  Copyright (C) 2021, University of Pennsylvania
8  SPDX-License-Identifier: Apache-2.0
9 
10  See STIR/LICENSE.txt for details
11 */
23 #ifndef __stir_recon_buildblock_PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin_H__
24 #define __stir_recon_buildblock_PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin_H__
25 
30 #include "stir/ProjDataInMemory.h"
32 #include "stir/ExamInfo.h"
33 #include "stir/deprecated.h"
35 #include "stir/error.h"
36 START_NAMESPACE_STIR
37 
57 template <typename TargetT>
59  : public RegisteredParsingObject<PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin<TargetT>,
60  GeneralisedObjectiveFunction<TargetT>,
61  PoissonLogLikelihoodWithLinearModelForMeanAndListModeData<TargetT>>
62 
63 {
64 
65 private:
69  base_type;
70 
71 public:
73  static const char* const registered_name;
74 
76 
78 
82  double actual_compute_objective_function_without_penalty(const TargetT& current_estimate, const int subset_num) override;
83 
85 
89  void actual_compute_subset_gradient_without_penalty(TargetT& gradient,
90  const TargetT& current_estimate,
91  const int subset_num,
92  const bool add_sensitivity) override;
93 
94  Succeeded actual_accumulate_sub_Hessian_times_input_without_penalty(TargetT& output,
95  const TargetT& current_image_estimate,
96  const TargetT& input,
97  const int subset_num) const override;
98 
99  TargetT* construct_target_ptr() const override;
100 
101  int set_num_subsets(const int new_num_subsets) override;
102 
103  const shared_ptr<BinNormalisation>& get_normalisation_sptr() const { return this->normalisation_sptr; }
104 
105  unique_ptr<ExamInfo> get_exam_info_uptr_for_target() const override;
106 
107  void set_proj_matrix(const shared_ptr<ProjMatrixByBin>&);
108 
109  void set_skip_balanced_subsets(const bool arg);
110 
111 #if STIR_VERSION < 060000
113  void set_max_ring_difference(const int arg);
114 #endif
115 
116 protected:
117  Succeeded set_up_before_sensitivity(shared_ptr<const TargetT> const& target_sptr) override;
118 
119  void add_subset_sensitivity(TargetT& sensitivity, const int subset_num) const override;
120 
121 #if STIR_VERSION < 060000
122 
125 #endif
126 
129 
131  shared_ptr<ProjMatrixByBin> PM_sptr;
132 
134  shared_ptr<ProjectorByBinPair> projector_pair_sptr;
135 
137  shared_ptr<BackProjectorByBin> sens_backprojector_sptr;
139 
140  shared_ptr<ProjDataInfo> sens_proj_data_info_sptr;
141 
143  void set_defaults() override;
145  void initialise_keymap() override;
146  bool post_processing() override;
147 
148  bool actual_subsets_are_approximately_balanced(std::string& warning_message) const override;
149 
153 
154 private:
156 
158  mutable std::vector<BinAndCorr> record_cache;
159 
161 
168  bool load_listmode_batch(unsigned int ibatch) const;
169 
171 
181  bool read_listmode_batch(unsigned int ibatch) const;
183 
185  Succeeded cache_listmode_file();
186 
188  bool load_listmode_cache_file(unsigned int file_id) const;
189  Succeeded write_listmode_cache_file(unsigned int file_id) const;
190 
191  unsigned int num_cache_files;
192  mutable std::vector<double> end_time_per_batch;
193 };
194 
195 END_NAMESPACE_STIR
196 
197 //#include "stir/recon_buildblock/PoissonLogLikelihoodWithLinearModelForMean.inl"
198 
199 #endif
#define STIR_DEPRECATED
Deprecation macro.
Definition: deprecated.h:19
shared_ptr< ProjMatrixByBin > PM_sptr
Stores the projectors that are used for the computations.
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin.h:131
This file declares the class stir::ExamInfo.
A base class for &#39;generalised&#39; objective functions, i.e. objective functions for which at least a &#39;gr...
Definition: GeneralisedObjectiveFunction.h:83
shared_ptr< ProjDataInfo > sens_proj_data_info_sptr
Proj data info to be used for sensitivity calculations.
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin.h:140
Declaration of the main functions that perform parallel processing.
Declaration of class stir::ProjDataFromStream.
This file declares a deprecation macro.
Declaration of class stir::ProjDataInMemory.
static const char *const registered_name
Name which will be used when parsing a GeneralisedObjectiveFunction object.
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin.h:73
bool skip_balanced_subsets
If you know, or have previously checked that the number of subsets is balanced for your Scanner geome...
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin.h:152
An objective function class appropriate for PET list mode data.
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndListModeData.h:64
Declaration of stir::error()
Declaration of class stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeData.
bool use_tofsens
Triggers calculation of sensitivity using time-of-flight.
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin.h:128
declaration of stir::ProjMatrixByBin and its helpers classes
shared_ptr< BackProjectorByBin > sens_backprojector_sptr
Backprojector used for sensitivity computation.
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin.h:137
shared_ptr< ProjectorByBinPair > projector_pair_sptr
Stores the projectors that are used for the computations.
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin.h:134
Parent class for all leaves in a RegisteredObject hierarchy that do parsing of parameter files...
Definition: RegisteredParsingObject.h:77
Declares class stir::ProjectorByBinPairUsingProjMatrixByBin.
int max_ring_difference_num_to_process
Maximum ring difference to take into account.
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin.h:124
Class for PET list mode data from static images for a scanner with discrete detectors.
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin.h:58
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition: Succeeded.h:43
Declaration of class stir::RegisteredParsingObject.