STIR 6.5.0
stir::CListModeDataPETSIRD Class Reference

Reader for PETSIRD listmode data supporting variable geometry. More...

#include "stir/listmode/CListModeDataPETSIRD.h"

Public Member Functions

 CListModeDataPETSIRD (const std::string &listmode_filename, bool use_hdf5)
 Construct reader.
virtual shared_ptr< CListRecord > get_empty_record_sptr () const override
 Get a pointer to an empty record.
Succeeded get_next_record (CListRecord &record_of_general_type) const override
 Gets the next record in the listmode sequence.
SavedPosition save_get_position () override
 Save the current reading position.
void reopen_and_prime ()
 Reopens the underlying reader and primes it at the first event block.
Succeeded seek_to_event_block_index (std::size_t target_event_block_index) const
Succeeded set_get_position (const SavedPosition &pos) override
 Set the position for reading to a previously saved point.
virtual bool has_delayeds () const override
 Return if the file stores delayed events as well (as opposed to prompts).
Succeeded reset () override
 Call this function if you want to re-start reading at the beginning.
const std::vector< float > & get_singles_per_bucket () const
double get_singles_time_start () const
double get_singles_time_stop () const

Protected Member Functions

virtual Succeeded open_lm_file () const override

Protected Attributes

shared_ptr< petsird::PETSIRDReaderBase > current_lm_data_ptr

Detailed Description

Reader for PETSIRD listmode data supporting variable geometry.

Author
Nikos Efthimiou
Overview
  • Supports HDF5 and binary PETSIRD formats.
  • Infers scanner geometry:
    • Cylindrical → creates cylindrical scanner.
    • Block-based → creates block-based scanner.
    • Otherwise → creates generic scanner using crystal positions.
  • Builds a DetectorCoordinateMap when needed and stores to disk.

Infering the scanner geometry makes a lot of assumptions about what PET is. In particular, it assumes:

  • A PET scanner is made of rings of detectors
  • The largest axis is the axial one.
  • So far we support only a single layer. This is partly hard-coded for simplicity. (look in the code for relevant TODOs and comments.)
  • Some of the hardcoded assumptions are in CListRecordPETSIRD as well.
Note
Exact PETSIRD format specification is defined in the PETSIRD project documentation.
Initially, I wanted to:
  • Is close to a cylindrical geometry ?
    • then yes use a cylindrical scanner that is simpler.
    • Else, is it made of blocks arranged on a cylinder.

However, now I do the following:

  • Is close to cylindrical geometry?
    • yes use cylindrical scanner
    • Check if blocks-on-cylinder configuration, are a good match.
      • yes use blocks-on-cylinder scanner
      • else use generic scanner and export the map to the disk.

If listmode reconstruction is done, the map is regenerated on-the-fly.

Constructor & Destructor Documentation

◆ CListModeDataPETSIRD()

stir::CListModeDataPETSIRD::CListModeDataPETSIRD ( const std::string & listmode_filename,
bool use_hdf5 )

Construct reader.

Parameters
listmode_filenamePath to PETSIRD listmode file.
use_hdf5If true, use HDF5 reader; otherwise use binary reader.

References CListModeDataPETSIRD(), stir::ProjDataInfo::construct_proj_data_info(), stir::error(), and reset().

Referenced by CListModeDataPETSIRD().

Member Function Documentation

◆ get_empty_record_sptr()

shared_ptr< CListRecord > stir::CListModeDataPETSIRD::get_empty_record_sptr ( ) const
overridevirtual

Get a pointer to an empty record.

This is mainly/only useful to get a record of the correct type, that can then be passed to get_next_record().

Implements stir::CListModeData.

References stir::DataWithProjDataInfo::get_proj_data_info_sptr().

◆ get_next_record()

Succeeded stir::CListModeDataPETSIRD::get_next_record ( CListRecord & event) const
overridevirtual

Gets the next record in the listmode sequence.

Implements stir::CListModeData.

References get_next_record().

Referenced by get_next_record().

◆ save_get_position()

ListModeData::SavedPosition stir::CListModeDataPETSIRD::save_get_position ( )
overridevirtual

Save the current reading position.

Note that the return value is not related to the number of events already read. In particular, you cannot do any arithmetic on it to skip a few events. This is different from e.g. std::streampos.

Warning
There is a maximum number of times this function can be called. This is determined by the SavedPosition type. Once you save more positions, the first positions will be overwritten. There is currently no way of finding out after how many times this will happen (but it's a large number...).
These saved positions are only valid for the lifetime of the ListModeData object.
A derived class might disable this facility. It will/should then always return Succeeded::no when calling set_get_position().

Implements stir::ListModeData.

◆ reopen_and_prime()

void stir::CListModeDataPETSIRD::reopen_and_prime ( )

Reopens the underlying reader and primes it at the first event block.

Calls error() (which throws) if the file cannot be opened, the header cannot be read, or no event time blocks are found in the file.

References stir::error().

Referenced by reset(), and set_get_position().

◆ set_get_position()

Succeeded stir::CListModeDataPETSIRD::set_get_position ( const SavedPosition & pos)
overridevirtual

Set the position for reading to a previously saved point.

Implements stir::ListModeData.

References reopen_and_prime().

◆ has_delayeds()

virtual bool stir::CListModeDataPETSIRD::has_delayeds ( ) const
inlineoverridevirtual

Return if the file stores delayed events as well (as opposed to prompts).

Implements stir::CListModeData.

◆ reset()

Succeeded stir::CListModeDataPETSIRD::reset ( )
overridevirtual

Call this function if you want to re-start reading at the beginning.

Implements stir::ListModeData.

References reopen_and_prime().

Referenced by CListModeDataPETSIRD().


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