CASToR
3.0
Tomographic Reconstruction (PET/SPECT/CT)
|
This is the mother class of dynamic model classes. More...
#include <vDynamicModel.hh>
Public Member Functions | |
vDynamicModel () | |
Constructor of vDynamicModel. Simply set all data members to default values. More... | |
virtual | ~vDynamicModel () |
Destructor of vDynamicModel. More... | |
void | SetImageDimensionsAndQuantification (oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification) |
Set the image dimensions in use. More... | |
void | SetVerbose (int a_verbose) |
Set the verbose level. More... | |
virtual int | CheckParameters () |
This function is used to check parameters after the latter have been all set using Set functions. More... | |
virtual int | CheckSpecificParameters ()=0 |
This function is used to check the parameters of the child functions before initialization if required. More... | |
int | ReadAndCheckConfigurationFile (string a_fileOptions) |
This function is used to read options from a configuration file. It looks for the parameters implemented by the mother class, such as 'No image update', 'No parameters update', or 'Save parametric images'. More... | |
virtual int | ReadAndCheckConfigurationFileSpecific ()=0 |
This function is used to read options from a configuration file. It is pure virtual so must be implemented by children. More... | |
virtual int | ReadAndCheckOptionsList (string a_listOptions)=0 |
This function is used to read parameters from a string. It is pure virtual so must be implemented by children. More... | |
int | Initialize () |
A public function used to initialize the dynamic model. More... | |
virtual int | InitializeSpecific ()=0 |
A private function used to initialize everything specific to the child model. More... | |
virtual void | ShowHelp ()=0 |
This function is used to print out specific help about the deformation and its options. It is pure virtual so must be implemented by children. More... | |
virtual int | EstimateModel (oImageSpace *ap_Image, int a_ite, int a_sset) |
This function checks if the EstimateModelParameters() function (specific to each model) must be called at this stage of the reconstruction depending on the m_xxxUpdateflags. More... | |
virtual int | EstimateModelParameters (oImageSpace *ap_Image, int a_ite, int a_sset)=0 |
This function is pure virtual so must be implemented by children. It can be used to estimate any temporal functions or coefficients related to the dynamic model, if required. More... | |
virtual int | EstimateImage (oImageSpace *ap_Image, int a_ite, int a_sset) |
virtual int | EstimateImageWithModel (oImageSpace *ap_Image, int a_ite, int a_sset)=0 |
This function checks if the EstimateImageWithModel() function (specific to each model) must be called at this stage of the reconstruction depending on the m_xxxUpdateflags. More... | |
int | SaveParametricImages (int a_iteration, int a_subset=-1) |
This function is virtual it can be overloaded by children if required. More... | |
virtual int | ApplyOutputFOVMaskingOnParametricImages () |
Mask the outside of the transaxial FOV based on the m_fovOutPercent. More... | |
bool | GetAICflag () |
bool | GetModelBasisFunctionsRequiredFlag () |
int | GetNbTimeBasisFunctions () |
FLTNB ** | GetTimeBasisFunctions () |
virtual void | ComputeOutputParImage () |
Compute output image using the m2p_parametricImages matrix Store the result in the m2p_outputParImages matrix. More... | |
int | NNLS (FLTNB **A, int m, int n, FLTNB *B, FLTNB *X, FLTNB *rnorm, FLTNB *wp, FLTNB *zzp, int *indexp) |
Implementation of NNLS (non-negative least squares) algorithm Derived from Turku PET center libraries (authors: Vesa Oikonen and Kaisa Sederholm) This routine is based on the text and fortran code in C.L. Lawson and R.J. Hanson, Solving Least Squares Problems, Prentice-Hall, Englewood Cliffs, New Jersey, 1974. More... | |
Protected Attributes | |
oImageDimensionsAndQuantification * | mp_ID |
int | m_verbose |
int | m_nbTimeBF |
int | m_nbWeightFactors |
int | m_nbModelParam |
int | m_nbRGModelParam |
int | m_nbCGModelParam |
string | m_AICfile |
oArterialInputCurve * | mp_ArterialInputCurve |
FLTNB ** | m2p_parametricImages |
FLTNB * | mp_blackListedvoxelsImage |
FLTNB ** | m2p_nestedModelTimeBasisFunctions |
FLTNB ** | m2p_outputParImages |
FLTNB ** | m2p_RGParametricImages |
FLTNB ** | m2p_CGParametricImages |
string | m_fileOptions |
string | m_listOptions |
bool | m_checked |
bool | m_initialized |
bool | m_saveParImageFlag |
bool | m_saveBlacklistedImageMaskFlag |
bool | m_AICfileProvided |
bool | m_ModelSpecificBasisFunctionsRequired |
bool | m_noImageUpdateFlag |
bool | m_noParametersUpdateFlag |
int | m_startIteUpdateFlag |
FLTNB * | mp_maskModel |
INTNB | m_nbVoxelsMask |
FLTNB * | mp_w |
FLTNB *** | m3p_nnlsA |
FLTNB ** | m2p_nnlsB |
FLTNB ** | m2p_nnlsMat |
FLTNB ** | m2p_nnlsX |
FLTNB ** | m2p_nnlsWp |
int ** | m2p_nnlsIdx |
uint16_t | m_nnlsN =0 |
Private Member Functions | |
int | NNLS_LSS_H12 (int mode, int lpivot, int l1, int m, FLTNB *u, int u_dim1, FLTNB *up, FLTNB *cm, int ice, int icv, int ncv) |
void | NNLS_LSS_G1 (FLTNB a, FLTNB b, FLTNB *cterm, FLTNB *sterm, FLTNB *sig) |
This function is used by the NNLS function() Construction and/or application of a single Householder transformation: Q = I + U*(U**T)/B Derived from Turku PET center libraries (authors: Vesa Oikonen and Kaisa Sederholm) This routine is based on the text and fortran code in C.L. Lawson and R.J. Hanson, Solving Least Squares Problems, Prentice-Hall, Englewood Cliffs, New Jersey, 1974. More... | |
This is the mother class of dynamic model classes.
This class is a virtual one, in the sense that it cannot be used on its own
because several pure virtual functions belong to it. Its children are implementations of actual dynamic models.
Everywhere in the code, this parent class should be used instead of any of its children.
It can be used during the reconstruction process by the oDynamicModelManager through the use of the EstimateModelParameters() and EstimateImageWithModel() functions
All children must implement the following pure virtual functions:
Definition at line 62 of file vDynamicModel.hh.
vDynamicModel::vDynamicModel | ( | ) |
Constructor of vDynamicModel. Simply set all data members to default values.
Definition at line 40 of file vDynamicModel.cc.
|
virtual |
Destructor of vDynamicModel.
Definition at line 89 of file vDynamicModel.cc.
|
virtual |
Mask the outside of the transaxial FOV based on the m_fovOutPercent.
Similar to the eponym function in ImageSpace, but on parametric images
Definition at line 300 of file vDynamicModel.cc.
|
virtual |
This function is used to check parameters after the latter have been all set using Set functions.
Definition at line 120 of file vDynamicModel.cc.
|
pure virtual |
This function is used to check the parameters of the child functions before initialization if required.
It could be overloaded by the child if needed. Default implementation is empty and return 0.
Implemented in i1TCModel, iLinearModel, iLinearModelTemplate, iLinearPatlakModel, iLinearSpectralModel, and iDynamicModelTemplate.
|
virtual |
Compute output image using the m2p_parametricImages matrix Store the result in the m2p_outputParImages matrix.
Definition at line 265 of file vDynamicModel.cc.
|
virtual |
Definition at line 452 of file vDynamicModel.cc.
|
pure virtual |
This function checks if the EstimateImageWithModel() function (specific to each model) must be called at this stage of the reconstruction depending on the m_xxxUpdateflags.
This function is pure virtual so must be implemented by children.
It is used to fit the dynamic model to the series of dynamic images.
ap_ImageS | : pointer to the ImageSpace |
a_ite | : index of the actual iteration |
a_sset | : index of the actual subset |
Implemented in iLinearModel, i1TCModel, and iDynamicModelTemplate.
|
virtual |
This function checks if the EstimateModelParameters() function (specific to each model) must be called at this stage of the reconstruction depending on the m_xxxUpdateflags.
ap_ImageS | : pointer to the ImageSpace |
a_ite | : index of the actual iteration |
a_sset | : index of the actual subset |
Definition at line 414 of file vDynamicModel.cc.
|
pure virtual |
This function is pure virtual so must be implemented by children.
It can be used to estimate any temporal functions or coefficients related to the dynamic model, if required.
ap_ImageS | : pointer to the ImageSpace |
a_ite | : index of the actual iteration |
a_sset | : index of the actual subset |
Implemented in iLinearModel, i1TCModel, and iDynamicModelTemplate.
|
inline |
Definition at line 225 of file vDynamicModel.hh.
|
inline |
|
inline |
|
inline |
Definition at line 240 of file vDynamicModel.hh.
int vDynamicModel::Initialize | ( | ) |
A public function used to initialize the dynamic model.
This function does not take any parameter and is used to initialize everything that is generic and required for all models. At the end, it calls the pure virtual InitializeSpecific() function implemented by children models.
Definition at line 187 of file vDynamicModel.cc.
|
pure virtual |
A private function used to initialize everything specific to the child model.
This function is used to initialize everything specific to the model that should be initialized. It is called by the Initialize() function. It is pure virtual so is implemented only by children.
Implemented in iLinearModel, i1TCModel, iLinearModelTemplate, iLinearPatlakModel, iLinearSpectralModel, and iDynamicModelTemplate.
int vDynamicModel::NNLS | ( | FLTNB ** | A, |
int | m, | ||
int | n, | ||
FLTNB * | B, | ||
FLTNB * | X, | ||
FLTNB * | rnorm, | ||
FLTNB * | wp, | ||
FLTNB * | zzp, | ||
int * | indexp | ||
) |
Implementation of NNLS (non-negative least squares) algorithm Derived from Turku PET center libraries (authors: Vesa Oikonen and Kaisa Sederholm) This routine is based on the text and fortran code in C.L. Lawson and R.J. Hanson, Solving Least Squares Problems, Prentice-Hall, Englewood Cliffs, New Jersey, 1974.
a | : On entry, a[ 0... N ][ 0 ... M ] contains the M by N matrix A. On exit, a[][] contains the product matrix Q*A, where Q is an m by n orthogonal matrix generated implicitly by this function. |
m | : Matrix dimension m |
n | : Matrix dimension n |
b | : On entry, b[] must contain the m-vector B. On exit, b[] contains Q*B |
x | : On exit, x[] will contain the solution vector |
rnorm | : On exit, rnorm contains the Euclidean norm of the residual vector. If NULL is given, no rnorm is calculated |
wp | An n-array of working space, wp[]. On exit, wp[] will contain the dual solution vector. wp[i]=0.0 for all i in set p and wp[i]<=0.0 for all i in set z. Can be NULL, which causes this algorithm to allocate memory for it. |
zzp | : An m-array of working space, zz[]. Can be NULL, which causes this algorithm to allocate memory for it. |
indexp | : An n-array of working space, index[]. Can be NULL, which causes this algorithm to allocate memory for it. * |
Given an m by n matrix A, and an m-vector B, computes an n-vector X, that solves the least squares problem A * X = B , subject to X>=0
Instead of pointers for working space, NULL can be given to let this function to allocate and free the required memory.
Definition at line 836 of file vDynamicModel.cc.
|
private |
This function is used by the NNLS function() Construction and/or application of a single Householder transformation: Q = I + U*(U**T)/B Derived from Turku PET center libraries (authors: Vesa Oikonen and Kaisa Sederholm) This routine is based on the text and fortran code in C.L. Lawson and R.J. Hanson, Solving Least Squares Problems, Prentice-Hall, Englewood Cliffs, New Jersey, 1974.
This function is used by the NNLS function() Compute orthogonal rotation matrix: (C, S) so that (C, S)(A) = (sqrt(A**2+B**2)) (-S,C) (-S,C)(B) ( 0 ) sig is computed last to allow for the possibility that sig may be in the same location as A or B. Derived from Turku PET center libraries (authors: Vesa Oikonen and Kaisa Sederholm) This routine is based on the text and fortran code in C.L. Lawson and R.J. Hanson, Solving Least Squares Problems, Prentice-Hall, Englewood Cliffs, New Jersey, 1974.
mode | : mode=1 to construct and apply a Householder transformation, or mode=2 to apply a previously constructed transformation |
lpivot | Index of the pivot element, on pivot vector |
l1 | Transformation is constructed to zero elements indexed from l1 to M |
m | Transformation is constructed to zero elements indexed from l1 to M |
u | With mode=1: On entry, u[] must contain the pivot vector. On exit, u[] and up contain quantities defining the vector u[] of the Householder transformation. With mode=2: On entry, u[] and up should contain quantities previously computed with mode=1. These will not be modified |
u_dim1 | u_dim1 is the storage increment between elements |
up | with mode=1, here is stored an element defining housholder vector scalar, on mode=2 it's only used, and is not modified |
cm | On entry, cm[] must contain the matrix (set of vectors) to which the Householder transformation is to be applied. On exit, cm[] will contain the set of transformed vectors |
ice | Storage increment between elements of vectors in cm[] |
icv | Storage increment between vectors in cm[] |
nvc | Nr of vectors in cm[] to be transformed; if ncv<=0, then no operations will be done on cm[] |
a | |
b | |
cterm | |
sterm | |
sig | sig = sqrt(A**2+B**2) |
Definition at line 1251 of file vDynamicModel.cc.
int vDynamicModel::ReadAndCheckConfigurationFile | ( | string | a_fileOptions | ) |
This function is used to read options from a configuration file.
It looks for the parameters implemented by the mother class, such as 'No image update', 'No parameters update', or 'Save parametric images'.
const | string& a_configurationFile : ASCII file containing informations about a dynamic model |
Definition at line 490 of file vDynamicModel.cc.
|
pure virtual |
This function is used to read options from a configuration file.
It is pure virtual so must be implemented by children.
Implemented in i1TCModel, iLinearModel, iLinearModelTemplate, iLinearPatlakModel, iLinearSpectralModel, and iDynamicModelTemplate.
|
pure virtual |
This function is used to read parameters from a string.
It is pure virtual so must be implemented by children.
const | string& a_optionsList : a list of parameters separated by commas |
Implemented in i1TCModel, iLinearModel, iLinearModelTemplate, iLinearPatlakModel, iLinearSpectralModel, and iDynamicModelTemplate.
int vDynamicModel::SaveParametricImages | ( | int | a_iteration, |
int | a_subset = -1 |
||
) |
This function is virtual it can be overloaded by children if required.
a_iteration | : current iteration index |
a_subset | : current number of subsets (or -1 by default) |
Definition at line 654 of file vDynamicModel.cc.
|
inline |
Set the image dimensions in use.
ap_ImageDimensionsAndQuantification |
Definition at line 87 of file vDynamicModel.hh.
|
inline |
Set the verbose level.
a_verboseLevel |
Definition at line 94 of file vDynamicModel.hh.
|
pure virtual |
This function is used to print out specific help about the deformation and its options. It is pure virtual so must be implemented by children.
Implemented in iLinearModel, i1TCModel, iLinearModelTemplate, iLinearPatlakModel, iLinearSpectralModel, and iDynamicModelTemplate.
|
protected |
Image matrix containing the parametric images of the cardiac gating model
2 pointers:
1: Parametric image related to the cardiac gating model basis functions.
2: 3D voxels
Definition at line 401 of file vDynamicModel.hh.
|
protected |
Vector containing the Model temporal basis functions
2 pointers:
1: index of the temporal function
2: coefficient of the functions for each time points of a dynamic acquisition
Definition at line 383 of file vDynamicModel.hh.
|
protected |
1D vector for NNLS estimation, containing the solution (multithreaded), dims must be [nb_th][nb_samples]
Definition at line 429 of file vDynamicModel.hh.
|
protected |
Working space array for NNLS estimation (multithreaded) dims must be [nb_th][m_nnlsN]
Definition at line 433 of file vDynamicModel.hh.
|
protected |
1D working vector for NNLS estimation (multithreaded) dims must be [nb_th][ (m_nnlsN+2)*nb_samples ]
Definition at line 430 of file vDynamicModel.hh.
|
protected |
Working space array for NNLS estimation (multithreaded) dims must be [nb_th][m_nnlsN]
Definition at line 432 of file vDynamicModel.hh.
|
protected |
1D solution vector for NNLS estimation (multithreaded) dims must be [nb_th][m_nnlsN]
Definition at line 431 of file vDynamicModel.hh.
|
protected |
Image matrix to gather the parametric image before writing on disk
By default it will point directly to the parametric m2p_parametricImages.
They are allocated if post-processing are enabled before writing the image (i.e FOV masking)
2 pointers:
1: Parametric image related to the dynamic model basis functions.
2: 3D voxels
Definition at line 389 of file vDynamicModel.hh.
|
protected |
Image matrix containing the parametric images
2 pointers:
1: Parametric image related to the dynamic model basis functions.
2: 3D voxels
Definition at line 374 of file vDynamicModel.hh.
|
protected |
Image matrix containing the parametric images of the respiratory gating model
2 pointers:
1: Parametric image related to the respiratory gating model basis functions.
2: 3D voxels
Definition at line 396 of file vDynamicModel.hh.
|
protected |
2D coefficient matrix for NNLS estimation (multithreaded), dims must be [nb_th][m_nnlsN][nb_samples]
Definition at line 428 of file vDynamicModel.hh.
|
protected |
The file containing the data of the sampled Arterial Input Curve
Definition at line 370 of file vDynamicModel.hh.
|
protected |
Flag indicating that an AIC file has been provided instead of Time Basis Functions
Definition at line 413 of file vDynamicModel.hh.
|
protected |
Boolean indicating whether the parameters were checked or not
Definition at line 409 of file vDynamicModel.hh.
|
protected |
Path to a configuration file
Definition at line 406 of file vDynamicModel.hh.
|
protected |
Boolean indicating whether the manager was initialized or not
Definition at line 410 of file vDynamicModel.hh.
|
protected |
String containing a list of options
Definition at line 407 of file vDynamicModel.hh.
|
protected |
Flag indicating if model specific Time Basis Functions are required
Definition at line 414 of file vDynamicModel.hh.
|
protected |
Number of cardiac model parameters
Definition at line 368 of file vDynamicModel.hh.
|
protected |
Number of dynamic model parameters
Definition at line 366 of file vDynamicModel.hh.
|
protected |
Number of respiratory model parameters
Definition at line 367 of file vDynamicModel.hh.
|
protected |
Number of time basis functions in the model
Definition at line 364 of file vDynamicModel.hh.
|
protected |
Number of voxels in mask
Definition at line 424 of file vDynamicModel.hh.
|
protected |
Number of weight factors for WLS optimisation
Definition at line 365 of file vDynamicModel.hh.
|
protected |
Number of parameters in NNLS estimation
Definition at line 435 of file vDynamicModel.hh.
|
protected |
If true, the reconstructed images are not estimated from the parametric images, the EstimateImageWithModel() functions is not called so the class only estimate parametric images from each current estimation of the images (default=false)
Definition at line 416 of file vDynamicModel.hh.
|
protected |
If true, the parameters are not estimated from the serie of dynamic images, the EstimateModelParameters() functions is not called (default=false)
Definition at line 420 of file vDynamicModel.hh.
|
protected |
Flag indicating if the blacklisted voxels mask image should be written on disk
Definition at line 412 of file vDynamicModel.hh.
|
protected |
Flag indicating if parametric images should be written on disk (default=true)
Definition at line 411 of file vDynamicModel.hh.
|
protected |
Number of iterations after which the reconstructed images are estimated from the parametric images. (default or negative value =0)
Definition at line 422 of file vDynamicModel.hh.
|
protected |
The verbose level
Definition at line 363 of file vDynamicModel.hh.
|
protected |
oArterialInputCurve object related to processing of Arterial Input Curves
Definition at line 371 of file vDynamicModel.hh.
|
protected |
Image matrix containing the voxels which the model cannot fit
1 pointer:
1: 3D voxels
Definition at line 379 of file vDynamicModel.hh.
|
protected |
Pointer to the oImageDimensionsAndQuantification object in use
Definition at line 362 of file vDynamicModel.hh.
|
protected |
Input image containing a mask defining in which voxels the model must be applied (1) or not (0). Default: all voxels to 1
Definition at line 423 of file vDynamicModel.hh.
|
protected |
Vector containing the weights for NNLS estimation
Definition at line 427 of file vDynamicModel.hh.