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

RCP-GS : Random Clustering Prior - Gibbs Sampler. More...

#include <iRCPGSAlgorithm.hh>

Inheritance diagram for iRCPGSAlgorithm:
Inheritance graph
Collaboration diagram for iRCPGSAlgorithm:
Collaboration graph

Public Member Functions

 iRCPGSAlgorithm ()
 
 ~iRCPGSAlgorithm ()
 
int InitSpecificOptions (string a_specificOptions)
 
void ShowHelpSpecific ()
 Show help for the child algorithm. More...
 
- Public Member Functions inherited from vAlgorithm
 vAlgorithm ()
 vAlgorithm constructor. Initialize the member variables to their default values. More...
 
virtual ~vAlgorithm ()
 vAlgorithm destructor. More...
 
int Run ()
 Just call either the RunCPU or the RunGPU function as asked for. More...
 
int RunCPU ()
 Perform the iterative loop of the algorithm. Function designed to be executed on the CPU only. More...
 
void SetSaveSensitivityHistoFlag (bool a_saveSensitivityHistoFlag)
 Set the flag that specifies if the sensitivity image in histogram mode has to be saved for each subset/iteration. More...
 
void SetSaveSubsetImageFlag (bool a_saveImageAfterSubsets)
 Set the flag that specifies if the image has to be saved for each subset. More...
 
void SetSaveDynamicBasisCoefficientImages (bool a_saveDynamicBasisCoefficients)
 Set the flag that specifies if the dynamic basis functions coefficients images have to be saved. More...
 
void SetOptimizerManager (oOptimizerManager *ap_OptimizerManager)
 Set the Optimizer Manager Object. More...
 
void SetImageDimensionsAndQuantification (oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
 Set the Image Dimensions and Quantification Object. More...
 
void SetImageSpace (oImageSpace *ap_ImageSpace)
 Set the Image Space Object. More...
 
void SetProjectorManager (oProjectorManager *ap_ProjectorManager)
 Set the Projector Manager Object. More...
 
void SetImageConvolverManager (oImageConvolverManager *ap_ImageConvolverManager)
 Set the Image Convolver Manager Object. More...
 
void SetImageProcessingManager (oImageProcessingManager *ap_ImageProcessingManager)
 Set the Image Processing Manager Object. More...
 
void SetDynamicModelManager (oDynamicModelManager *ap_DynamicModelManager)
 Set the Dynamic Model Manager Object. More...
 
void SetDeformationManager (oDeformationManager *ap_DeformationManager)
 Set the Deformation Manager Object. More...
 
void SetDataFile (vDataFile **a2p_DataFile)
 Set the list of DataFile. More...
 
void SetGPUflag (bool a_flagGPU)
 Set the GPU flag. More...
 
void SetVerbose (int a_verboseLevel)
 Set Verbosity. More...
 
void SetNbBeds (int a_nbBeds)
 Set number of beds (bed positions) More...
 
void SetPathInitImage (string a_pathToInitialImage)
 Set path to an initial image. More...
 
void SetPathToAttenuationImage (string a_pathToAttenuationImage)
 This function is used to set the path to the attenuation image. More...
 
void SetPathToSensitivityImage (string a_pathToSensitivityImage)
 Set path to the sensitivity image. More...
 
void SetPathToMultiModalImage (vector< string > a_pathToMultiModalImage)
 Set path to multimodal images. More...
 
void SetPathToMaskImage (string a_pathToMaskImage)
 Set path to a mask image. More...
 
int SetNbIterationsAndSubsets (const string &a_nbIterationsSubsets)
 Set the number of iterations and subsets. More...
 
int SetOutputIterations (const string &a_outputIterations)
 Set the selected output iterations. More...
 

Protected Member Functions

int StepBeforeIterationLoop ()
 This function is called at the beginning of the RunCPU function. More...
 
int StepAfterIterationLoop ()
 This function is called at the end of the RunCPU function. More...
 
int StepBeforeSubsetLoop (int a_iteration)
 This function is called before starting the data subset loop. More...
 
int StepAfterSubsetLoop (int a_iteration)
 This function is called after finishing the data subset loop. More...
 
int StepPreProcessInsideSubsetLoop (int a_iteration, int a_subset)
 This function is called right after starting the data subset loop. More...
 
int StepInnerLoopInsideSubsetLoop (int a_iteration, int a_subset, int a_bed)
 This function is called inside the subset loop.
It contains the core operations of the algorithm and must be implemented by child classes. More...
 
int StepPostProcessInsideSubsetLoop (int a_iteration, int a_subset)
 
int StepImageOutput (int a_iteration, int a_subset=-1)
 This function deals with everything about saving output images from the reconstruction. More...
 
int ReadConfigurationFile (const string &a_configurationFile)
 

Private Member Functions

int SampleConditionalCompleteData (int a_iteration, int a_subset, int a_bed)
 Gibbs sampler : first conditional probability (backprojection) More...
 
int SampleConditionalClustering (int a_iteration)
 Gibbs sampler : second conditional probability (ddCRP links) More...
 
int SampleConditionalClusterIntensity ()
 Gibbs sampler : third conditional probability (cluster intensity) More...
 
int UpdateVisitedVoxels ()
 Check for voxels which do not contribute to recorded observed data. More...
 
int InitializeHelperVar ()
 Allocate and initialize temporary variables, after the main variables have been initialized Assumption : the initial image and the sensitivity image have already been initialized. More...
 
int ProcessMultiModalInfo ()
 Check input multimodal images. More...
 
int GenerateCurrentImage ()
 Generate the current image estimation from the current sample of partition/clustering and cluster intensities. More...
 
int ComputeFellowVoxelsList (vector< INTNB > &a_fellow_voxels, int a_current_voxel)
 Fill the input list of fellow voxels for the current type of neighbourhood and the input voxel, for ddCRP. More...
 
int ComputeSumsPerClusters (int a_iteration)
 Compute sums of voxel features for each cluster. More...
 
int SaveIntermediaryData (int a_iteration)
 Save potentially useful by-product variables specific to this algorithm. More...
 

Private Attributes

int m_ddCRP
 
int m_backprojection
 
int m_neighbourhood
 
HPFLTNB m_gammaShape
 
HPFLTNB m_gammaRate
 
HPFLTNB m_ddcrpAlpha
 
INTNB m_multiModalLag
 
HPFLTNB m_ddcrpAlphaIncrement
 
HPFLTNBmp_multiModalNoiseSigma
 
HPFLTNBmp_multiModalParam
 
INTNBmp_voxelClusterMapping
 
HPFLTNBmp_clusterValues
 
HPFLTNB ** mp_clusterN
 
HPFLTNBmp_clusterSensitivity
 
HPFLTNB ** mpp_clusterMultiModal
 
INTNBmp_clusterCount
 
INTNBmp_nextLink
 
vector< INTNB > * mpv_parentLinks
 
vector< INTNBmv_newClusters
 
INTNBmp_listVoxelIndices
 
INTNB ** mp_listEventsIndices
 
INTNB **** m4p_EventsBackprojectionTrace
 
bool * mp_listRelevantVoxelIndices
 
HPFLTNBtemp_count_multimodal
 
HPFLTNB m_ddcrpLogAlpha
 
HPFLTNB m_currentMeanClusterVolume
 
HPFLTNB m_meanClusterVolumeMin
 
HPFLTNB m_meanClusterVolumeMax
 
FLTNBmp_permanentBackwardImage
 

Additional Inherited Members

- Protected Attributes inherited from vAlgorithm
int m_nbIterations
 
int * mp_nbSubsets
 
bool * mp_outputIterations
 
int m_verbose
 
bool m_flagGPU
 
oImageDimensionsAndQuantificationmp_ID
 
vDataFile ** m2p_DataFile
 
oProjectorManagermp_ProjectorManager
 
oOptimizerManagermp_OptimizerManager
 
oDeformationManagermp_DeformationManager
 
oDynamicModelManagermp_DynamicModelManager
 
oImageSpacemp_ImageSpace
 
oImageConvolverManagermp_ImageConvolverManager
 
oImageProcessingManagermp_ImageProcessingManager
 
int m_nbBeds
 
string m_pathToInitialImg
 
string m_pathToAtnImg
 
string m_pathToSensitivityImg
 
vector< string > m_pathToMultiModalImg
 
string m_pathToMaskImg
 
bool m_saveSensitivityHistoFlag
 
bool m_saveImageAfterSubsets
 
bool m_saveDynamicBasisCoefficients
 

Detailed Description

RCP-GS : Random Clustering Prior - Gibbs Sampler.

Sampling of the posterior probability distribution (Bayesian inference) Image prior : ddCRP, with intensity ~ Gamma (conjugate prior for Poisson likelihood) Multinomial distribution for the backprojection from acquired data into (latent) emissions from voxel j into projection i

Definition at line 42 of file iRCPGSAlgorithm.hh.

Constructor & Destructor Documentation

◆ iRCPGSAlgorithm()

iRCPGSAlgorithm::iRCPGSAlgorithm ( )

Definition at line 34 of file iRCPGSAlgorithm.cc.

◆ ~iRCPGSAlgorithm()

iRCPGSAlgorithm::~iRCPGSAlgorithm ( )

Definition at line 67 of file iRCPGSAlgorithm.cc.

Here is the call graph for this function:

Member Function Documentation

◆ ComputeFellowVoxelsList()

int iRCPGSAlgorithm::ComputeFellowVoxelsList ( vector< INTNB > &  a_fellow_voxels,
int  a_current_voxel 
)
private

Fill the input list of fellow voxels for the current type of neighbourhood and the input voxel, for ddCRP.

Returns
0 if success, positive value otherwise.

Definition at line 1790 of file iRCPGSAlgorithm.cc.

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

◆ ComputeSumsPerClusters()

int iRCPGSAlgorithm::ComputeSumsPerClusters ( int  a_iteration)
private

Compute sums of voxel features for each cluster.

Returns
0 if success, positive value otherwise.

Definition at line 1356 of file iRCPGSAlgorithm.cc.

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

◆ GenerateCurrentImage()

int iRCPGSAlgorithm::GenerateCurrentImage ( )
private

Generate the current image estimation from the current sample of partition/clustering and cluster intensities.

Returns
0 if success, positive value otherwise.

Definition at line 1852 of file iRCPGSAlgorithm.cc.

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

◆ InitializeHelperVar()

int iRCPGSAlgorithm::InitializeHelperVar ( )
private

Allocate and initialize temporary variables, after the main variables have been initialized Assumption : the initial image and the sensitivity image have already been initialized.

Returns
0 if success, positive value otherwise.

Definition at line 543 of file iRCPGSAlgorithm.cc.

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

◆ InitSpecificOptions()

int iRCPGSAlgorithm::InitSpecificOptions ( string  a_specificOptions)
virtual
Parameters
a_specificOptions
Returns
0

Reimplemented from vAlgorithm.

Definition at line 158 of file iRCPGSAlgorithm.cc.

Here is the call graph for this function:

◆ ProcessMultiModalInfo()

int iRCPGSAlgorithm::ProcessMultiModalInfo ( )
private

Check input multimodal images.

Returns
0 if success, positive value otherwise.

Definition at line 688 of file iRCPGSAlgorithm.cc.

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

◆ ReadConfigurationFile()

int iRCPGSAlgorithm::ReadConfigurationFile ( const string &  a_configurationFile)
protected

Definition at line 463 of file iRCPGSAlgorithm.cc.

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

◆ SampleConditionalClustering()

int iRCPGSAlgorithm::SampleConditionalClustering ( int  a_iteration)
private

Gibbs sampler : second conditional probability (ddCRP links)

Returns
0 if success, positive value otherwise.

Definition at line 1441 of file iRCPGSAlgorithm.cc.

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

◆ SampleConditionalClusterIntensity()

int iRCPGSAlgorithm::SampleConditionalClusterIntensity ( )
private

Gibbs sampler : third conditional probability (cluster intensity)

Returns
0 if success, positive value otherwise.

Definition at line 1738 of file iRCPGSAlgorithm.cc.

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

◆ SampleConditionalCompleteData()

int iRCPGSAlgorithm::SampleConditionalCompleteData ( int  a_iteration,
int  a_subset,
int  a_bed 
)
private

Gibbs sampler : first conditional probability (backprojection)

Returns
0 if success, positive value otherwise.

Definition at line 912 of file iRCPGSAlgorithm.cc.

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

◆ SaveIntermediaryData()

private int iRCPGSAlgorithm::SaveIntermediaryData ( int  a_iteration)
private

Save potentially useful by-product variables specific to this algorithm.

Returns
0 if success, positive value otherwise.

◆ ShowHelpSpecific()

void iRCPGSAlgorithm::ShowHelpSpecific ( )
virtual

Show help for the child algorithm.

Reimplemented from vAlgorithm.

Definition at line 2031 of file iRCPGSAlgorithm.cc.

Here is the caller graph for this function:

◆ StepAfterIterationLoop()

int iRCPGSAlgorithm::StepAfterIterationLoop ( )
protectedvirtual

This function is called at the end of the RunCPU function.

Returns
0 if success, positive value otherwise.

Reimplemented from vAlgorithm.

Definition at line 1879 of file iRCPGSAlgorithm.cc.

Here is the call graph for this function:

◆ StepAfterSubsetLoop()

int iRCPGSAlgorithm::StepAfterSubsetLoop ( int  a_iteration)
protectedvirtual

This function is called after finishing the data subset loop.

Parameters
a_iteration: iteration index
Returns
0 if success, positive value otherwise.

Reimplemented from vAlgorithm.

Definition at line 1910 of file iRCPGSAlgorithm.cc.

Here is the call graph for this function:

◆ StepBeforeIterationLoop()

int iRCPGSAlgorithm::StepBeforeIterationLoop ( )
protectedvirtual

This function is called at the beginning of the RunCPU function.

Returns
0 if success, positive value otherwise.

Reimplemented from vAlgorithm.

Definition at line 715 of file iRCPGSAlgorithm.cc.

Here is the call graph for this function:

◆ StepBeforeSubsetLoop()

int iRCPGSAlgorithm::StepBeforeSubsetLoop ( int  a_iteration)
protectedvirtual

This function is called before starting the data subset loop.

Parameters
a_iteration: iteration index
Returns
0 if success, positive value otherwise.

Reimplemented from vAlgorithm.

Definition at line 1899 of file iRCPGSAlgorithm.cc.

◆ StepImageOutput()

int iRCPGSAlgorithm::StepImageOutput ( int  a_iteration,
int  a_subset = -1 
)
protectedvirtual

This function deals with everything about saving output images from the reconstruction.

Implements vAlgorithm.

Definition at line 1938 of file iRCPGSAlgorithm.cc.

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

◆ StepInnerLoopInsideSubsetLoop()

int iRCPGSAlgorithm::StepInnerLoopInsideSubsetLoop ( int  a_iteration,
int  a_subset,
int  a_bed 
)
protectedvirtual

This function is called inside the subset loop.
It contains the core operations of the algorithm and must be implemented by child classes.

Parameters
a_iteration: iteration index
a_subset: subset index
a_bed: bed position
Returns
0 if success, positive value otherwise.

Implements vAlgorithm.

Definition at line 776 of file iRCPGSAlgorithm.cc.

Here is the call graph for this function:

◆ StepPostProcessInsideSubsetLoop()

int iRCPGSAlgorithm::StepPostProcessInsideSubsetLoop ( int  a_iteration,
int  a_subset 
)
protectedvirtual

Reimplemented from vAlgorithm.

Definition at line 792 of file iRCPGSAlgorithm.cc.

Here is the call graph for this function:

◆ StepPreProcessInsideSubsetLoop()

int iRCPGSAlgorithm::StepPreProcessInsideSubsetLoop ( int  a_iteration,
int  a_subset 
)
protectedvirtual

This function is called right after starting the data subset loop.

This function is called right after starting the subset loop.
.

Parameters
a_iteration: iteration index
a_subset: subset index
Returns
0 if success, positive value otherwise.

Reimplemented from vAlgorithm.

Definition at line 760 of file iRCPGSAlgorithm.cc.

Here is the call graph for this function:

◆ UpdateVisitedVoxels()

int iRCPGSAlgorithm::UpdateVisitedVoxels ( )
private

Check for voxels which do not contribute to recorded observed data.

Returns
0 if success, positive value otherwise.

Definition at line 1420 of file iRCPGSAlgorithm.cc.

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

Member Data Documentation

◆ m4p_EventsBackprojectionTrace

INTNB**** iRCPGSAlgorithm::m4p_EventsBackprojectionTrace
private

Trace of the backprojection destination for each observed count at previous iteration, Number of beds x Number of events x Number of TOF bins x Number of counts

Definition at line 158 of file iRCPGSAlgorithm.hh.

◆ m_backprojection

int iRCPGSAlgorithm::m_backprojection
private

flag describing the multinomial backprojection of the current iteration/subset data (sampling of conditional complete data): 0 = the previous backprojection state is cleared, as for ML-EM 1 = update of the previous backprojection state 2 = backprojection marginalized over cluster intensity, implies update of the previous backprojection state

Definition at line 133 of file iRCPGSAlgorithm.hh.

◆ m_currentMeanClusterVolume

HPFLTNB iRCPGSAlgorithm::m_currentMeanClusterVolume
private

helper variable for the average cluster volume after each iteration/subset

Definition at line 163 of file iRCPGSAlgorithm.hh.

◆ m_ddCRP

int iRCPGSAlgorithm::m_ddCRP
private

flag describing the ddCRP prior : 0 = no ddCRP, 1 = original ddCRP, 2 = modified ddCRP

Definition at line 132 of file iRCPGSAlgorithm.hh.

◆ m_ddcrpAlpha

HPFLTNB iRCPGSAlgorithm::m_ddcrpAlpha
private

ddCRP : the unnormalized probability of drawing a self link

Definition at line 140 of file iRCPGSAlgorithm.hh.

◆ m_ddcrpAlphaIncrement

HPFLTNB iRCPGSAlgorithm::m_ddcrpAlphaIncrement
private

Multiplicative increment for optimizing the ddCRP alpha parameter through iterations

Definition at line 142 of file iRCPGSAlgorithm.hh.

◆ m_ddcrpLogAlpha

HPFLTNB iRCPGSAlgorithm::m_ddcrpLogAlpha
private

helper variable for precomputed log of ddCRP : the probability of drawing a self link (not normalized)

Definition at line 162 of file iRCPGSAlgorithm.hh.

◆ m_gammaRate

HPFLTNB iRCPGSAlgorithm::m_gammaRate
private

Gamma prior distribution rate parameter

Definition at line 139 of file iRCPGSAlgorithm.hh.

◆ m_gammaShape

HPFLTNB iRCPGSAlgorithm::m_gammaShape
private

Gamma prior distribution shape parameter

Definition at line 138 of file iRCPGSAlgorithm.hh.

◆ m_meanClusterVolumeMax

HPFLTNB iRCPGSAlgorithm::m_meanClusterVolumeMax
private

Maximum threshold for average cluster volume (in mm3), used for adapting ddCRP alpha automatically through iterations

Definition at line 165 of file iRCPGSAlgorithm.hh.

◆ m_meanClusterVolumeMin

HPFLTNB iRCPGSAlgorithm::m_meanClusterVolumeMin
private

Minimum threshold for average cluster volume (in mm3), used for adapting ddCRP alpha automatically through iterations

Definition at line 164 of file iRCPGSAlgorithm.hh.

◆ m_multiModalLag

INTNB iRCPGSAlgorithm::m_multiModalLag
private

Number of iterations after which the multimodal images start affecting voxels clustering

Definition at line 141 of file iRCPGSAlgorithm.hh.

◆ m_neighbourhood

int iRCPGSAlgorithm::m_neighbourhood
private

Number of voxels in the neighbourhood

Definition at line 137 of file iRCPGSAlgorithm.hh.

◆ mp_clusterCount

INTNB* iRCPGSAlgorithm::mp_clusterCount
private

Number of voxels per cluster

Definition at line 152 of file iRCPGSAlgorithm.hh.

◆ mp_clusterN

HPFLTNB** iRCPGSAlgorithm::mp_clusterN
private

Ns : sum over cluster voxels and all LORs of latent backprojected variable (complete data), requires HPFLTNB precision, can be threaded

Definition at line 149 of file iRCPGSAlgorithm.hh.

◆ mp_clusterSensitivity

HPFLTNB* iRCPGSAlgorithm::mp_clusterSensitivity
private

Sensitivity : sum over cluster voxels and all LORs of system matrix components, requires HPFLTNB precision

Definition at line 150 of file iRCPGSAlgorithm.hh.

◆ mp_clusterValues

HPFLTNB* iRCPGSAlgorithm::mp_clusterValues
private

Values (here voxel intensities) associated with each cluster

Definition at line 148 of file iRCPGSAlgorithm.hh.

◆ mp_listEventsIndices

INTNB** iRCPGSAlgorithm::mp_listEventsIndices
private

List of events indices, per bed, used for random shuffling

Definition at line 157 of file iRCPGSAlgorithm.hh.

◆ mp_listRelevantVoxelIndices

bool* iRCPGSAlgorithm::mp_listRelevantVoxelIndices
private

Indices of voxels which will be taken into account in the algorithm; all the other voxels are regarded as background and set to 0

Definition at line 160 of file iRCPGSAlgorithm.hh.

◆ mp_listVoxelIndices

INTNB* iRCPGSAlgorithm::mp_listVoxelIndices
private

List of voxel indices, used for random shuffling

Definition at line 156 of file iRCPGSAlgorithm.hh.

◆ mp_multiModalNoiseSigma

HPFLTNB* iRCPGSAlgorithm::mp_multiModalNoiseSigma
private

Standard deviation of Gaussian noise in multimodal images

Definition at line 144 of file iRCPGSAlgorithm.hh.

◆ mp_multiModalParam

HPFLTNB* iRCPGSAlgorithm::mp_multiModalParam
private

Parameter for the standard deviation of the prior on multimodal images

Definition at line 145 of file iRCPGSAlgorithm.hh.

◆ mp_nextLink

INTNB* iRCPGSAlgorithm::mp_nextLink
private

Mapping : voxel index -> next voxel index (link from this voxel to another voxel)

Definition at line 153 of file iRCPGSAlgorithm.hh.

◆ mp_permanentBackwardImage

FLTNB* iRCPGSAlgorithm::mp_permanentBackwardImage
private

A buffer image used for holding the complete up-to-date backward image at any time. It is updated at each iteration/subset, and used in backprojection modes 1 and 2

Definition at line 166 of file iRCPGSAlgorithm.hh.

◆ mp_voxelClusterMapping

INTNB* iRCPGSAlgorithm::mp_voxelClusterMapping
private

Mapping : voxel index -> cluster index

Definition at line 147 of file iRCPGSAlgorithm.hh.

◆ mpp_clusterMultiModal

HPFLTNB** iRCPGSAlgorithm::mpp_clusterMultiModal
private

Multimodal image(s) : sum over cluster voxels, requires HPFLTNB precision

Definition at line 151 of file iRCPGSAlgorithm.hh.

◆ mpv_parentLinks

vector<INTNB>* iRCPGSAlgorithm::mpv_parentLinks
private

Mapping : voxel index -> list of previous voxels (links from other voxels to this voxel)

Definition at line 154 of file iRCPGSAlgorithm.hh.

◆ mv_newClusters

vector<INTNB> iRCPGSAlgorithm::mv_newClusters
private

Indices of free available (empty) clusters (the number of clusters <= the number of voxels + 1)

Definition at line 155 of file iRCPGSAlgorithm.hh.

◆ temp_count_multimodal

HPFLTNB* iRCPGSAlgorithm::temp_count_multimodal
private

helper variable for the second sampling step, just to avoid allocating repeatedly >

Definition at line 161 of file iRCPGSAlgorithm.hh.


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