STIR 6.4.0
stir::DataProcessor< DataT > Class Template Referenceabstract

Base class that defines an interface for classes that do data processing. More...

#include "stir/DataProcessor.h"

Inheritance diagram for stir::DataProcessor< DataT >:

Public Member Functions

Succeeded set_up (const DataT &data)
 Initialises any internal data (if necessary) using data as a template for sizes, sampling distances etc.
 
virtual void reset ()
 Makes sure we will ignore any previous call to set-up()
 
Succeeded apply (DataT &data)
 Calls set_up() (if not already done before) and process data in-place.
 
Succeeded apply (DataT &out_data, const DataT &in_data)
 Calls set_up() (if not already done before) and process in_data, putting the result in out_data.
 
- Public Member Functions inherited from stir::RegisteredObjectBase
virtual std::string get_registered_name () const =0
 Returns the name of the type of the object.
 
- Public Member Functions inherited from stir::ParsingObject
 ParsingObject (const ParsingObject &)
 
ParsingObjectoperator= (const ParsingObject &)
 
bool parse (std::istream &f)
 
bool parse (const char *const filename)
 
void ask_parameters ()
 
virtual std::string parameter_info ()
 
- Public Member Functions inherited from stir::TimedObject
void reset_timers ()
 reset all timers kept by this object
 
void stop_timers () const
 stop all timers kept by this object
 
void start_timers (bool do_reset=false) const
 start all timers kept by this object
 
double get_CPU_timer_value () const
 get current value of the CPU timer (since first use or last reset)
 
double get_wall_clock_timer_value () const
 get current value of the wall-clock timer (since first use or last reset)
 

parsing functions

parse() returns false if there is some error, true otherwise.

These call reset() first, and then ParsingObject::parse

bool parse (std::istream &f)
 
bool parse (const char *const filename)
 
virtual Succeeded virtual_set_up (const DataT &)=0
 Will be called to build any internal parameters.
 
virtual void virtual_apply (DataT &data, const DataT &in_data) const =0
 Performs actual operation (virtual_set_up is called before this function)
 
virtual void virtual_apply (DataT &data) const =0
 Performs actual operation (in-place)
 

Additional Inherited Members

- Static Public Member Functions inherited from stir::RegisteredObject< DataProcessor< DataT > >
static DataProcessor< 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.
 
static DataProcessor< DataT > * ask_type_and_parameters ()
 ask the user for the type, and then calls read_registered_object(0, type)
 
static void list_registered_names (std::ostream &stream)
 List all possible registered names to the stream.
 
- Protected Types inherited from stir::RegisteredObject< DataProcessor< DataT > >
typedef DataProcessor< 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.
 
virtual void set_defaults ()
 Set defaults before parsing.
 
virtual void initialise_keymap ()
 Initialise all keywords.
 
virtual bool post_processing ()
 This will be called at the end of the parsing.
 
virtual void set_key_values ()
 This will be called before parsing or parameter_info is called.
 
- Static Protected Member Functions inherited from stir::RegisteredObject< DataProcessor< DataT > >
static RegistryTyperegistry ()
 Static function returning the registry.
 
KeyParser parser
 

Detailed Description

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

Base class that defines an interface for classes that do data processing.

Classes at the end of the DataProcessor hierarchy have to be able to parse parameter files etc. Moreover, it has to be possible to construct an DataProcessor object while parsing, where the actual type of derived class is determined at run-time. Luckily, this is exactly the situation that RegisteredObject and RegisteredParsingObject are supposed to handle. So, all this functionality is achieved by deriving DataProcessor from the appropriate RegisteredObject class, and deriving the 'leaves' from RegisteredParsingObject.

Member Function Documentation

◆ set_up()

template<typename DataT>
Succeeded stir::DataProcessor< DataT >::set_up ( const DataT & data)
inline

Initialises any internal data (if necessary) using data as a template for sizes, sampling distances etc.

Warning
DataProcessor does NOT check if the input data for apply() actually corresponds to the template. So, most derived classes will not call set_up again if the input data does not correspond to the template, potentially resulting in erroneous output.

The reason that DataProcessor does not perform this check is that it does not know what the requirements are to call the 2 densities 'compatible'.

References set_up(), stir::TimedObject::start_timers(), stir::TimedObject::stop_timers(), and virtual_set_up().

Referenced by apply(), apply(), stir::ReconstructionTests< TargetT >::construct_input_data(), and set_up().

◆ reset()

template<typename DataT>
void stir::DataProcessor< DataT >::reset ( )
inlinevirtual

Makes sure we will ignore any previous call to set-up()

If you change any internal variables of the data-processor, or are calling it on data if different size or so, you first have to call reset() such that the data-processor will call set_up() when necessary.

A derived class could overload reset() to re-initialise any internal variables, but this is not required.

References reset().

Referenced by reset().

◆ apply() [1/2]

template<typename DataT>
Succeeded stir::DataProcessor< DataT >::apply ( DataT & data)
inline

Calls set_up() (if not already done before) and process data in-place.

If set_up() returns Succeeded::false, a warning message is written, and the data is not changed.

References apply(), and set_up().

Referenced by apply(), apply(), stir::ReconstructionTests< TargetT >::construct_input_data(), and stir::find_fwhm_in_imageTests::run_tests().

◆ apply() [2/2]

template<typename DataT>
Succeeded stir::DataProcessor< DataT >::apply ( DataT & out_data,
const DataT & in_data )
inline

Calls set_up() (if not already done before) and process in_data, putting the result in out_data.

If set_up() returns Succeeded::false, a warning message is written, and the out_data is not changed.

Warning
Most derived classes will assume that out_data is already initialised appropriately (e.g. has correct dimensions, voxel sizes etc.).

References apply(), set_up(), and stir::warning().

◆ virtual_set_up()

template<typename DataT>
virtual Succeeded stir::DataProcessor< DataT >::virtual_set_up ( const DataT & )
protectedpure virtual

Will be called to build any internal parameters.

Implemented in stir::HUToMuImageProcessor< TargetT >.

Referenced by set_up().

◆ virtual_apply() [1/2]

template<typename DataT>
virtual void stir::DataProcessor< DataT >::virtual_apply ( DataT & data,
const DataT & in_data ) const
protectedpure virtual

Performs actual operation (virtual_set_up is called before this function)

Implemented in stir::HUToMuImageProcessor< TargetT >.

◆ virtual_apply() [2/2]

template<typename DataT>
virtual void stir::DataProcessor< DataT >::virtual_apply ( DataT & data) const
protectedpure virtual

Performs actual operation (in-place)

Implemented in stir::HUToMuImageProcessor< TargetT >.


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