CASToR
2.0
Tomographic Reconstruction (PET/SPECT/CT)
|
Inherit from vDataFile. Class that manages the reading of a SPECT input file (header + data). More...
#include <iDataFileSPECT.hh>
Public Member Functions | |
iDataFileSPECT () | |
iDataFileSPECT constructor. Initialize the member variables to their default values. More... | |
~iDataFileSPECT () | |
iDataFileSPECT destructor. More... | |
int | ReadSpecificInfoInHeader (bool a_affectQuantificationFlag) |
Read through the header file and recover specific SPECT information. More... | |
int | WriteHeader () |
Generate a header file according to the data output information. More... | |
int | ComputeSizeEvent () |
Computation of the size of each event according to the mandatory/optional correction fields. More... | |
int | PrepareDataFile () |
Store different kind of information inside arrays (data relative to specific correction as well as basic raw data for the case data is loaded in RAM) Use the flag provided by the user to determine how the data has to be sorted (preloaded or read on the fly) More... | |
int | WriteEvent (vEvent *ap_Event, int a_th=0) |
Write event according to the chosen type of data. More... | |
vEvent * | GetEventSpecific (char *ap_buffer, int a_th) |
Read an event from the position pointed by 'ap_buffer', parse the generic or modality-specific information, and store them in the (multithreaded) 'm2p_BufferEvent' object. More... | |
int | InitAngles (FLTNB *ap_angles) |
allocate memory for the mp_angles variable using m_nbProjections and initialize the projection angles with the provided list of values More... | |
int | InitCorToDetectorDistance (FLTNB *ap_CORtoDetectorDistance) |
allocate memory for the ap_CORtoDetectorDistance variable using m_nbProjections, and initialize the projection angles with the provided list of values More... | |
void | DescribeSpecific () |
Implementation of the pure virtual eponym function that simply prints info about the datafile. More... | |
int | PROJ_InitFile () |
Initialize the fstream objets for output writing as well as some other variables specific to the Projection script (Event-based correction flags, Estimated size of data file) More... | |
int | PROJ_GetScannerSpecificParameters () |
Get SPECT specific parameters for projections from the scanner object, through the scannerManager. More... | |
uint16_t | GetNbHeads () |
uint16_t | GetNbProjections () |
FLTNB * | GetAngles () |
FLTNB * | GetCORtoDetectorDistance () |
uint16_t | GetNbBins (int axis) |
void | SetEventKindFlagOn () |
set to true the flag indicating the presence of the kind of a list-mode event in the datafile More... | |
void | SetIsotope (string a_value) |
initialize the isotope string value More... | |
string | GetIsotope () |
void | SetNbBins (uint16_t a_binTrs, uint16_t a_binAxl) |
initialize the bin values More... | |
void | SetNbProjections (uint16_t a_nbProjections) |
initialize the number of projections More... | |
int | GetHeadRotDirection () |
Simply return m_headRotDirection. More... | |
void | SetHeadRotDirection (int a_direction) |
initialize the rotation direction of the gamma camera(s) More... | |
bool | GetEventKindFlag () |
Simply return m_eventKindFlag. More... | |
bool | GetScatCorrectionFlag () |
Simply return m_scatCorrectionFlag. More... | |
bool | GetNormCorrectionFlag () |
Simply return m_normCorrectionFlag. More... | |
Public Member Functions inherited from vDataFile | |
vDataFile () | |
vDataFile constructor. More... | |
virtual | ~vDataFile () |
vDataFile destructor. More... | |
int | ReadInfoInHeader (bool a_affectQuantificationFlag=true) |
Read and check general information from the header datafile Call the ReadSpecificInformationInHeader() function implemented in child classes. More... | |
int | SetParametersFrom (vDataFile *ap_DataFile) |
Initialize all parameters from the provided datafile. More... | |
int | CheckParameters () |
Check the initialization of member variables Call the CheckSpecificParameters() function implemented in child classes. More... | |
int | InitializeMappedFile () |
Check the datafile existency, map it to memory and get the raw char* pointer. . More... | |
int | OpenFileForWriting (string a_suffix="") |
Open a binary file stream for writing, with eventually the suffix appended to the file name. More... | |
int | CloseFile () |
Close as many binary file stream for writing. More... | |
vEvent * | GetEvent (int64_t a_eventIndex, int a_th=0) |
void | GetEventIndexStartAndStop (int64_t *ap_indexStart, int64_t *ap_indexStop, int a_subsetNum=0, int a_NbSubsets=1) |
Compute the index start and stop of the events loop with respect to the current subset and MPI size and rank. More... | |
int | CheckConsistencyWithAnotherBedDataFile (vDataFile *ap_DataFile) |
Check consistency between 'this' and the provided datafile as two bed positions. More... | |
void | Describe () |
A function used to describe the generic parts of the datafile. More... | |
int | PROJ_WriteData () |
Write/Merge chunk of data in a general data file. More... | |
int | PROJ_DeleteTmpDataFile () |
Delete temporary datafile used for multithreaded output writing if needed. More... | |
vEvent * | PROJ_GenerateEvent (int idx_elt1, int idx_elt2, int a_th) |
Generate a standard event and set up its ID Used by the projection, list-mode sensitivity generation, and datafile converter scripts. More... | |
int | GetBedIndex () |
int | GetDataMode () |
string | GetDataModeToString () |
int | GetDataType () |
string | GetDataTypeToString () |
int | GetDataSpec () |
string | GetDataSpecToString () |
int64_t | GetSize () |
int64_t | GetEventSize () |
string | GetHeaderDataFileName () |
string | GetDataFileName () |
int64_t | GetStartTime () |
int64_t | GetDuration () |
FLTNB | GetCalibrationFactor () |
FLTNB * | GetPOIResolution () |
bool * | GetPOIDirectionFlag () |
bool | GetPOIInfoFlag () |
bool | GetIgnorePOIFlag () |
virtual int | GetMaxRingDiff () |
Return an error by default. This function is surcharged by the PET (and CT) scanner daughter class. More... | |
void | SetDataMode (int a_dataMode) |
set the data mode More... | |
void | SetDataType (int a_dataType) |
set the data type More... | |
void | SetBedIndex (int a_bedIndex) |
set the bed index corresponding to this data file More... | |
bool | GetBedPositionFlag () |
FLTNB | GetRelativeBedPosition () |
void | SetVerbose (int a_verboseLevel) |
set verbosity More... | |
int | GetVerbose () |
Get the verbose level. More... | |
void | SetImageDimensionsAndQuantification (oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification) |
set the pointer to the oImageDimensionsAndQuantification object More... | |
void | SetPOIResolution (FLTNB ap_value[3]) |
initialize the POI resolution (for list-mode) More... | |
void | SetIgnorePOIFlag (bool a_ignorePOIFlag) |
Set a boolean that that if we ignore POI information or not. More... | |
void | SetHeaderDataFileName (const string &a_headerFileName) |
set the data header file name More... | |
void | SetBinaryDataFileName (const string &a_dataFileName) |
set the data binary file name More... | |
void | SetCalibrationFactor (FLTNB a_value) |
initialize the global calibration factor with a FLTNB value More... | |
void | SetNbEvents (int64_t a_value) |
initialize the number of events with a int64_t value More... | |
void | SetStartTime (FLTNB a_value) |
void | SetDuration (FLTNB a_value) |
string | GetScannerName () |
virtual int | Shuffle (int64_t) |
!!!\ This function has been modified to be used specifically with a More... | |
Private Member Functions | |
int | SetSpecificParametersFrom (vDataFile *ap_DataFile) |
Initialize all parameters specific to SPECT from the provided datafile. More... | |
int | CheckSpecificParameters () |
Check parameters specific to SPECT data. More... | |
int | CheckFileSizeConsistency () |
This function is implemented in child classes Check if file size is consistent. More... | |
int | WriteHistoEvent (iEventHistoSPECT *ap_Event, int a_th) |
Write a SPECT histogram event. More... | |
int | WriteListEvent (iEventListSPECT *ap_Event, int a_th) |
Write a SPECT list-mode event. More... | |
int | CheckSpecificConsistencyWithAnotherDataFile (vDataFile *ap_DataFile) |
Check consistency between 'this' and the provided datafile, for specific characteristics. More... | |
Private Attributes | |
string | m_isotope |
bool | m_eventKindFlag |
bool | m_normCorrectionFlag |
bool | m_ignoreNormCorrectionFlag |
bool | m_scatCorrectionFlag |
bool | m_ignoreScatCorrectionFlag |
uint16_t | mp_nbOfBins [2] |
FLTNB | m_acquisitionZoom |
uint16_t | m_nbOfProjections |
FLTNB * | mp_angles |
uint16_t | m_nbHeads |
FLTNB * | mp_CORtoDetectorDistance |
int | m_headRotDirection |
Additional Inherited Members | |
Protected Attributes inherited from vDataFile | |
oImageDimensionsAndQuantification * | mp_ID |
int | m_verbose |
string | m_headerFileName |
string | m_dataFileName |
int64_t | m_nbEvents |
int | m_dataMode |
int | m_dataType |
int | m_dataSpec |
FLTNB | m_startTimeInSec |
FLTNB | m_durationInSec |
FLTNB | m_calibrationFactor |
int | m_bedIndex |
FLTNB | m_relativeBedPosition |
bool | m_bedPositionFlag |
string | m_scannerName |
bool | m_POIInfoFlag |
bool | m_ignorePOIFlag |
bool | mp_POIDirectionFlag [3] |
FLTNB | mp_POIResolution [3] |
int64_t | m_sizeEvent |
fstream ** | m2p_dataFile |
vEvent ** | m2p_BufferEvent |
int64_t | m_mpi1stEvent |
int64_t | m_mpiLastEvent |
int64_t | m_mpiNbEvents |
oMemoryMapped * | mp_MappedFile |
char * | mp_mappedMemory |
Inherit from vDataFile. Class that manages the reading of a SPECT input file (header + data).
It contains several arrays corresponding to the different kind of informations the data file could contain.
As many booleans as arrays say if the data are here or not. The data file can be either completely loaded, or read event by event during reconstruction.
MPI is coming here to cut the data file into peaces (also either can be loaded or read on-the-fly).
Definition at line 47 of file iDataFileSPECT.hh.
iDataFileSPECT::iDataFileSPECT | ( | ) |
iDataFileSPECT constructor. Initialize the member variables to their default values.
Definition at line 39 of file iDataFileSPECT.cc.
iDataFileSPECT::~iDataFileSPECT | ( | ) |
iDataFileSPECT destructor.
Definition at line 65 of file iDataFileSPECT.cc.
|
privatevirtual |
This function is implemented in child classes
Check if file size is consistent.
Implements vDataFile.
Definition at line 453 of file iDataFileSPECT.cc.
|
privatevirtual |
Check consistency between 'this' and the provided datafile, for specific characteristics.
vDataFile* | ap_DataFile |
Implementation of the pure virtual function from vDataFile. It checks correction flags, etc.
Implements vDataFile.
Definition at line 506 of file iDataFileSPECT.cc.
|
privatevirtual |
Check parameters specific to SPECT data.
Implements vDataFile.
Definition at line 423 of file iDataFileSPECT.cc.
|
virtual |
Computation of the size of each event according to the mandatory/optional correction fields.
Implements vDataFile.
Definition at line 173 of file iDataFileSPECT.cc.
|
virtual |
Implementation of the pure virtual eponym function that simply prints info about the datafile.
Implements vDataFile.
Definition at line 396 of file iDataFileSPECT.cc.
|
inline |
Definition at line 167 of file iDataFileSPECT.hh.
|
inline |
Definition at line 173 of file iDataFileSPECT.hh.
|
inline |
Simply return m_eventKindFlag.
Definition at line 238 of file iDataFileSPECT.hh.
|
virtual |
Read an event from the position pointed by 'ap_buffer', parse the generic or modality-specific information, and store them in the (multithreaded) 'm2p_BufferEvent' object.
ap_buffer | : address pointing to the event to recover |
a_th | : index of the thread from which the function was called |
Implements vDataFile.
Definition at line 306 of file iDataFileSPECT.cc.
|
inline |
Simply return m_headRotDirection.
Definition at line 224 of file iDataFileSPECT.hh.
|
inline |
Definition at line 202 of file iDataFileSPECT.hh.
|
inline |
axis | : axis corresponding to transaxial (0) or axial (1) bins |
Definition at line 180 of file iDataFileSPECT.hh.
|
inline |
Definition at line 155 of file iDataFileSPECT.hh.
|
inline |
Definition at line 161 of file iDataFileSPECT.hh.
|
inline |
Simply return m_normCorrectionFlag.
Definition at line 252 of file iDataFileSPECT.hh.
|
inline |
Simply return m_scatCorrectionFlag.
Definition at line 245 of file iDataFileSPECT.hh.
int iDataFileSPECT::InitAngles | ( | FLTNB * | ap_angles | ) |
allocate memory for the mp_angles variable using m_nbProjections and initialize the projection angles with the provided list of values
ap_angles |
Definition at line 550 of file iDataFileSPECT.cc.
int iDataFileSPECT::InitCorToDetectorDistance | ( | FLTNB * | ap_CORtoDetectorDistance | ) |
allocate memory for the ap_CORtoDetectorDistance variable using m_nbProjections, and initialize the projection angles with the provided list of values
ap_CORtoDetectorDistance |
Definition at line 572 of file iDataFileSPECT.cc.
|
virtual |
Store different kind of information inside arrays (data relative to specific correction as well as basic raw data for the case data is loaded in RAM)
Use the flag provided by the user to determine how the data has to be sorted (preloaded or read on the fly)
Implements vDataFile.
Definition at line 228 of file iDataFileSPECT.cc.
|
virtual |
Get SPECT specific parameters for projections from the scanner object, through the scannerManager.
Implements vDataFile.
Definition at line 842 of file iDataFileSPECT.cc.
|
virtual |
Initialize the fstream objets for output writing as well as some other variables specific to the Projection script (Event-based correction flags, Estimated size of data file)
Implements vDataFile.
Definition at line 594 of file iDataFileSPECT.cc.
|
virtual |
Read through the header file and recover specific SPECT information.
bool | a_affectQuantificationFlag |
If the parameter flag is on, then affect the quantification factors from the oImageDimensionsAndQuantification after reading relevant information
Implements vDataFile.
Definition at line 76 of file iDataFileSPECT.cc.
|
inline |
set to true the flag indicating the presence of the kind of a list-mode event in the datafile
This function is dedicated to datafile conversion scripts
Definition at line 187 of file iDataFileSPECT.hh.
|
inline |
initialize the rotation direction of the gamma camera(s)
a_direction |
Definition at line 231 of file iDataFileSPECT.hh.
|
inline |
initialize the isotope string value
a_value |
The name should corresponds to one corresponding tag in the isotope configuration file in config/. This function is dedicated to datafile conversion scripts
Definition at line 196 of file iDataFileSPECT.hh.
|
inline |
initialize the bin values
a_binTrs | |
a_binAxl |
Definition at line 210 of file iDataFileSPECT.hh.
|
inline |
initialize the number of projections
a_nbProjections |
Definition at line 217 of file iDataFileSPECT.hh.
|
privatevirtual |
Initialize all parameters specific to SPECT from the provided datafile.
Implements vDataFile.
Definition at line 150 of file iDataFileSPECT.cc.
|
virtual |
Write event according to the chosen type of data.
ap_Event | : event containing the data to write |
a_th | : index of the thread from which the function was called |
Implements vDataFile.
Definition at line 650 of file iDataFileSPECT.cc.
|
virtual |
Generate a header file according to the data output information.
Implements vDataFile.
Definition at line 778 of file iDataFileSPECT.cc.
|
private |
Write a SPECT histogram event.
ap_Event | : event containing the data to write |
a_th | : index of the thread from which the function was called |
Definition at line 681 of file iDataFileSPECT.cc.
|
private |
Write a SPECT list-mode event.
ap_Event | : event containing the data to write |
a_th | : index of the thread from which the function was called |
Definition at line 719 of file iDataFileSPECT.cc.
|
private |
Zoom used during the acquisition to limit the area of detection for monolithic detectors
Definition at line 312 of file iDataFileSPECT.hh.
|
private |
Flag for informations about the event nature (true, scatter) in the data. Default value = false
Definition at line 306 of file iDataFileSPECT.hh.
|
private |
Head rotation direction (0=clockwise, 1=counterclockwise)
Definition at line 322 of file iDataFileSPECT.hh.
|
private |
Flag to say if we ignore the normalization correction even if present. Default = false
Definition at line 308 of file iDataFileSPECT.hh.
|
private |
Flag to say if we ignore the scatter correction even if present. Default = false
Definition at line 310 of file iDataFileSPECT.hh.
|
private |
Isotope. Default value =unknown
Definition at line 305 of file iDataFileSPECT.hh.
|
private |
Number of heads in the SPECT systems. Default =1
Definition at line 316 of file iDataFileSPECT.hh.
|
private |
Total number of projections during the acquisition(for all the heads). No Default
Definition at line 313 of file iDataFileSPECT.hh.
|
private |
Flag that says if normalization correction terms are included in the data. Default = false
Definition at line 307 of file iDataFileSPECT.hh.
|
private |
Flag that says if scatter correction terms are included in the data. Default = false
Definition at line 309 of file iDataFileSPECT.hh.
|
private |
Angle [for each projection] in degrees. If SPECT system contains several heads, first head angles should be entered first, followed by 2nd head angles, etc.. No Default
Definition at line 314 of file iDataFileSPECT.hh.
|
private |
Distance camera surface to COR (mm) [for each projection].
if not provided, the distance given for each heads in the camera description file is taken and considered constant for each projections related to each head
if provided then: if positive value (either a constant value, or a value specific to each projection) then it overwrites the one given in the camera file
if negative, the distance given for each heads in the camera description file is taken and considered constant for each projections related to each head
Default value = Recovered from the camera description file
Definition at line 317 of file iDataFileSPECT.hh.
|
private |
Transaxial/Axial number of bins. Default value =1,1
Definition at line 311 of file iDataFileSPECT.hh.