STIR  6.2.0
ParametricQuadraticPrior.h
Go to the documentation of this file.
1 //
2 //
3 /*
4  Copyright (C) 2006- 2009, Hammersmith Imanet Ltd
5  This file is part of STIR.
6 
7  SPDX-License-Identifier: Apache-2.0
8 
9  See STIR/LICENSE.txt for details.
10 */
22 #ifndef __stir_recon_buildblock_ParametricQuadraticPrior_H__
23 #define __stir_recon_buildblock_ParametricQuadraticPrior_H__
24 
28 #include "stir/Array.h"
31 #include "stir/VectorWithOffset.h"
33 #include "stir/shared_ptr.h"
34 #include <string>
35 
36 START_NAMESPACE_STIR
37 
80 template <typename TargetT>
81 class ParametricQuadraticPrior : public RegisteredParsingObject<ParametricQuadraticPrior<TargetT>,
82  GeneralisedPrior<TargetT>,
83  PriorWithParabolicSurrogate<TargetT>>
84 {
85 private:
89  base_type;
90  shared_ptr<TargetT> kappa_ptr;
91  VectorWithOffset<QuadraticPrior<float>> _single_quadratic_priors;
92 
93 public:
95  static const char* const registered_name;
96 
99 
101  ParametricQuadraticPrior(const bool only_2D, float penalization_factor);
102 
103  virtual bool parabolic_surrogate_curvature_depends_on_argument() const { return false; }
104 
106  double compute_value(const TargetT& current_image_estimate);
107 
109  void compute_gradient(TargetT& prior_gradient, const TargetT& current_image_estimate);
110 
112 
113  void parabolic_surrogate_curvature(TargetT& parabolic_surrogate_curvature, const TargetT& current_image_estimate);
114 #if 0
115  void compute_Hessian(TargetT& prior_Hessian_for_single_densel,
117  const BasicCoordinate<3,int>& coords, const unsigned int input_param_num,
118  const TargetT &current_image_estimate);
119 #endif
120 
121  virtual Succeeded add_multiplication_with_approximate_Hessian(TargetT& output, const TargetT& input) const;
122 
124  Array<3, float> get_weights() const;
125 
127  void set_weights(const Array<3, float>&);
128 
130 
134  shared_ptr<TargetT> get_kappa_sptr() const;
135 
137  void set_kappa_sptr(const shared_ptr<TargetT>&);
138 
140  virtual Succeeded set_up(shared_ptr<const TargetT> const& target_sptr);
141 
142 protected:
144  bool only_2D;
146 
151 
153 
159  std::string kappa_filename; // CHECK IF THERE IS A CONFILCT WHEN GIVING A KAPPA FILE...// THINK IF IT IS BETTER TO ESTIMATE
160  // KAPPA FILE IN THE CODE...
161 
163  virtual void check(TargetT const& current_image_estimate) const;
164 
165  virtual void set_defaults();
166  virtual void initialise_keymap();
167  virtual bool post_processing();
168 };
169 
170 END_NAMESPACE_STIR
171 
172 #endif
A templated class for vectors, but with indices starting not from 0.
Definition: ArrayFilter1DUsingConvolution.h:31
Declaration of class stir::QuadraticPrior.
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast (or corresponding b...
defines the stir::DiscretisedDensity class
defines the Array class for multi-dimensional (numeric) arrays
std::string kappa_filename
Filename for the image that will be read by post_processing()
Definition: ParametricQuadraticPrior.h:159
Array< 3, float > weights
penalty weights
Definition: ParametricQuadraticPrior.h:157
A class in the GeneralisedPrior hierarchy. This implements a quadratic Gibbs prior.
Definition: ParametricQuadraticPrior.h:81
this class implements priors with a parabolic surrogate curvature
Definition: PriorWithParabolicSurrogate.h:39
std::string gradient_filename_prefix
filename prefix for outputing the gradient whenever compute_gradient() is called. ...
Definition: ParametricQuadraticPrior.h:150
virtual bool parabolic_surrogate_curvature_depends_on_argument() const
A function that allows skipping some computations if the curvature is independent of the current_esti...
Definition: ParametricQuadraticPrior.h:103
defines the stir::VectorWithOffset class
Declaration of class stir::ParametricDiscretisedDensity.
Parent class for all leaves in a RegisteredObject hierarchy that do parsing of parameter files...
Definition: RegisteredParsingObject.h:77
static const char *const registered_name
Name which will be used when parsing a GeneralisedPrior object.
Definition: ParametricQuadraticPrior.h:95
Declaration of class stir::PriorWithParabolicSurrogate.
bool only_2D
can be set during parsing to restrict the weights to the 2D case
Definition: ParametricQuadraticPrior.h:144
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::KineticParameters.
Declaration of class stir::RegisteredParsingObject.