STIR  6.2.0
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members

A class in the GeneralisedPrior hierarchy. This implements 'generalised' priors a la the Median Root Prior (which was invented by Sakari Alenius). More...

#include "stir/recon_buildblock/FilterRootPrior.h"

Inheritance diagram for stir::FilterRootPrior< DataT >:
Inheritance graph
[legend]

Public Member Functions

 FilterRootPrior ()
 Default constructor (no filter)
 
 FilterRootPrior (shared_ptr< DataProcessor< DataT >> const &, const float penalization_factor)
 Constructs it explicitly.
 
bool is_convex () const override
 Indicates if the prior is a smooth convex function. More...
 
double compute_value (const DataT &current_estimate) override
 compute the value of the function More...
 
void compute_gradient (DataT &prior_gradient, const DataT &current_estimate) override
 compute gradient by applying the filter
 
Succeeded set_up (shared_ptr< const DataT > const &target_sptr) override
 Has to be called before using this object.
 
- Public Member Functions inherited from stir::RegisteredParsingObject< FilterRootPrior< DataT >, GeneralisedPrior< DataT >, GeneralisedPrior< DataT > >
std::string get_registered_name () const override
 Returns Derived::registered_name.
 
std::string parameter_info () override
 Returns a string with all parameters and their values, in a form suitable for parsing again.
 
- Public Member Functions inherited from stir::GeneralisedPrior< DataT >
virtual void compute_Hessian (DataT &prior_Hessian_for_single_densel, const BasicCoordinate< 3, int > &coords, const DataT &current_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 &current_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.
 
- Public Member Functions inherited from stir::ParsingObject
 ParsingObject (const ParsingObject &)
 
ParsingObjectoperator= (const ParsingObject &)
 
void ask_parameters ()
 
bool parse (std::istream &f)
 
bool parse (const char *const filename)
 

Static Public Attributes

static const char *const registered_name = "FilterRootPrior"
 Name which will be used when parsing a GeneralisedPrior object.
 

Protected Member Functions

void check (DataT const &current_image_estimate) const override
 Check that the prior is ready to be used.
 
- Protected Member Functions inherited from stir::GeneralisedPrior< DataT >
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 &current_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...
 

Additional Inherited Members

- Static Public Member Functions inherited from stir::RegisteredParsingObject< FilterRootPrior< DataT >, GeneralisedPrior< DataT >, GeneralisedPrior< DataT > >
static GeneralisedPrior< DataT > * read_from_stream (std::istream *)
 Construct a new object (of type Derived) by parsing the istream. More...
 
- Static Public Member Functions inherited from stir::RegisteredObject< GeneralisedPrior< DataT > >
static GeneralisedPrior< DataT > * read_registered_object (std::istream *in, const std::string &registered_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_lessRegistryType
 The type of the registry.
 
- Static Protected Member Functions inherited from stir::RegisteredObject< GeneralisedPrior< DataT > >
static RegistryTyperegistry ()
 Static function returning the registry. More...
 
- Protected Attributes inherited from stir::GeneralisedPrior< DataT >
float penalisation_factor
 
bool _already_set_up
 
- Protected Attributes inherited from stir::ParsingObject
KeyParser parser
 

Detailed Description

template<typename DataT>
class stir::FilterRootPrior< DataT >

A class in the GeneralisedPrior hierarchy. This implements 'generalised' priors a la the Median Root Prior (which was invented by Sakari Alenius).

This class takes an DataProcessor object (i.e. a filter), and computes the prior 'gradient' as

\[ G_v = \beta ( {\lambda_v \over F_v} - 1) \]

where $ \lambda$ is the data where to compute the gradient, and $F$ is the data obtained by filtering $\lambda$.

However, we need to avoid division by 0, as it might cause a NaN or an 'infinity'. So, we replace the quotient above by
if $|\lambda_v| < M*|F_v| $ then ${\lambda_v \over F_v}$ else $M*\rm{sign}(F_v)*\rm{sign}(lambda_v)$,
where $M$ is an arbitrary threshold on the quotient (fixed to 1000 when I wrote this documentation, but check FilterRootPrior.cxx if you want to be sure).

Note that for nearly all filters, this is not a real prior, as this 'gradient' is not the gradient of a function. This can be checked by computing the 'Hessian' (i.e. the partial derivatives of the components of the gradient). For most (interesting) filters, the Hessian will no be symmetric.

The Median Root Prior is obtained by using a MedianImageFilter3D as DataProcessor.

Member Function Documentation

◆ is_convex()

template<typename DataT >
bool stir::FilterRootPrior< DataT >::is_convex ( ) const
overridevirtual

Indicates if the prior is a smooth convex function.

If true, the prior is expected to have 0th, 1st and 2nd order behaviour implemented.

Implements stir::GeneralisedPrior< DataT >.

◆ compute_value()

template<typename DataT >
double stir::FilterRootPrior< DataT >::compute_value ( const DataT &  current_estimate)
overridevirtual

compute the value of the function

Warning
Generally there is no function associated to this prior, so we just return 0 and write a warning the first time it's called.

Implements stir::GeneralisedPrior< DataT >.

References stir::warning().


The documentation for this class was generated from the following files: