STIR
6.2.0
|
A helper class to read data from a ROOT file Generated by GATE simulation toolkit. More...
#include "stir/IO/InputStreamFromROOTFile.h"
Public Types | |
typedef std::vector< long long int >::size_type | SavedPosition |
Public Member Functions | |
InputStreamFromROOTFile () | |
Default constructor. | |
virtual Succeeded | get_next_record (CListRecordROOT &record)=0 |
Succeeded | reset () |
Go to the first event. | |
virtual Succeeded | set_up (const std::string &header_path) |
Must be called before calling for the first event. | |
SavedPosition | save_get_position () |
Save current position in a vector. | |
Succeeded | set_get_position (const SavedPosition &) |
Set current position. | |
std::vector< unsigned long int > | get_saved_get_positions () const |
Get the vector with the saved positions. | |
void | set_saved_get_positions (const std::vector< unsigned long int > &) |
Set a vector with saved positions. | |
unsigned long int | get_total_number_of_events () const |
Returns the total number of events. | |
std::string | get_ROOT_filename () const |
virtual int | get_num_rings () const =0 |
Get the number of rings as calculated from the number of repeaters. | |
virtual int | get_num_dets_per_ring () const =0 |
Get the number of dets per ring as calculated from the number of repeaters. | |
virtual int | get_num_axial_blocks_per_bucket_v () const =0 |
Get the number of axial modules. | |
virtual int | get_num_transaxial_blocks_per_bucket_v () const =0 |
Get the number of transaxial modules. | |
int | get_num_axial_crystals_per_block_v () const |
Get the axial number of crystals per module. | |
int | get_num_transaxial_crystals_per_block_v () const |
Get the transaxial number of crystals per module. | |
virtual int | get_num_axial_crystals_per_singles_unit () const =0 |
Get the number of axial crystals per singles unit. | |
virtual int | get_num_trans_crystals_per_singles_unit () const =0 |
Get the number of transaxial crystals per singles unit. | |
float | get_low_energy_thres () const |
Lower energy threshold. | |
float | get_up_energy_thres () const |
Upper energy threshold. | |
void | set_singles_readout_depth (int) |
Set singles_readout_depth. | |
void | set_input_filename (const std::string &) |
void | set_chain_name (const std::string &) |
void | set_exclude_true_events (bool) |
void | set_exclude_scattered_events (bool) |
void | set_exclude_unscattered_events (bool) |
void | set_exclude_random_events (bool) |
void | set_low_energy_window (float) |
void | set_upper_energy_window (float) |
void | set_optional_ROOT_fields (bool) |
Set the read_optional_root_fields flag. | |
void | set_crystal_repeater_x (int) |
void | set_crystal_repeater_y (int) |
void | set_crystal_repeater_z (int) |
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 |
Set defaults before parsing. | |
void | initialise_keymap () override |
Initialise all keywords. | |
bool | post_processing () override |
This will be called at the end of the parsing. More... | |
float | get_energy1_in_keV () const |
OpenGATE output ROOT energy information is given in MeV, these methods convert to keV. | |
float | get_energy2_in_keV () const |
bool | check_brentry_randoms_scatter_energy_conditions (long long int brentry) |
Checks brentry satisfies the randoms, scatter and energy conditions. | |
void | GetEntryCheck (const int ret) |
Checks the return of branch->GetEntry(brentry) and errors if return <= 0. | |
Protected Member Functions inherited from stir::ParsingObject | |
virtual void | set_key_values () |
This will be called before parsing or parameter_info is called. More... | |
Protected Attributes | |
std::string | filename |
Input data file name. | |
unsigned long int | starting_stream_position |
The starting position. | |
unsigned long int | nentries |
The total number of entries. | |
unsigned long int | current_position |
Current get position. | |
std::vector< unsigned long int > | saved_get_positions |
A vector with saved position indices. | |
std::string | chain_name |
The name of the ROOT chain to be read. | |
bool | read_optional_root_fields |
This variable can be used to setBranchAddress to ROOT fields that currently are not used by STIR. Because they might be related to medical image reconstruction or because STIR does not support a relevant use. Of course, just activating this flag does not mean that something meaningfull will happen. Please edit get_next_record() function accordingly. | |
bool | exclude_nonrandom |
Skip True events (eventID1 == eventID2). Default is false. | |
bool | exclude_scattered |
Skip scattered events (comptonphantom1 > 0 && comptonphantom2 > 0). Default is false. | |
bool | exclude_unscattered |
Skip unscattered events (comptonphantom1 == 0 && comptonphantom2 == 0)). Default is false. | |
bool | exclude_randoms |
Skip random events (eventID1 != eventID2). Default is false. | |
bool | check_energy_window_information |
Check energy window information (low_energy_window < energy < up_energy_window). Default is true. | |
float | low_energy_window |
Lower energy threshold. Default is 1000 (keV) | |
float | up_energy_window |
Upper energy threshold. Default is 0 (keV) | |
int | singles_readout_depth |
For the singles_readout_depth from GATE's online documentation: (here )
| |
double | least_significant_clock_bit |
repeaters | |
int | crystal_repeater_x |
int | crystal_repeater_y |
int | crystal_repeater_z |
ROOT Variables, i.e. to hold data from each entry. | |
TChain * | stream_ptr |
std::int32_t | eventID1 |
std::int32_t | eventID2 |
std::int32_t | runID |
std::int32_t | sourceID1 |
std::int32_t | sourceID2 |
double | time1 |
double | time2 |
float | energy1 |
float | energy2 |
float | rotation_angle |
float | sinogramS |
float | sinogramTheta |
float | axialPos |
int32_t | comptonphantom1 |
int32_t | comptonphantom2 |
float | globalPosX1 |
float | globalPosX2 |
float | globalPosY1 |
float | globalPosY2 |
float | globalPosZ1 |
float | globalPosZ2 |
float | sourcePosX1 |
float | sourcePosX2 |
float | sourcePosY1 |
float | sourcePosY2 |
float | sourcePosZ1 |
float | sourcePosZ2 |
ROOT Branch address variables. | |
TBranch * | br_time1 = nullptr |
TBranch * | br_time2 = nullptr |
TBranch * | br_eventID1 = nullptr |
TBranch * | br_eventID2 = nullptr |
TBranch * | br_energy1 = nullptr |
TBranch * | br_energy2 = nullptr |
TBranch * | br_comptonPhantom1 = nullptr |
TBranch * | br_comptonPhantom2 = nullptr |
TBranch * | br_axialPos = nullptr |
TBranch * | br_globalPosX1 = nullptr |
TBranch * | br_globalPosX2 = nullptr |
TBranch * | br_globalPosY1 = nullptr |
TBranch * | br_globalPosY2 = nullptr |
TBranch * | br_globalPosZ1 = nullptr |
TBranch * | br_globalPosZ2 = nullptr |
TBranch * | br_rotation_angle = nullptr |
TBranch * | br_runID = nullptr |
TBranch * | br_sinogramS = nullptr |
TBranch * | br_sinogramTheta = nullptr |
TBranch * | br_sourceID1 = nullptr |
TBranch * | br_sourceID2 = nullptr |
TBranch * | br_sourcePosX1 = nullptr |
TBranch * | br_sourcePosX2 = nullptr |
TBranch * | br_sourcePosY1 = nullptr |
TBranch * | br_sourcePosY2 = nullptr |
TBranch * | br_sourcePosZ1 = nullptr |
TBranch * | br_sourcePosZ2 = nullptr |
Protected Attributes inherited from stir::ParsingObject | |
KeyParser | parser |
number of "fake" crystals per block, inserted by the scanner | |
int | num_virtual_axial_crystals_per_block |
int | num_virtual_transaxial_crystals_per_block |
int | get_num_virtual_axial_crystals_per_block () const |
int | get_num_virtual_transaxial_crystals_per_block () const |
void | set_num_virtual_axial_crystals_per_block (int) |
void | set_num_virtual_transaxial_crystals_per_block (int) |
Additional Inherited Members | |
Static Public Member Functions inherited from stir::RegisteredObject< InputStreamFromROOTFile > | |
static InputStreamFromROOTFile * | 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 InputStreamFromROOTFile * | 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< InputStreamFromROOTFile > | |
typedef InputStreamFromROOTFile *(* | 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< InputStreamFromROOTFile > | |
static RegistryType & | registry () |
Static function returning the registry. More... | |
A helper class to read data from a ROOT file Generated by GATE simulation toolkit.
This is an abstract base class for inputs from ROOT files. Primarily, information not related to the scanner's geometry is held here. InputStreamFromROOTFileForCylindricalPET is for cylindrical PET scanners (here ) and InputStreamFromROOTFileForECAT is for ECAT PET scanners (here ).
The follow bit of the header file refers to members stored here. For appropriate values please check your simulation macro file. For the singles_readout_depth from GATE's online documentation: (here )
the readout depth depends upon how the electronic readout functions.
name of data file := ${INPUT_ROOT_FILE} name of input TChain := Coincidences Singles readout depth := 1 exclude scattered events := ${EXCLUDE_SCATTERED} exclude random events := ${EXCLUDE_RANDOM} low energy window (keV) := 0 upper energy window (keV):= 10000
|
pure virtual |
Returns the next record in the ROOT file. The code is adapted from Sadek A. Nehmeh and CR Schmidtlein, downloaded from here
Implemented in stir::InputStreamFromROOTFileForCylindricalPET, and stir::InputStreamFromROOTFileForECATPET.
|
inline |
Some scanners (including many Siemens scanners) insert virtual crystals in the sinogram data. The other members of the class return the size of the "virtual" block. With these functions you can find its true size (or set it).
|
overrideprotectedvirtual |
This will be called at the end of the parsing.
Reimplemented from stir::ParsingObject.
Reimplemented in stir::InputStreamFromROOTFileForCylindricalPET, and stir::InputStreamFromROOTFileForECATPET.
Referenced by stir::InputStreamFromROOTFileForCylindricalPET::post_processing().