CASToR  3.0
Tomographic Reconstruction (PET/SPECT/CT)
Public Member Functions | Private Member Functions | Private Attributes | List of all members
oDynamicDataManager Class Reference

This class gathers the information about the dynamic splitting of the data. More...

#include <oDynamicDataManager.hh>

Collaboration diagram for oDynamicDataManager:
Collaboration graph

Public Member Functions

 oDynamicDataManager ()
 oDynamicDataManager constructor. Initialize the member variables to their default values. More...
 
 ~oDynamicDataManager ()
 oDynamicDataManager destructor. More...
 
int InitDynamicData (int a_nbRespGates, int a_nbCardGates, const string &a_pathTo4DDataSplittingFile, int a_rmMCorrFlag, int a_cMmCorrFlag, int a_pMotionCorrFlag)
 Main function for instanciation and initialization of the member variables and arrays. Call the specific initialization function depending of the type of dataset. More...
 
int SetDynamicSpecificQuantificationFactors (FLTNB **a2p_quantificationFactors)
 Compute gate-specific quantificative factors using the number of events within each gate, and update the quantitative factors passed in argument. More...
 
int CheckParameters (int64_t a_nbEvents)
 Check all mandatory parameters. More...
 
void ResetCurrentDynamicIndices ()
 Reset to 0 the multithreaded dynamic arrays gathering the indices of current frame, gates and involuntary motion. More...
 
int DynamicSwitch (int64_t a_index, uint32_t a_time, int a_bed, int a_th)
 This function is called in the reconstruction event loop. It is used to check if the current event belongs to a new respiratory/cardiac/involuntary motion gate
Increment the index reporting the current relative gate in this case. More...
 
void SetVerbose (int a_verboseLevel)
 set verbosity More...
 
void SetImageDimensionsAndQuantification (oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
 set the pointer to the oImageDimensionsAndQuantification object More...
 
void SetRespMotionFlagOn ()
 set the respiratory motion flag to 'true' More...
 
void SetCardMotionFlagOn ()
 set the cardiac motion flag to 'true' More...
 
void SetPMotionFlagOn ()
 set the involuntary patient motion flag to 'true' More...
 
bool IsRespMotionEnabled ()
 
bool IsCardMotionEnabled ()
 
bool IsPMotionEnabled ()
 
int GetCurrentPMotionIndex (int a_th)
 return the number of the current involuntary patient motion image to be used in the ImageSpace matrices, for this thread More...
 
int GetCurrentTimeFrame (int a_th)
 Return the index indicating the current time frame for this thread. More...
 
int GetCurrentRespGate (int a_th)
 Return the index indicating the current respiratory gate for this thread. More...
 
int GetCurrentRespImage (int a_th)
 return the number of the current respiratory gated image, to be used in the ImageSpace matrices for the reconstruction More...
 
int GetCurrentCardGate (int a_th)
 Return the index indicating the current cardiac gate for this thread. More...
 
int GetCurrentCardImage (int a_th)
 return the number of the current cardiac gated image, to be used in the ImageSpace matrices for the reconstruction More...
 
int GetNb2ndMotImgsForLMS ()
 return the number of secundary motion (typically cardiac) images to be used in the ImageSpace matrices for the list-mode sensitivity image generation More...
 
int GetPMotionFirstIndexForFrame (int a_fr)
 if patient motion is enabled, return the first index of patient motion for the frame fr, 0 otherwise This is required in the ImageSpace matrices for the list-mode sensitivity image generation and for the initial deformation of the forward image More...
 
int GetPMotionLastIndexForFrame (int a_fr)
 if patient motion is enabled, return the last index of patient motion for the frame fr, 0 otherwise This is required in the reconstruction process to perform the correct (backward) deformation for the bimage of each frame More...
 
int GetNb1stMotImgsForLMS (int a_fr)
 return the number of first motion (either respiratory or involuntary patient motion) images to be used in the ImageSpace matrices for the list-mode sensitivity image generation More...
 
int GetNbPMotionTriggers (int a_fr)
 return the number of involuntary patient motion triggers More...
 
FLTNB GetListPMotionWeightInFrameForLMS (int a_fr, int a_pmsset)
 return the weight of a patient motion subset in terms of duration, for a specific frame More...
 
int GetNbIPatMotionSubsets ()
 return the number of involuntary patient motion transformations More...
 
bool GateDurationProvided ()
 

Private Member Functions

int InitDynamicDataGating (const string &a_pathToGateFile)
 Initialisation of arrays containing informations about the data splitting and respiratory/cardiac gated reconstruction. More...
 
int InitDynamicDataPatientMotion (const string &a_pathToFile)
 Initialisation of involuntary patient motion correction information, if any. More...
 

Private Attributes

oImageDimensionsAndQuantificationmp_ID
 
int m_verbose
 
int * mp_currentFrameIndex
 
int m_nbTimeFrames
 
bool m_respGatingFlag
 
bool m_rMotionCorrFlag
 
int m_nbRespGates
 
int64_t ** m2p_nbEventsPerRespGate
 
int64_t ** m2p_indexLastEventRespGate
 
int * mp_currentRespGateIndex
 
bool m_cardGatingFlag
 
bool m_cMotionCorrFlag
 
int m_nbCardGates
 
int64_t ** m2p_nbEventsPerCardGate
 
int64_t ** m2p_indexLastEventCardGate
 
int * mp_currentCardGateIndex
 
HPFLTNB ** m2p_durationPerGate
 
bool m_gateDurationProvidedFlag
 
bool m_pMotionCorrFlag
 
int m_nbPMotionTriggers
 
uint16_t * mp_framePMotionFirstIndex
 
uint16_t * mp_framePMotionLastIndex
 
uint16_t * mp_frameNbPMotionTriggers
 
uint32_t * mp_listPMotionTriggers
 
HPFLTNB ** m2p_listPMotionWeightInFrame
 
int * mp_currentPMotionIndex
 

Detailed Description

This class gathers the information about the dynamic splitting of the data.

It contains the functions dedicated to the reading of user-provided informations about the dynamic dataset.
It is specific to each iDataFile object.
It holds several arrays related to the 4D splitting of the data, the current gates indices, as well as the related functions.

Definition at line 52 of file oDynamicDataManager.hh.

Constructor & Destructor Documentation

◆ oDynamicDataManager()

oDynamicDataManager::oDynamicDataManager ( )

oDynamicDataManager constructor. Initialize the member variables to their default values.

Definition at line 39 of file oDynamicDataManager.cc.

◆ ~oDynamicDataManager()

oDynamicDataManager::~oDynamicDataManager ( )

oDynamicDataManager destructor.

Definition at line 74 of file oDynamicDataManager.cc.

Member Function Documentation

◆ CheckParameters()

int oDynamicDataManager::CheckParameters ( int64_t  a_nbEvents)

Check all mandatory parameters.

Parameters
a_nbEvents: Number of events in the acquisition, used to check consistency with the gating metadata
Returns
0 if success, positive value otherwise.

Definition at line 609 of file oDynamicDataManager.cc.

Here is the caller graph for this function:

◆ DynamicSwitch()

int oDynamicDataManager::DynamicSwitch ( int64_t  a_index,
uint32_t  a_time,
int  a_bed,
int  a_th 
)

This function is called in the reconstruction event loop. It is used to check if the current event belongs to a new respiratory/cardiac/involuntary motion gate
Increment the index reporting the current relative gate in this case.

Parameters
a_currentEventIndex: Index of the current event in the iterative reconstruction loop
a_currentTime: Timestamp of the current event in the iterative reconstruction loop
a_bed
a_th
Returns
0 if nothing to do, 1 if the current timestamp is inferior to the start time of the first frame, 2 if a deformation is required (gate has changed and motion correction is enabled)

Definition at line 715 of file oDynamicDataManager.cc.

Here is the caller graph for this function:

◆ GateDurationProvided()

oDynamicDataManager::GateDurationProvided ( )
inline
Returns
true if gate durations have been provided, false otherwise

Definition at line 293 of file oDynamicDataManager.hh.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCurrentCardGate()

oDynamicDataManager::GetCurrentCardGate ( int  a_th)
inline

Return the index indicating the current cardiac gate for this thread.

Parameters
a_th
Returns
cardiac gate index.

Definition at line 212 of file oDynamicDataManager.hh.

Here is the caller graph for this function:

◆ GetCurrentCardImage()

oDynamicDataManager::GetCurrentCardImage ( int  a_th)
inline

return the number of the current cardiac gated image, to be used in the ImageSpace matrices for the reconstruction

Parameters
a_th

if cardiac motion correction is enabled in reconstruction, the function returns 0 as only one image is reconstructed for each gate

Returns
the index of the current gated image related to the reconstruction for the specific thread

Definition at line 221 of file oDynamicDataManager.hh.

Here is the caller graph for this function:

◆ GetCurrentPMotionIndex()

oDynamicDataManager::GetCurrentPMotionIndex ( int  a_th)
inline

return the number of the current involuntary patient motion image to be used in the ImageSpace matrices, for this thread

Parameters
a_th
Returns
the index of the current involuntary patient motion gated image if this methodology is enabled, 0 otherwise

Definition at line 179 of file oDynamicDataManager.hh.

Here is the caller graph for this function:

◆ GetCurrentRespGate()

oDynamicDataManager::GetCurrentRespGate ( int  a_th)
inline

Return the index indicating the current respiratory gate for this thread.

Parameters
a_th
Returns
respiratory gate index.

Definition at line 195 of file oDynamicDataManager.hh.

Here is the caller graph for this function:

◆ GetCurrentRespImage()

oDynamicDataManager::GetCurrentRespImage ( int  a_th)
inline

return the number of the current respiratory gated image, to be used in the ImageSpace matrices for the reconstruction

Parameters
a_th

if respiratory motion correction is enabled in reconstruction, the function returns 0 as only one image is reconstructed for each gate

Returns
the index of the gated image related to the reconstruction for the specific thread

Definition at line 204 of file oDynamicDataManager.hh.

Here is the caller graph for this function:

◆ GetCurrentTimeFrame()

oDynamicDataManager::GetCurrentTimeFrame ( int  a_th)
inline

Return the index indicating the current time frame for this thread.

Parameters
a_th
Returns
time frame index.

Definition at line 187 of file oDynamicDataManager.hh.

Here is the caller graph for this function:

◆ GetListPMotionWeightInFrameForLMS()

oDynamicDataManager::GetListPMotionWeightInFrameForLMS ( int  a_fr,
int  a_pmsset 
)
inline

return the weight of a patient motion subset in terms of duration, for a specific frame

Parameters
a_fr= frame index
a_pmsset= patient motion subset index
Returns
the weight of a patient motion subset

Definition at line 277 of file oDynamicDataManager.hh.

Here is the caller graph for this function:

◆ GetNb1stMotImgsForLMS()

oDynamicDataManager::GetNb1stMotImgsForLMS ( int  a_fr)
inline

return the number of first motion (either respiratory or involuntary patient motion) images to be used in the ImageSpace matrices for the list-mode sensitivity image generation

Parameters
a_fr= frame index
Returns
the total number of respiratory gates

Definition at line 257 of file oDynamicDataManager.hh.

Here is the caller graph for this function:

◆ GetNb2ndMotImgsForLMS()

oDynamicDataManager::GetNb2ndMotImgsForLMS ( )
inline

return the number of secundary motion (typically cardiac) images to be used in the ImageSpace matrices for the list-mode sensitivity image generation

Returns
the number of cardiac images required for the sensitivity image generation

Definition at line 228 of file oDynamicDataManager.hh.

Here is the caller graph for this function:

◆ GetNbIPatMotionSubsets()

oDynamicDataManager::GetNbIPatMotionSubsets ( )
inline

return the number of involuntary patient motion transformations

Returns
the total number of involuntary patient motion triggers

Definition at line 286 of file oDynamicDataManager.hh.

Here is the caller graph for this function:

◆ GetNbPMotionTriggers()

oDynamicDataManager::GetNbPMotionTriggers ( int  a_fr)
inline

return the number of involuntary patient motion triggers

Parameters
a_fr= frame index
Returns
the total number of triggers

Definition at line 267 of file oDynamicDataManager.hh.

◆ GetPMotionFirstIndexForFrame()

oDynamicDataManager::GetPMotionFirstIndexForFrame ( int  a_fr)
inline

if patient motion is enabled, return the first index of patient motion for the frame fr, 0 otherwise This is required in the ImageSpace matrices for the list-mode sensitivity image generation and for the initial deformation of the forward image

Parameters
a_fr= frame index
Returns
the total number of respiratory gates

Definition at line 238 of file oDynamicDataManager.hh.

Here is the caller graph for this function:

◆ GetPMotionLastIndexForFrame()

oDynamicDataManager::GetPMotionLastIndexForFrame ( int  a_fr)
inline

if patient motion is enabled, return the last index of patient motion for the frame fr, 0 otherwise This is required in the reconstruction process to perform the correct (backward) deformation for the bimage of each frame

Parameters
a_fr= frame index
Returns
the total number of respiratory gates

Definition at line 248 of file oDynamicDataManager.hh.

Here is the caller graph for this function:

◆ InitDynamicData()

int oDynamicDataManager::InitDynamicData ( int  a_nbRespGates,
int  a_nbCardGates,
const string &  a_pathTo4DDataSplittingFile,
int  a_rmMCorrFlag,
int  a_cMmCorrFlag,
int  a_pMotionCorrFlag 
)

Main function for instanciation and initialization of the member variables and arrays. Call the specific initialization function depending of the type of dataset.

Parameters
a_nbRespGates
a_nbCardGates
a_pathTo4DDataFile: path to an ASCII file containing dynamic metadata regarding the acquisition
a_rmCorrFlag: indicate whether respiratory motion correction is enabled (1) or disabled (0)
a_cmCorrFlag: indicate whether cardiac motion correction is enabled (1) or disabled (0)
a_dmCorrFlag: indicate whether simultaneous respiratory and cardiac motion corrections are enabled (1) or disabled (0)
a_pmCorrFlag: indicate whether involuntary patient motion correction is enabled (1) or disabled (0)
Returns
0 if success, positive value otherwise.

Definition at line 113 of file oDynamicDataManager.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitDynamicDataGating()

int oDynamicDataManager::InitDynamicDataGating ( const string &  a_pathToGateFile)
private

Initialisation of arrays containing informations about the data splitting and respiratory/cardiac gated reconstruction.

Parameters
a_pathToFile: path to an ASCII file containing dynamic metadata regarding the acquisition
Returns
0 if success, positive value otherwise.

Definition at line 231 of file oDynamicDataManager.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitDynamicDataPatientMotion()

int oDynamicDataManager::InitDynamicDataPatientMotion ( const string &  a_pathToFile)
private

Initialisation of involuntary patient motion correction information, if any.

Parameters
a_pathToFile: path to an ASCII file containing dynamic metadata regarding the acquisition
Returns
0 if success, positive value otherwise.

Definition at line 324 of file oDynamicDataManager.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsCardMotionEnabled()

oDynamicDataManager::IsCardMotionEnabled ( )
inline
Returns
true if cardiac motion correction is enabled, false otherwise

Definition at line 165 of file oDynamicDataManager.hh.

Here is the caller graph for this function:

◆ IsPMotionEnabled()

oDynamicDataManager::IsPMotionEnabled ( )
inline
Returns
true if involuntary patient motion correction is enabled, false otherwise

Definition at line 171 of file oDynamicDataManager.hh.

Here is the caller graph for this function:

◆ IsRespMotionEnabled()

oDynamicDataManager::IsRespMotionEnabled ( )
inline
Returns
true if respiratory motion correction is enabled, false otherwise

Definition at line 159 of file oDynamicDataManager.hh.

Here is the caller graph for this function:

◆ ResetCurrentDynamicIndices()

void oDynamicDataManager::ResetCurrentDynamicIndices ( )

Reset to 0 the multithreaded dynamic arrays gathering the indices of current frame, gates and involuntary motion.

Definition at line 695 of file oDynamicDataManager.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetCardMotionFlagOn()

oDynamicDataManager::SetCardMotionFlagOn ( )
inline

set the cardiac motion flag to 'true'

Definition at line 147 of file oDynamicDataManager.hh.

Here is the caller graph for this function:

◆ SetDynamicSpecificQuantificationFactors()

int oDynamicDataManager::SetDynamicSpecificQuantificationFactors ( FLTNB **  a2p_quantificationFactors)

Compute gate-specific quantificative factors using the number of events within each gate, and update the quantitative factors passed in argument.

Parameters
FLTNB**a2p_quantificationFactors : 2 dimensional [timeframe][gate] set of quantitative factors to update
Returns
0 if success, positive value otherwise.

Definition at line 532 of file oDynamicDataManager.cc.

Here is the caller graph for this function:

◆ SetImageDimensionsAndQuantification()

oDynamicDataManager::SetImageDimensionsAndQuantification ( oImageDimensionsAndQuantification ap_ImageDimensionsAndQuantification)
inline

set the pointer to the oImageDimensionsAndQuantification object

Parameters
ap_ImageDimensionsAndQuantification

Definition at line 135 of file oDynamicDataManager.hh.

Here is the caller graph for this function:

◆ SetPMotionFlagOn()

oDynamicDataManager::SetPMotionFlagOn ( )
inline

set the involuntary patient motion flag to 'true'

Definition at line 153 of file oDynamicDataManager.hh.

Here is the caller graph for this function:

◆ SetRespMotionFlagOn()

oDynamicDataManager::SetRespMotionFlagOn ( )
inline

set the respiratory motion flag to 'true'

Definition at line 141 of file oDynamicDataManager.hh.

Here is the caller graph for this function:

◆ SetVerbose()

oDynamicDataManager::SetVerbose ( int  a_verboseLevel)
inline

set verbosity

Parameters
a_verboseLevel

Definition at line 128 of file oDynamicDataManager.hh.

Here is the caller graph for this function:

Member Data Documentation

◆ m2p_durationPerGate

HPFLTNB** oDynamicDataManager::m2p_durationPerGate
private

Table containing the duration in seconds of each gate. TODO: For future dynamic implementation, get this information from datafile header

Definition at line 342 of file oDynamicDataManager.hh.

◆ m2p_indexLastEventCardGate

int64_t** oDynamicDataManager::m2p_indexLastEventCardGate
private

2 dimensional array [nb frames][nb resp gates] containing the last event in the cardiac gates

Definition at line 338 of file oDynamicDataManager.hh.

◆ m2p_indexLastEventRespGate

int64_t** oDynamicDataManager::m2p_indexLastEventRespGate
private

2 dimensional array [nb frames][nb resp gates] containing the last event in the respiratory gates

Definition at line 330 of file oDynamicDataManager.hh.

◆ m2p_listPMotionWeightInFrame

HPFLTNB** oDynamicDataManager::m2p_listPMotionWeightInFrame
private

For each frame, this list contain the weight of each patient motion subset in terms of duration (for LMS)

Definition at line 352 of file oDynamicDataManager.hh.

◆ m2p_nbEventsPerCardGate

int64_t** oDynamicDataManager::m2p_nbEventsPerCardGate
private

2 dimensional array [nb frames][nb resp gates] containing the number of events in each cardiac gates.

Definition at line 337 of file oDynamicDataManager.hh.

◆ m2p_nbEventsPerRespGate

int64_t** oDynamicDataManager::m2p_nbEventsPerRespGate
private

2 dimensional array [nb frames][nb resp gates] containing the number of events in each respiratory gates

Definition at line 329 of file oDynamicDataManager.hh.

◆ m_cardGatingFlag

bool oDynamicDataManager::m_cardGatingFlag
private

Flag indicating if cardiac gating is enabled

Definition at line 334 of file oDynamicDataManager.hh.

◆ m_cMotionCorrFlag

bool oDynamicDataManager::m_cMotionCorrFlag
private

Flag indicating if patient involuntary motion correction is enabled

Definition at line 335 of file oDynamicDataManager.hh.

◆ m_gateDurationProvidedFlag

bool oDynamicDataManager::m_gateDurationProvidedFlag
private

Flag indicating that gate duration have been provided (default: false)

Definition at line 343 of file oDynamicDataManager.hh.

◆ m_nbCardGates

int oDynamicDataManager::m_nbCardGates
private

Number of gates for cardiac motion correction

Definition at line 336 of file oDynamicDataManager.hh.

◆ m_nbPMotionTriggers

int oDynamicDataManager::m_nbPMotionTriggers
private

Total number of triggers for patient involuntary motion correction

Definition at line 347 of file oDynamicDataManager.hh.

◆ m_nbRespGates

int oDynamicDataManager::m_nbRespGates
private

Number of gates for respiratory motion correction

Definition at line 328 of file oDynamicDataManager.hh.

◆ m_nbTimeFrames

int oDynamicDataManager::m_nbTimeFrames
private

Number of time frames

Definition at line 323 of file oDynamicDataManager.hh.

◆ m_pMotionCorrFlag

bool oDynamicDataManager::m_pMotionCorrFlag
private

Flag indicating if patient involuntary motion correction is enabled

Definition at line 346 of file oDynamicDataManager.hh.

◆ m_respGatingFlag

bool oDynamicDataManager::m_respGatingFlag
private

Flag indicating if respiratory gating is enabled

Definition at line 326 of file oDynamicDataManager.hh.

◆ m_rMotionCorrFlag

bool oDynamicDataManager::m_rMotionCorrFlag
private

Flag indicating if respiratory motion correction is enabled

Definition at line 327 of file oDynamicDataManager.hh.

◆ m_verbose

int oDynamicDataManager::m_verbose
private

Verbosity

Definition at line 319 of file oDynamicDataManager.hh.

◆ mp_currentCardGateIndex

int* oDynamicDataManager::mp_currentCardGateIndex
private

Multithreaded array [nb threads] containing the index of the current cardiac gate in use

Definition at line 339 of file oDynamicDataManager.hh.

◆ mp_currentFrameIndex

int* oDynamicDataManager::mp_currentFrameIndex
private

Multithreaded array [nb threads] containing the index of the current frame in use

Definition at line 322 of file oDynamicDataManager.hh.

◆ mp_currentPMotionIndex

int* oDynamicDataManager::mp_currentPMotionIndex
private

Multithreaded array [nb threads] containing the index for patient involuntary motion correction

Definition at line 353 of file oDynamicDataManager.hh.

◆ mp_currentRespGateIndex

int* oDynamicDataManager::mp_currentRespGateIndex
private

Multithreaded array [nb threads] containing the index of the current respiratory gate in use

Definition at line 331 of file oDynamicDataManager.hh.

◆ mp_frameNbPMotionTriggers

uint16_t* oDynamicDataManager::mp_frameNbPMotionTriggers
private

Number of patient involuntary motion triggers by frame

Definition at line 350 of file oDynamicDataManager.hh.

◆ mp_framePMotionFirstIndex

uint16_t* oDynamicDataManager::mp_framePMotionFirstIndex
private

First index of patient involuntary motion triggers by frame (for LMS)

Definition at line 348 of file oDynamicDataManager.hh.

◆ mp_framePMotionLastIndex

uint16_t* oDynamicDataManager::mp_framePMotionLastIndex
private

First index of patient involuntary motion triggers by frame (for LMS)

Definition at line 349 of file oDynamicDataManager.hh.

◆ mp_ID

oImageDimensionsAndQuantification* oDynamicDataManager::mp_ID
private

Pointer to the oImageDimensionsAndQuantification object

Definition at line 318 of file oDynamicDataManager.hh.

◆ mp_listPMotionTriggers

uint32_t* oDynamicDataManager::mp_listPMotionTriggers
private

Array containing the timestamp of each trigger of the patient involuntary motion correction

Definition at line 351 of file oDynamicDataManager.hh.


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