STIR
6.2.0
|
A base class for 'generalised' priors, i.e. priors for which at least a 'gradient' is defined. More...
#include "stir/recon_buildblock/GeneralisedPrior.h"
Public Member Functions | |
virtual double | compute_value (const DataT ¤t_estimate)=0 |
compute the value of the function More... | |
virtual void | compute_gradient (DataT &prior_gradient, const DataT ¤t_estimate)=0 |
This should compute the gradient of the log of the prior function at the current_estimate. More... | |
virtual void | compute_Hessian (DataT &prior_Hessian_for_single_densel, const BasicCoordinate< 3, int > &coords, const DataT ¤t_image_estimate) const |
This computes a single row of the Hessian. More... | |
virtual void | add_multiplication_with_approximate_Hessian (DataT &output, const DataT &input) const |
This should compute the multiplication of the Hessian with a vector and add it to output. More... | |
virtual void | accumulate_Hessian_times_input (DataT &output, const DataT ¤t_estimate, const DataT &input) const |
This should compute the multiplication of the Hessian with a vector and add it to output. More... | |
float | get_penalisation_factor () const |
void | set_penalisation_factor (float new_penalisation_factor) |
virtual Succeeded | set_up (shared_ptr< const DataT > const &target_sptr) |
Has to be called before using this object. | |
virtual bool | is_convex () const =0 |
Indicates if the prior is a smooth convex function. More... | |
Public Member Functions inherited from stir::RegisteredObjectBase | |
virtual std::string | get_registered_name () const =0 |
Returns the name of the type of the object. More... | |
Public Member Functions inherited from stir::ParsingObject | |
ParsingObject (const ParsingObject &) | |
ParsingObject & | operator= (const ParsingObject &) |
void | ask_parameters () |
virtual std::string | parameter_info () |
bool | parse (std::istream &f) |
bool | parse (const char *const filename) |
Protected Member Functions | |
void | set_defaults () override |
sets value for penalisation factor More... | |
void | initialise_keymap () override |
sets key for penalisation factor More... | |
virtual void | check (DataT const ¤t_estimate) const |
Check that the prior is ready to be used. | |
Protected Member Functions inherited from stir::ParsingObject | |
virtual bool | post_processing () |
This will be called at the end of the parsing. More... | |
virtual void | set_key_values () |
This will be called before parsing or parameter_info is called. More... | |
Protected Attributes | |
float | penalisation_factor |
bool | _already_set_up |
Protected Attributes inherited from stir::ParsingObject | |
KeyParser | parser |
Additional Inherited Members | |
Static Public Member Functions inherited from stir::RegisteredObject< GeneralisedPrior< DataT > > | |
static GeneralisedPrior< DataT > * | read_registered_object (std::istream *in, const std::string ®istered_name) |
Construct a new object (of a type derived from Root, its actual type determined by the registered_name parameter) by parsing the istream. More... | |
static GeneralisedPrior< DataT > * | ask_type_and_parameters () |
ask the user for the type, and then calls read_registered_object(0, type) More... | |
static void | list_registered_names (std::ostream &stream) |
List all possible registered names to the stream. More... | |
Protected Types inherited from stir::RegisteredObject< GeneralisedPrior< DataT > > | |
typedef GeneralisedPrior< DataT > *(* | RootFactory) (std::istream *) |
The type of a root factory is a function, taking an istream* as argument, and returning a Root*. | |
typedef FactoryRegistry< std::string, RootFactory, interfile_less > | RegistryType |
The type of the registry. | |
Static Protected Member Functions inherited from stir::RegisteredObject< GeneralisedPrior< DataT > > | |
static RegistryType & | registry () |
Static function returning the registry. More... | |
A base class for 'generalised' priors, i.e. priors for which at least a 'gradient' is defined.
This class exists to accomodate FilterRootPrior. Otherwise we could just live with Prior as a base class.
|
pure virtual |
compute the value of the function
For derived classes where this doesn't make sense, it's recommended to return 0.
Implemented in stir::PLSPrior< elemT >, stir::RelativeDifferencePrior< elemT >, stir::LogcoshPrior< elemT >, stir::ParametricQuadraticPrior< TargetT >, stir::QuadraticPrior< elemT >, stir::QuadraticPrior< float >, stir::FilterRootPrior< DataT >, and stir::CudaRelativeDifferencePrior< elemT >.
|
pure virtual |
This should compute the gradient of the log of the prior function at the current_estimate.
The gradient is already multiplied with the penalisation_factor.
Implemented in stir::PLSPrior< elemT >, stir::RelativeDifferencePrior< elemT >, stir::LogcoshPrior< elemT >, stir::ParametricQuadraticPrior< TargetT >, stir::QuadraticPrior< elemT >, stir::QuadraticPrior< float >, stir::FilterRootPrior< DataT >, and stir::CudaRelativeDifferencePrior< elemT >.
Referenced by stir::GeneralisedPriorTests::test_Hessian_against_numerical().
|
virtual |
This computes a single row of the Hessian.
Default implementation just call error(). This function needs to be overridden by the derived class.
The method computes a row (i.e. at a densel/voxel, indicated by coords
) of the Hessian at current_estimate
. Note that a row corresponds to an object of DataT
. The method (as implemented in derived classes) should store the result in prior_Hessian_for_single_densel
.
Referenced by stir::GeneralisedPriorTests::test_Hessian_against_numerical().
|
virtual |
This should compute the multiplication of the Hessian with a vector and add it to output.
Default implementation just call error(). This function needs to be overridden by the derived class. This method assumes that the hessian of the prior is 1 and hence the function quadratic. Instead, accumulate_Hessian_times_input() should be used. This method remains for backwards comparability.
Reimplemented in stir::ParametricQuadraticPrior< TargetT >.
|
virtual |
This should compute the multiplication of the Hessian with a vector and add it to output.
Default implementation just call error(). This function needs to be overridden by the derived class.
Referenced by stir::GeneralisedPriorTests::test_Hessian_convexity_configuration().
|
inline |
Referenced by stir::GeneralisedPriorTests::test_Hessian_convexity(), and stir::GeneralisedPriorTests::test_Hessian_convexity_configuration().
|
pure virtual |
Indicates if the prior is a smooth convex function.
If true, the prior is expected to have 0th, 1st and 2nd order behaviour implemented.
Implemented in stir::RelativeDifferencePrior< elemT >, stir::PLSPrior< elemT >, stir::LogcoshPrior< elemT >, stir::QuadraticPrior< elemT >, stir::QuadraticPrior< float >, and stir::FilterRootPrior< DataT >.
Referenced by stir::GeneralisedPriorTests::test_Hessian_against_numerical(), and stir::GeneralisedPriorTests::test_Hessian_convexity().
|
overrideprotectedvirtual |
sets value for penalisation factor
Has to be called by set_defaults in the leaf-class
Reimplemented from stir::ParsingObject.
Reimplemented in stir::QuadraticPrior< float >.
Referenced by stir::FilterRootPrior< DataT >::compute_gradient().
|
overrideprotectedvirtual |
sets key for penalisation factor
Has to be called by initialise_keymap in the leaf-class
Reimplemented from stir::ParsingObject.
Reimplemented in stir::QuadraticPrior< float >.
Referenced by stir::FilterRootPrior< DataT >::compute_gradient().