STIR  6.2.0
PoissonLogLikelihoodWithLinearModelForMean.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2011-01-14, Hammersmith Imanet Ltd
3  Copyright (C) 2012, Kris Thielemans
4 
5  SPDX-License-Identifier: Apache-2.0
6 
7  See STIR/LICENSE.txt for details
8 */
18 #ifndef __stir_recon_buildblock_PoissonLogLikelihoodWithLinearModelForMean_H__
19 #define __stir_recon_buildblock_PoissonLogLikelihoodWithLinearModelForMean_H__
20 
22 
23 START_NAMESPACE_STIR
24 
110 template <typename TargetT>
111 class PoissonLogLikelihoodWithLinearModelForMean : public GeneralisedObjectiveFunction<TargetT>
112 {
113 private:
114  typedef GeneralisedObjectiveFunction<TargetT> base_type;
115 
116 public:
117  // PoissonLogLikelihoodWithLinearModelForMean();
118 
120 
132  void compute_sub_gradient_without_penalty(TargetT& gradient, const TargetT& current_estimate, const int subset_num) override;
133 
135 
146  virtual void
147  compute_sub_gradient_without_penalty_plus_sensitivity(TargetT& gradient, const TargetT& current_estimate, const int subset_num);
148 
150 
162  Succeeded set_up(shared_ptr<TargetT> const& target_sptr) override;
163 
165  const TargetT& get_sensitivity() const;
167  const TargetT& get_subset_sensitivity(const int subset_num) const;
168 
170  virtual void add_subset_sensitivity(TargetT& sensitivity, const int subset_num) const = 0;
171 
173 
177  bool get_use_subset_sensitivities() const;
178 
180  bool get_recompute_sensitivity() const;
181 
183 
184  std::string get_sensitivity_filename() const;
186 
190  std::string get_subsensitivity_filenames() const;
191 
199  void set_recompute_sensitivity(const bool);
200  void set_subset_sensitivity_sptr(const shared_ptr<TargetT>&, const int subset_num);
201 
203  void set_use_subset_sensitivities(const bool);
204 
206 
207  void set_sensitivity_filename(const std::string&);
209 
215  void set_subsensitivity_filenames(const std::string&);
217 
221  void fill_nonidentifiable_target_parameters(TargetT& target, const float value) const override;
222 
223 private:
224  std::string sensitivity_filename;
225  std::string subsensitivity_filenames;
226  bool recompute_sensitivity;
227  bool use_subset_sensitivities;
228 
229  VectorWithOffset<shared_ptr<TargetT>> subsensitivity_sptrs;
230  shared_ptr<TargetT> sensitivity_sptr;
231 
233  shared_ptr<TargetT> get_subset_sensitivity_sptr(const int subset_num) const;
235 
242  void set_total_or_subset_sensitivities();
243 
244 protected:
246  virtual Succeeded set_up_before_sensitivity(shared_ptr<const TargetT> const& target_sptr) = 0;
247 
249 
253  void compute_sensitivities();
254 
256 
270  virtual void actual_compute_subset_gradient_without_penalty(TargetT& gradient,
271  const TargetT& current_estimate,
272  const int subset_num,
273  const bool add_sensitivity)
274  = 0;
275 
277 
280  void set_defaults() override;
281  void initialise_keymap() override;
282  bool post_processing() override;
283 };
284 
285 END_NAMESPACE_STIR
286 
287 //#include "stir/recon_buildblock/PoissonLogLikelihoodWithLinearModelForMean.inl"
288 
289 #endif
Declaration of class stir::GeneralisedObjectiveFunction.