STIR 6.4.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*/
17
18#ifndef __stir_recon_buildblock_PoissonLogLikelihoodWithLinearModelForMean_H__
19#define __stir_recon_buildblock_PoissonLogLikelihoodWithLinearModelForMean_H__
20
22
23START_NAMESPACE_STIR
24
110template <typename TargetT>
111class PoissonLogLikelihoodWithLinearModelForMean : public GeneralisedObjectiveFunction<TargetT>
112{
113private:
114 typedef GeneralisedObjectiveFunction<TargetT> base_type;
115
116public:
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
193
194 std::string get_subsensitivity_filename(const int subset_num) const;
195
203 void set_recompute_sensitivity(const bool);
204 void set_subset_sensitivity_sptr(const shared_ptr<TargetT>&, const int subset_num);
205
207 void set_use_subset_sensitivities(const bool);
208
210
211 void set_sensitivity_filename(const std::string&);
213
219 void set_subsensitivity_filenames(const std::string&);
221
225 void fill_nonidentifiable_target_parameters(TargetT& target, const float value) const override;
226
227private:
228 std::string sensitivity_filename;
229 std::string subsensitivity_filenames;
230 bool recompute_sensitivity;
231 bool use_subset_sensitivities;
232
233 VectorWithOffset<shared_ptr<TargetT>> subsensitivity_sptrs;
234 shared_ptr<TargetT> sensitivity_sptr;
235
237 shared_ptr<TargetT> get_subset_sensitivity_sptr(const int subset_num) const;
239
246 void set_total_or_subset_sensitivities();
247
248protected:
250 virtual Succeeded set_up_before_sensitivity(shared_ptr<const TargetT> const& target_sptr) = 0;
251
253
258
260
275 const TargetT& current_estimate,
276 const int subset_num,
277 const bool add_sensitivity)
278 = 0;
279
281
284 void set_defaults() override;
285 void initialise_keymap() override;
286 bool post_processing() override;
287};
288
289END_NAMESPACE_STIR
290
291//#include "stir/recon_buildblock/PoissonLogLikelihoodWithLinearModelForMean.inl"
292
293#endif
Declaration of class stir::GeneralisedObjectiveFunction.
a base class for LogLikelihood of independent Poisson variables where the mean values are linear comb...
Definition PoissonLogLikelihoodWithLinearModelForMean.h:112
std::string get_subsensitivity_filename(const int subset_num) const
Return the filename for a particular subset.
Definition PoissonLogLikelihoodWithLinearModelForMean.cxx:91
bool get_recompute_sensitivity() const
find current value of recompute_sensitivity
Definition PoissonLogLikelihoodWithLinearModelForMean.cxx:157
void set_sensitivity_filename(const std::string &)
set filename to read (or write) the total sensitivity
Definition PoissonLogLikelihoodWithLinearModelForMean.cxx:104
void set_defaults() override
Sets defaults for parsing.
Definition PoissonLogLikelihoodWithLinearModelForMean.cxx:41
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.
Definition PoissonLogLikelihoodWithLinearModelForMean.cxx:353
const TargetT & get_sensitivity() const
Get a const reference to the total sensitivity.
Definition PoissonLogLikelihoodWithLinearModelForMean.cxx:150
void set_subsensitivity_filenames(const std::string &)
set filename pattern to read (or write) the subset sensitivities
Definition PoissonLogLikelihoodWithLinearModelForMean.cxx:112
bool post_processing() override
This will be called at the end of the parsing.
Definition PoissonLogLikelihoodWithLinearModelForMean.cxx:66
void compute_sensitivities()
compute subset and total sensitivity
Definition PoissonLogLikelihoodWithLinearModelForMean.cxx:374
virtual void add_subset_sensitivity(TargetT &sensitivity, const int subset_num) const =0
Add subset sensitivity to existing data.
bool get_use_subset_sensitivities() const
find out if subset_sensitivities are used
Definition PoissonLogLikelihoodWithLinearModelForMean.cxx:171
virtual void actual_compute_subset_gradient_without_penalty(TargetT &gradient, const TargetT &current_estimate, const int subset_num, const bool add_sensitivity)=0
computes the subset gradient of the objective function without the penalty (optional: add subset sens...
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 sen...
Definition PoissonLogLikelihoodWithLinearModelForMean.cxx:364
std::string get_subsensitivity_filenames() const
get filename pattern to read (or write) the subset sensitivities
Definition PoissonLogLikelihoodWithLinearModelForMean.cxx:84
virtual Succeeded set_up_before_sensitivity(shared_ptr< const TargetT > const &target_sptr)=0
set-up specifics for the derived class
void fill_nonidentifiable_target_parameters(TargetT &target, const float value) const override
Definition PoissonLogLikelihoodWithLinearModelForMean.cxx:459
void set_use_subset_sensitivities(const bool)
See get_use_subset_sensitivities()
Definition PoissonLogLikelihoodWithLinearModelForMean.cxx:178
const TargetT & get_subset_sensitivity(const int subset_num) const
Get a const reference to the sensitivity for a subset.
Definition PoissonLogLikelihoodWithLinearModelForMean.cxx:143
void initialise_keymap() override
sets parsing keys
Definition PoissonLogLikelihoodWithLinearModelForMean.cxx:54
Succeeded set_up(shared_ptr< TargetT > const &target_sptr) override
set-up sensitivity etc if possible
Definition PoissonLogLikelihoodWithLinearModelForMean.cxx:195
std::string get_sensitivity_filename() const
get filename to read (or write) the total sensitivity
Definition PoissonLogLikelihoodWithLinearModelForMean.cxx:77
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition Succeeded.h:44
A templated class for vectors, but with indices starting not from 0.
Definition VectorWithOffset.h:65