STIR  6.2.0
PoissonLogLikelihoodWithLinearModelForMeanAndGatedProjDataWithMotion.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2006- 2009, Hammersmith Imanet Ltd
3  Copyright (C) 2010- 2013, King's College London
4  Copyright (C) 2018, University College London
5 
6  SPDX-License-Identifier: Apache-2.0
7 
8  See STIR/LICENSE.txt for details
9 */
21 #ifndef __stir_recon_buildblock_PoissonLogLikelihoodWithLinearModelForMeanAndGatedProjDataWithMotion_H__
22 #define __stir_recon_buildblock_PoissonLogLikelihoodWithLinearModelForMeanAndGatedProjDataWithMotion_H__
23 #include "stir/shared_ptr.h"
24 #include "stir/RegisteredObject.h"
29 #include "stir/VectorWithOffset.h"
30 #include "stir/GatedProjData.h"
33 
34 START_NAMESPACE_STIR
35 
53 template <typename TargetT>
55  : public RegisteredParsingObject<PoissonLogLikelihoodWithLinearModelForMeanAndGatedProjDataWithMotion<TargetT>,
56  GeneralisedObjectiveFunction<TargetT>,
57  PoissonLogLikelihoodWithLinearModelForMean<TargetT>>
58 {
59 private:
63  base_type;
65  VectorWithOffset<SingleGateObjFunc> _single_gate_obj_funcs;
66 
67  TimeGateDefinitions _time_gate_definitions;
68 
69 public:
71  static const char* const registered_name;
72 
74 
76 
79  TargetT* construct_target_ptr() const override;
80 
81  void actual_compute_subset_gradient_without_penalty(TargetT& gradient,
82  const TargetT& current_estimate,
83  const int subset_num,
84  const bool add_sensitivity) override;
85 
86  double actual_compute_objective_function_without_penalty(const TargetT& current_estimate, const int subset_num) override;
87 
88  Succeeded set_up_before_sensitivity(shared_ptr<const TargetT> const& target_sptr) override;
89 
91  void add_subset_sensitivity(TargetT& sensitivity, const int subset_num) const override;
92 
93  Succeeded actual_add_multiplication_with_approximate_sub_Hessian_without_penalty(TargetT& output,
94  const TargetT& input,
95  const int subset_num) const override;
96  Succeeded actual_accumulate_sub_Hessian_times_input_without_penalty(TargetT& output,
97  const TargetT& current_image_estimate,
98  const TargetT& input,
99  const int subset_num) const override;
100 
101  void set_time_gate_definitions(const TimeGateDefinitions& time_gate_definitions);
102 
108  const GatedProjData& get_gated_proj_data() const;
109  const shared_ptr<GatedProjData>& get_gated_proj_data_sptr() const;
110  const int get_max_segment_num_to_process() const;
111  const bool get_zero_seg0_end_planes() const;
112  const GatedProjData& get_additive_gated_proj_data() const;
113  const shared_ptr<GatedProjData>& get_additive_gated_proj_data_sptr() const;
114  const GatedProjData& get_normalisation_gated_proj_data() const;
115  const shared_ptr<GatedProjData>& get_normalisation_gated_proj_data_sptr() const;
116  const ProjectorByBinPair& get_projector_pair() const;
117  const shared_ptr<ProjectorByBinPair>& get_projector_pair_sptr() const;
119 
127  void set_recompute_sensitivity(const bool);
128  void set_sensitivity_sptr(const shared_ptr<TargetT>&);
129  int set_num_subsets(const int num_subsets) override;
130 
131  void set_normalisation_sptr(const shared_ptr<BinNormalisation>&) override;
132  void set_additive_proj_data_sptr(const shared_ptr<ExamData>&) override;
133 
134  void set_input_data(const shared_ptr<ExamData>&) override;
135  const GatedProjData& get_input_data() const override;
137 protected:
139  std::string _input_filename;
140  std::string _motion_vectors_filename_prefix;
141  std::string _reverse_motion_vectors_filename_prefix;
142  std::string _gate_definitions_filename;
143 
145  shared_ptr<GatedProjData> _gated_proj_data_sptr;
146 
148 
150 
151  const TimeGateDefinitions& get_time_gate_definitions() const;
152 
153  /**********************/
154  ParseAndCreateFrom<TargetT, GatedProjData> target_parameter_parser;
155  /********************************/
158 
161 
163 
164  shared_ptr<GatedProjData> _additive_gated_proj_data_sptr;
165  shared_ptr<GatedProjData> _normalisation_gated_proj_data_sptr;
169  shared_ptr<ProjectorByBinPair> _projector_pair_ptr;
173  int _motion_correction_type; // This could be set up in a more generic way in order to choose how motion correction will be
174  // applied//
175  GatedSpatialTransformation _motion_vectors;
176  GatedSpatialTransformation _reverse_motion_vectors;
177 
180  bool actual_subsets_are_approximately_balanced(std::string& warning_message) const override;
181 
183  void set_defaults() override;
184  void initialise_keymap() override;
185  bool post_processing() override;
186 };
187 
188 END_NAMESPACE_STIR
189 
190 #endif
std::string _normalisation_gated_proj_data_filename
name of file in which normalisation projection data are stored
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndGatedProjDataWithMotion.h:160
std::string _input_filename
Filename with input projection data.
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndGatedProjDataWithMotion.h:139
Definition of the stir::ParseAndCreateFrom class.
Declaration of class stir::GatedSpatialTransformation.
A templated class for vectors, but with indices starting not from 0.
Definition: ArrayFilter1DUsingConvolution.h:31
Declaration of class stir::PoissonLogLikelihoodWithLinearModelForMeanAndProjData. ...
A base class for &#39;generalised&#39; objective functions, i.e. objective functions for which at least a &#39;gr...
Definition: GeneralisedObjectiveFunction.h:83
Class for spatial transformations for gated images.
Definition: GatedSpatialTransformation.h:36
std::string _normalisation_filename_prefix
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndGatedProjDataWithMotion.h:167
Abstract base class for all projector pairs.
Definition: ProjectorByBinPair.h:44
std::string _additive_gated_proj_data_filename
name of file in which additive projection data are stored
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndGatedProjDataWithMotion.h:157
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast (or corresponding b...
a base class for LogLikelihood of independent Poisson variables where the mean values are linear comb...
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndGatedProjDataWithMotion.h:54
GatedDiscretisedDensity _gated_image_template
gated image template
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndGatedProjDataWithMotion.h:179
static const char *const registered_name
Name which will be used when parsing a GeneralisedObjectiveFunction object.
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndGatedProjDataWithMotion.h:71
shared_ptr< ProjectorByBinPair > _projector_pair_ptr
Stores the projectors that are used for the computations.
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndGatedProjDataWithMotion.h:169
shared_ptr< GatedProjData > _gated_proj_data_sptr
points to the object for the total input projection data
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndGatedProjDataWithMotion.h:145
Declaration of class stir::PoissonLogLikelihoodWithLinearModelForMean.
Declaration of class stiir::RegisteredObject.
int _max_segment_num_to_process
the maximum absolute ring difference number to use in the reconstruction
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndGatedProjDataWithMotion.h:149
Declaration of class stir::GatedProjData.
defines the stir::VectorWithOffset class
int _motion_correction_type
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndGatedProjDataWithMotion.h:173
shared_ptr< GatedProjData > _additive_gated_proj_data_sptr
points to the additive projection data
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndGatedProjDataWithMotion.h:164
Parent class for all leaves in a RegisteredObject hierarchy that do parsing of parameter files...
Definition: RegisteredParsingObject.h:77
Class used for storing time gate durations.
Definition: TimeGateDefinitions.h:42
Class of multiple image gates.
Definition: GatedDiscretisedDensity.h:34
a base class for LogLikelihood of independent Poisson variables where the mean values are linear comb...
Definition: KOSMAPOSLReconstruction.h:39
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition: Succeeded.h:43
bool _zero_seg0_end_planes
signals whether to zero the data in the end planes of the projection data
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndGatedProjDataWithMotion.h:171
Declaration of class stir::RegisteredParsingObject.
An objective function class appropriate for PET emission data.
Definition: PoissonLogLikelihoodWithLinearModelForMeanAndProjData.h:121
Implementation of class stir::GatedDiscretisedDensity.