STIR  6.2.0
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
stir::ProjMatrixByBinFromFile Class Reference

Reads/writes a projection matrix from/to file. More...

#include "stir/recon_buildblock/ProjMatrixByBinFromFile.h"

Inheritance diagram for stir::ProjMatrixByBinFromFile:
Inheritance graph
[legend]

Public Member Functions

 ProjMatrixByBinFromFile ()
 Default constructor (calls set_defaults())
 
void set_up (const shared_ptr< const ProjDataInfo > &proj_data_info_ptr, const shared_ptr< const DiscretisedDensity< 3, float >> &density_info_ptr) override
 Checks all necessary geometric info.
 
ProjMatrixByBinFromFileclone () const override
 
- Public Member Functions inherited from stir::RegisteredParsingObject< ProjMatrixByBinFromFile, ProjMatrixByBin, ProjMatrixByBin >
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::ProjMatrixByBin
const DataSymmetriesForBinsget_symmetries_ptr () const
 get a pointer to an object encoding all symmetries that are used by this ProjMatrixByBin
 
const shared_ptr< DataSymmetriesForBinsget_symmetries_sptr () const
 get a shared_ptr to an object encoding all symmetries that are used by this ProjMatrixByBin
 
void get_proj_matrix_elems_for_one_bin (ProjMatrixElemsForOneBin &, const Bin &) const
 The main method for getting a row of the matrix. More...
 
void enable_cache (const bool v=true)
 
void store_only_basic_bins_in_cache (const bool v=true)
 
bool is_cache_enabled () const
 
bool does_cache_store_only_basic_bins () const
 
void clear_cache () const
 Remove all elements from the cache.
 
- 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)
 
- 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 More...
 
void start_timers (bool do_reset=false) const
 start all timers kept by this object More...
 
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)
 

Static Public Member Functions

static Succeeded write_to_file (const std::string &output_filename_prefix, const ProjMatrixByBin &proj_matrix, const shared_ptr< const ProjDataInfo > &proj_data_info_sptr, const DiscretisedDensity< 3, float > &template_density)
 Writes a projection matrix to file in a format such that this class can read it back. More...
 
- Static Public Member Functions inherited from stir::RegisteredParsingObject< ProjMatrixByBinFromFile, ProjMatrixByBin, ProjMatrixByBin >
static ProjMatrixByBinread_from_stream (std::istream *)
 Construct a new object (of type Derived) by parsing the istream. More...
 
- Static Public Member Functions inherited from stir::RegisteredObject< ProjMatrixByBin >
static ProjMatrixByBinread_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 ProjMatrixByBinask_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...
 

Static Public Attributes

static const char *const registered_name = "From File"
 Name which will be used when parsing a ProjMatrixByBin object.
 

Additional Inherited Members

- Protected Types inherited from stir::RegisteredObject< ProjMatrixByBin >
typedef ProjMatrixByBin *(* 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.
 
- Protected Member Functions inherited from stir::ProjMatrixByBin
 ProjMatrixByBin ()
 default ctor (calls set_defaults()) More...
 
Succeeded get_cached_proj_matrix_elems_for_one_bin (ProjMatrixElemsForOneBin &) const
 The method that tries to get data from the cache. More...
 
void cache_proj_matrix_elems_for_one_bin (const ProjMatrixElemsForOneBin &) const
 The method to store data in the cache.
 
- Protected Member Functions inherited from stir::ParsingObject
virtual void set_key_values ()
 This will be called before parsing or parameter_info is called. More...
 
- Static Protected Member Functions inherited from stir::RegisteredObject< ProjMatrixByBin >
static RegistryTyperegistry ()
 Static function returning the registry. More...
 
- Protected Attributes inherited from stir::ProjMatrixByBin
shared_ptr< DataSymmetriesForBinssymmetries_sptr
 
bool cache_disabled
 
bool cache_stores_only_basic_bins
 
bool tof_enabled
 If activated TOF reconstruction will be performed.
 
shared_ptr< const VoxelsOnCartesianGrid< float > > image_info_sptr
 We need a local copy of the discretised density in order to find the cartesian coordinates of each voxel.
 
shared_ptr< const ProjDataInfoproj_data_info_sptr
 We need a local copy of the proj_data_info to get the integration boundaries and RayTracing.
 
- Protected Attributes inherited from stir::ParsingObject
KeyParser parser
 

Detailed Description

Reads/writes a projection matrix from/to file.

The only supported file format consists of an Interfile-type header and a binary file which stores the 'basic' elements in a sparse form, i.e. only the elements that cannot by constructed via symmetries.

Todo:
this class currently only works with VoxelsOnCartesianGrid. To fix this, we would need a DiscretisedDensityInfo class, and be able to have constructed the appropriate symmetries object by parsing the .par file
Example .par file
  ProjMatrixByBinFromFile Parameters:=
    Version := 1.0
    symmetries type := PET_CartesianGrid
      PET_CartesianGrid symmetries parameters:=
        do_symmetry_90degrees_min_phi:= <bool>
        do_symmetry_180degrees_min_phi:=<bool>
        do_symmetry_swap_segment:= <bool>
        do_symmetry_swap_s:= <bool>
        do_symmetry_shift_z:= <bool>
      End PET_CartesianGrid symmetries parameters:=
    ; example projection data of the same dimensions as used when constructing the matrix
    template proj data filename:= <filename>
    ; example image of the same dimensions as used when constructing the matrix
    template density filename:= <filename>
    ; binary data with projection matrix elements
    data_filename:=<filename>
   End ProjMatrixByBinFromFile Parameters:=

Member Function Documentation

◆ write_to_file()

Succeeded stir::ProjMatrixByBinFromFile::write_to_file ( const std::string &  output_filename_prefix,
const ProjMatrixByBin proj_matrix,
const shared_ptr< const ProjDataInfo > &  proj_data_info_sptr,
const DiscretisedDensity< 3, float > &  template_density 
)
static

Writes a projection matrix to file in a format such that this class can read it back.

Currently this will write an interfile-type header, a file with the binary data, a template image and template sinogram. You will need all 4 to be able to read the matrix back in.

References stir::add_extension(), stir::replace_extension(), stir::warning(), and stir::write_to_file().


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