CASToR
2.0
Tomographic Reconstruction (PET/SPECT/CT)
|
This class is designed to be a mother virtual class for DataFile. More...
#include <vDataFile.hh>
Public Member Functions | |
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... | |
virtual int | ComputeSizeEvent ()=0 |
This function is implemented in child classes Computation of the size of each event according to the mandatory/optional correction fields. More... | |
virtual int | PrepareDataFile ()=0 |
This function is implemented in child classes 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 | 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... | |
virtual int | WriteHeader ()=0 |
This function is implemented in child classes. Generate a header file according to the data output information. More... | |
virtual int | WriteEvent (vEvent *ap_Event, int a_th=0)=0 |
This function is implemented in child classes Write event according to the chosen type of data. More... | |
vEvent * | GetEvent (int64_t a_eventIndex, int a_th=0) |
virtual vEvent * | GetEventSpecific (char *ap_buffer, int a_th)=0 |
This function is implemented in child classes 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... | |
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... | |
virtual void | DescribeSpecific ()=0 |
A pure virtual function used to describe the specific parts of the datafile. More... | |
virtual int | PROJ_InitFile ()=0 |
This function is implemented in child classes Initialize the fstream objets for output writing as well as some other variables specific to the Projection script. More... | |
virtual int | PROJ_GetScannerSpecificParameters ()=0 |
This function is implemented in child classes It is used to set several variables of the datafile when using the projection script. Get modality specific parameters from the scanner object, through the scannerManager. 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... | |
Protected Attributes | |
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 |
Private Member Functions | |
virtual int | SetSpecificParametersFrom (vDataFile *ap_DataFile)=0 |
This function is implemented in child classes Initialize all specific parameters from the provided datafile. More... | |
virtual int | CheckSpecificParameters ()=0 |
This function is implemented in child classes Check specific parameters of child classes. More... | |
virtual int | CheckFileSizeConsistency ()=0 |
virtual int | ReadSpecificInfoInHeader (bool a_affectQuantificationFlag=true)=0 |
This function is implemented in child classes Read and check modality-specific information from the header datafile. More... | |
virtual int | CheckSpecificConsistencyWithAnotherDataFile (vDataFile *ap_DataFile)=0 |
Check consistency between 'this' and the provided datafile, for specific characteristics. More... | |
This class is designed to be a mother virtual class for DataFile.
This class manages the reading of the generic input file (header + data).
It uses some events as buffers to get data informations during run-time.
Definition at line 103 of file vDataFile.hh.
vDataFile::vDataFile | ( | ) |
vDataFile constructor.
Initialize the member variables to their default values.
Definition at line 39 of file vDataFile.cc.
|
virtual |
vDataFile destructor.
Definition at line 85 of file vDataFile.cc.
int vDataFile::CheckConsistencyWithAnotherBedDataFile | ( | vDataFile * | ap_DataFile | ) |
Check consistency between 'this' and the provided datafile as two bed positions.
vDataFile* | ap_DataFile |
It checks data type, mode, number of events if histogram, event size, calibration factor, and scanner. For characteristics specific to the modality, it finally calls the pure virtual CheckSpecificConsistyWithAnotherBedDataFile() function implemented by children.
Definition at line 386 of file vDataFile.cc.
|
privatepure virtual |
Implemented in iDataFilePET, iDataFileSPECT, and iDataFileCT.
int vDataFile::CheckParameters | ( | ) |
Check the initialization of member variables
Call the CheckSpecificParameters() function implemented in child classes.
Definition at line 315 of file vDataFile.cc.
|
privatepure virtual |
Check consistency between 'this' and the provided datafile, for specific characteristics.
vDataFile* | ap_DataFile |
Pure virtual function implemented by children. It checks correction flags, etc.
Implemented in iDataFilePET, iDataFileSPECT, and iDataFileCT.
|
privatepure virtual |
This function is implemented in child classes
Check specific parameters of child classes.
Implemented in iDataFilePET, iDataFileSPECT, and iDataFileCT.
int vDataFile::CloseFile | ( | ) |
Close as many binary file stream for writing.
Use the m2p_dataFile for that purpose, see OpenFileForWriting() function
Definition at line 578 of file vDataFile.cc.
|
pure virtual |
This function is implemented in child classes
Computation of the size of each event according to the mandatory/optional correction fields.
Implemented in iDataFileCT, iDataFileSPECT, and iDataFilePET.
void vDataFile::Describe | ( | ) |
A function used to describe the generic parts of the datafile.
Definition at line 510 of file vDataFile.cc.
|
pure virtual |
A pure virtual function used to describe the specific parts of the datafile.
Implemented in iDataFileSPECT, iDataFileCT, and iDataFilePET.
|
inline |
Definition at line 294 of file vDataFile.hh.
|
inline |
Definition at line 426 of file vDataFile.hh.
|
inline |
Definition at line 368 of file vDataFile.hh.
|
inline |
Definition at line 350 of file vDataFile.hh.
|
inline |
Definition at line 300 of file vDataFile.hh.
string vDataFile::GetDataModeToString | ( | ) |
Definition at line 856 of file vDataFile.cc.
|
inline |
Definition at line 322 of file vDataFile.hh.
string vDataFile::GetDataSpecToString | ( | ) |
Definition at line 872 of file vDataFile.cc.
|
inline |
Definition at line 311 of file vDataFile.hh.
string vDataFile::GetDataTypeToString | ( | ) |
Definition at line 840 of file vDataFile.cc.
|
inline |
Definition at line 362 of file vDataFile.hh.
vEvent * vDataFile::GetEvent | ( | int64_t | a_eventIndex, |
int | a_th = 0 |
||
) |
int64_t | a_eventIndex |
int | a_th |
x
Definition at line 598 of file vDataFile.cc.
void vDataFile::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.
ap_indexStart | : pointer to recover the index of the first event |
ap_indexStop | : pointer to recover the index of the last event |
a_subsetNum | : actual subset index of the iteration (0 if no subsets) |
a_nbSubsets | : max number of subsets in this iteration (1 if no subsets) |
Definition at line 671 of file vDataFile.cc.
|
inline |
|
pure virtual |
This function is implemented in child classes
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 in the event buffer array |
a_th | : index of the thread from which the function was called |
Implemented in iDataFileCT, iDataFileSPECT, and iDataFilePET.
|
inline |
Definition at line 344 of file vDataFile.hh.
|
inline |
Definition at line 392 of file vDataFile.hh.
|
virtual |
Return an error by default.
This function is surcharged by the PET (and CT) scanner daughter class.
Definition at line 702 of file vDataFile.cc.
|
inline |
Definition at line 380 of file vDataFile.hh.
|
inline |
Definition at line 386 of file vDataFile.hh.
|
inline |
Definition at line 374 of file vDataFile.hh.
|
inline |
Definition at line 432 of file vDataFile.hh.
|
inline |
Definition at line 522 of file vDataFile.hh.
|
inline |
Definition at line 333 of file vDataFile.hh.
|
inline |
Definition at line 356 of file vDataFile.hh.
|
inline |
Get the verbose level.
Definition at line 446 of file vDataFile.hh.
int vDataFile::InitializeMappedFile | ( | ) |
Check the datafile existency, map it to memory and get the raw char* pointer.
.
Definition at line 462 of file vDataFile.cc.
int vDataFile::OpenFileForWriting | ( | string | a_suffix = "" | ) |
Open a binary file stream for writing, with eventually the suffix appended to the file name.
string | a_suffix |
Use the m2p_dataFile for that purpose. This function along with the CloseFile function use only one thread
Definition at line 537 of file vDataFile.cc.
|
pure virtual |
This function is implemented in child classes
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)
Implemented in iDataFileCT, iDataFileSPECT, and iDataFilePET.
int vDataFile::PROJ_DeleteTmpDataFile | ( | ) |
Delete temporary datafile used for multithreaded output writing if needed.
Definition at line 786 of file vDataFile.cc.
vEvent * vDataFile::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.
idx_elt1 | : first ID of the event |
idx_elt2 | : second ID of the event |
a_th | : index of the thread from which the function was called |
Definition at line 824 of file vDataFile.cc.
|
pure virtual |
This function is implemented in child classes
It is used to set several variables of the datafile when using the projection script.
Get modality specific parameters from the scanner object, through the scannerManager.
Implemented in iDataFilePET, iDataFileSPECT, and iDataFileCT.
|
pure virtual |
This function is implemented in child classes
Initialize the fstream objets for output writing as well as some other variables specific to the Projection script.
Implemented in iDataFilePET, iDataFileSPECT, and iDataFileCT.
int vDataFile::PROJ_WriteData | ( | ) |
Write/Merge chunk of data in a general data file.
Definition at line 715 of file vDataFile.cc.
int vDataFile::ReadInfoInHeader | ( | bool | a_affectQuantificationFlag = true | ) |
Read and check general information from the header datafile
Call the ReadSpecificInformationInHeader() function implemented in child classes.
bool | a_affectQuantificationFlag = true |
If the parameter flag is on, then affect the quantification factors from the oImageDimensionsAndQuantification after reading relevant information
Definition at line 110 of file vDataFile.cc.
|
privatepure virtual |
This function is implemented in child classes
Read and check modality-specific information from the header datafile.
bool | a_affectQuantificationFlag = true |
If the parameter flag is on, then affect the quantification factors from the oImageDimensionsAndQuantification after reading relevant information
Implemented in iDataFileCT, iDataFileSPECT, and iDataFilePET.
|
inline |
set the bed index corresponding to this data file
a_bedIndex |
Definition at line 420 of file vDataFile.hh.
|
inline |
set the data binary file name
const | string& a_dataFileName |
This function is dedicated to datafile conversion scripts
Definition at line 484 of file vDataFile.hh.
|
inline |
initialize the global calibration factor with a FLTNB value
a_value |
This function is dedicated to datafile conversion scripts
Definition at line 492 of file vDataFile.hh.
|
inline |
set the data mode
a_dataMode |
Definition at line 406 of file vDataFile.hh.
|
inline |
set the data type
a_dataType |
Definition at line 413 of file vDataFile.hh.
|
inline |
|
inline |
set the data header file name
const | string& a_headerFileName |
This function is dedicated to datafile conversion scripts
Definition at line 476 of file vDataFile.hh.
|
inline |
Set a boolean that that if we ignore POI information or not.
a_flag |
Definition at line 468 of file vDataFile.hh.
|
inline |
set the pointer to the oImageDimensionsAndQuantification object
ap_ImageDimensionsAndQuantification |
Definition at line 453 of file vDataFile.hh.
|
inline |
initialize the number of events with a int64_t value
a_value |
This function is dedicated to datafile conversion scripts
Definition at line 500 of file vDataFile.hh.
int vDataFile::SetParametersFrom | ( | vDataFile * | ap_DataFile | ) |
Initialize all parameters from the provided datafile.
This function is intended to be used right after the constructor
Definition at line 275 of file vDataFile.cc.
|
inline |
initialize the POI resolution (for list-mode)
ap_value | : vector of 3 elements (x,y,z) |
This function is dedicated to datafile conversion scripts
Definition at line 461 of file vDataFile.hh.
|
privatepure virtual |
This function is implemented in child classes
Initialize all specific parameters from the provided datafile.
Implemented in iDataFilePET, iDataFileSPECT, and iDataFileCT.
|
inline |
|
inline |
set verbosity
a_verboseLevel |
Definition at line 439 of file vDataFile.hh.
|
virtual |
!!!\ This function has been modified to be used specifically with a
Definition at line 623 of file vDataFile.cc.
|
pure virtual |
This function is implemented in child classes
Write event according to the chosen type of data.
ap_Event | : Event to write |
a_th | : index of the thread from which the function was called |
Implemented in iDataFileCT, iDataFileSPECT, and iDataFilePET.
|
pure virtual |
This function is implemented in child classes.
Generate a header file according to the data output information.
Implemented in iDataFileCT, iDataFileSPECT, and iDataFilePET.
|
protected |
vEvent structure, used to read and transfer the raw data to each part of the algorithm (multithreaded)
Definition at line 600 of file vDataFile.hh.
|
protected |
File associated to the raw data file (multithreaded)
Definition at line 599 of file vDataFile.hh.
|
protected |
Bed position index corresponding to this data file
Definition at line 586 of file vDataFile.hh.
|
protected |
Flag indicating that a relative bed position has been provided
Definition at line 588 of file vDataFile.hh.
|
protected |
Calibration factor for the data. Default value =1.0
Definition at line 585 of file vDataFile.hh.
|
protected |
String containing the path to the raw datafile
Definition at line 578 of file vDataFile.hh.
|
protected |
Flag indicating if the data is List (=0) or Histogram (=1) mode
Definition at line 580 of file vDataFile.hh.
|
protected |
Flag indicating the physical specificity of the data: SPEC_EMISSION or SPEC_TRANSMISSION
Definition at line 582 of file vDataFile.hh.
|
protected |
Flag indicating if the data is PET (=0),SPECT (=1) or TRANSMISSION type (=2)
Definition at line 581 of file vDataFile.hh.
|
protected |
Duration of the acquisition (s)
Definition at line 584 of file vDataFile.hh.
|
protected |
String containing the path to the header file
Definition at line 577 of file vDataFile.hh.
|
protected |
Flag to say if we ignore the POI data if present, or not. Default = false
Definition at line 593 of file vDataFile.hh.
|
protected |
First index managed by this MPI instance
Definition at line 601 of file vDataFile.hh.
|
protected |
Last index (included) managed by this MPI instance
Definition at line 602 of file vDataFile.hh.
|
protected |
Number of events managed by this MPI instance
Definition at line 603 of file vDataFile.hh.
|
protected |
Total number of events in the raw data
Definition at line 579 of file vDataFile.hh.
|
protected |
Flag to say if POI information is included in the datafile for each event
Definition at line 592 of file vDataFile.hh.
|
protected |
Bed relative position in mm
Definition at line 587 of file vDataFile.hh.
|
protected |
Scanner name
Definition at line 589 of file vDataFile.hh.
|
protected |
Size of an event in the datafile (calculated from mandatory and optional fields)
Definition at line 598 of file vDataFile.hh.
|
protected |
Start time of the acquisition (s)
Definition at line 583 of file vDataFile.hh.
|
protected |
Verbosity
Definition at line 574 of file vDataFile.hh.
|
protected |
Pointer to the oImageDimensionsAndQuantification object
Definition at line 573 of file vDataFile.hh.
|
protected |
The object managing the mapping of the datafile
Definition at line 604 of file vDataFile.hh.
|
protected |
The raw pointer directly mapped to the datafile
Definition at line 605 of file vDataFile.hh.
|
protected |
Flag to say which direction is included in the POI for each event; radial, tangential and axial
Definition at line 594 of file vDataFile.hh.
|
protected |
POI resolution (position of interaction) for each direction: radial, tangential and axial
Definition at line 595 of file vDataFile.hh.