92 if (ap_ImageDimensionsAndQuantification==NULL)
94 Cerr(
"***** vProjector::SetImageDimensionsAndQuantification() -> Input image dimensions object is null !" << endl);
123 MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
124 if (mpi_rank!=0)
return;
127 cout <<
"------------------------------------------------------------------" << endl;
128 cout <<
"----- Common options for all projectors" << endl;
129 cout <<
"------------------------------------------------------------------" << endl;
130 cout <<
"Only options related to TOF implementation are available." << endl;
131 cout <<
"If used, values for all of the following options must be provided as a list of numbers separated by commas." << endl;
133 cout <<
" the number of standard deviations for truncating the nominal TOF Gaussian distribution (-1 for no truncation)." << endl;
134 cout <<
" whether the TOF weighting function is precomputed (1 for yes, 0 for no)" << endl;
135 cout <<
" whether the TOF weighting function takes properly into account the TOF bin using convolution or integration (1 for yes, 0 for no)." << endl;
137 cout <<
"The default values are -1,1,1" << endl;
152 else cout <<
"This projector is NOT compatible with SPECT attenuation correction." << endl;
163 if (a_optionsList!=
"")
169 Cerr(
"***** vProjector::ReadCommonOptionsList() -> Failed to correctly read the list of options !" << endl);
189 Cerr(
"***** vProjector::CheckParameters() -> Please provide a valid scanner object !" << endl);
195 Cerr(
"***** vProjector::CheckParameters() -> Please provide a valid image dimensions and quantification object !" << endl);
200 Cerr(
"***** vProjector::CheckParameters() -> One or more voxel sizes is negative or null !" << endl);
205 Cerr(
"***** vProjector::CheckParameters() -> One or more number of voxels is negative or null !" << endl);
211 Cerr(
"***** vProjector::CheckParameters() -> TOF flag is incorrect or not set !" << endl);
219 Cerr(
"***** vProjector::CheckParameters() -> Inconsistent TOF related parameters !" << endl);
224 Cout(
"***** vProjector::CheckParameters() -> Warning: quantization TOF bin size wrong or not provided, so switching to TOF list-mode reconstruction which neglects the quantization TOF bin size!" << endl);
231 Cerr(
"***** vProjector::CheckParameters() -> Verbose level is negative !" << endl);
237 Cerr(
"***** vProjector::CheckParameters() -> An error occurred while checking parameters of the child projector class !" << endl);
256 Cerr(
"***** vProjector::Initialize() -> Must call the CheckParameters() function before initialization !" << endl);
286 if (nb_samples_tof_gauss % 2 == 0) nb_samples_tof_gauss += 1;
294 INTNB mu = nb_samples_tof_gauss/2;
295 for (
INTNB g=0;g<nb_samples_tof_gauss;g++)
297 HPFLTNB temp = ((
HPFLTNB)(g-mu))/(tof_resolution_sigma*m_TOFPrecomputedSamplingFactor);
309 if (nb_samples_tof_bin % 2 == 0) nb_samples_tof_bin += 1;
312 INTNB nb_samples_conv = nb_samples_tof_gauss+nb_samples_tof_bin-1;
317 INTNB mu = nb_samples_conv/2;
318 for (
INTNB sgauss=0;sgauss<nb_samples_conv;sgauss++)
320 if (sgauss<mu-nb_samples_tof_gauss/2 || sgauss>mu+nb_samples_tof_gauss/2) tof_gauss[sgauss]=0.;
323 HPFLTNB temp = (
HPFLTNB)((sgauss-mu))/(tof_resolution_sigma*m_TOFPrecomputedSamplingFactor);
332 for (
INTNB sbin=0;sbin<nb_samples_tof_bin;sbin++) tof_bin[sbin] = tof_bin_value;
339 for (
INTNB c=0;c<nb_samples_conv;c++)
341 for (
INTNB ib=0;ib<nb_samples_tof_bin;ib++)
343 INTNB temp = c-nb_samples_tof_bin/2+ib;
344 if (temp>=0 && temp<nb_samples_conv)
mp_TOFWeightingFcn[c] += tof_gauss[temp]*tof_bin[ib];
361 Cout(
" --> TOF weighting function implementation: " << endl);
362 Cout(
" --> Gaussian truncation (number of standard deviations) " <<
m_TOFNbSigmas << endl);
365 Cout(
" --> Precomputed " << endl);
378 Cout(
" --> Computation on the fly " << endl);
395 Cerr(
"***** vProjector::Initialize() -> A problem occurred while calling the specific initialization of the child projector !" << endl);
401 Cout(
"vProjector::Initialize() -> Exit function" << endl);
429 Cerr(
"***** vProjector::Project() -> Called while not initialized !" << endl);
448 ap_ProjectionLine->
SetIndex1(((
int)(ap_index1[0])));
449 ap_ProjectionLine->
SetIndex2(((
int)(ap_index2[0])));
456 Cerr(
"***** vProjector::Project() -> A problem occurred while getting positions and orientations from scanner !" << endl);
477 for (
int i=0; i<3; i++)
481 orientation1[i] = 0.;
482 orientation2[i] = 0.;
485 for (
int l=0; l<a_nbIndices; l++)
489 buffer_position1, buffer_position2,
490 buffer_orientation1, buffer_orientation2,
493 Cerr(
"***** vProjector::Project() -> A problem occurred while getting positions and orientations from scanner !" << endl);
497 for (
int i=0; i<3; i++)
499 position1[i] += buffer_position1[i];
500 position2[i] += buffer_position2[i];
501 orientation1[i] += buffer_orientation1[i];
502 orientation2[i] += buffer_orientation2[i];
506 for (
int i=0; i<3; i++)
508 position1[i] /= ((
FLTNB)a_nbIndices);
509 position2[i] /= ((
FLTNB)a_nbIndices);
510 orientation1[i] /= ((
FLTNB)a_nbIndices);
511 orientation2[i] /= ((
FLTNB)a_nbIndices);
543 Cerr(
"***** vProjector::Project() -> A problem occurred while projecting a line without time-of-flight !" << endl);
550 Cerr(
"***** vProjector::Project() -> A problem occurred while projecting a line with time-of-flight position !" << endl);
557 Cerr(
"***** vProjector::Project() -> A problem occurred while projecting a line with binned time-of-flight !" << endl);
564 #ifdef CASTOR_VERBOSE 567 Cout(
"vProjector::Project() -> Exit function" << endl);
bool m_compatibleWithSPECTAttenuationCorrection
FLTNB * GetOrientation1()
This function is used to get the pointer to the mp_orientation1 (3-values tab).
#define VERBOSE_DEBUG_EVENT
FLTNB * GetPOI1()
This function is used to get the pointer to POI of point 1 (3-values tab).
static void ShowCommonHelp()
This function is used to print out some help about the use of options common to all projectors...
FLTNB GetVoxSizeX()
Get the voxel's size along the X axis, in mm.
FLTNB m_TOFGaussianNormCoef
#define TWO_SQRT_TWO_LN_2
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification
FLTNB GetVoxSizeZ()
Get the voxel's size along the Z axis, in mm.
FLTNB * GetBufferPosition2()
This function is used to get the pointer to the mp_bufferPosition2 (3-values tab).
vProjector()
The constructor of vProjector.
int Initialize()
A public function used to initialize the projector.
bool m_TOFWeightingFcnPrecomputedFlag
bool m_TOFBinProperProcessingFlag
HPFLTNB * mp_TOFWeightingFcn
virtual int ProjectWithoutTOF(int a_direction, oProjectionLine *ap_ProjectionLine)=0
A function to project without TOF.
int Project(int a_direction, oProjectionLine *ap_ProjectionLine, uint32_t *ap_index1, uint32_t *ap_index2, int a_nbIndices)
A function use to computed the projection elements with respect to the provided parameters.
FLTNB * GetBufferPosition1()
This function is used to get the pointer to the mp_bufferPosition1 (3-values tab).
FLTNB * GetOrientation2()
This function is used to get the pointer to the mp_orientation2 (3-values tab).
void SetIndex2(int a_index2)
This function is used to set the index m_index1 of point 2.
virtual int CheckSpecificParameters()=0
A private function used to check the parameters settings specific to the child projector.
void ComputeLineLength()
Simply compute and update the m_length using the associated mp_position1 and mp_position2.
int ReadCommonOptionsList(const string &a_optionsList)
This function is used to read options common to all projectors given as a string. ...
FLTNB GetVoxSizeY()
Get the voxel's size along the Y axis, in mm.
void ApplyOffset()
Apply the offset of oImageDimensionsAndQuantification to the mp_position1 and mp_position2.
FLTNB * GetPosition1()
This function is used to get the pointer to the mp_position1 (3-values tab).
virtual void ShowHelpSpecific()=0
A function used to show help about the child module.
Declaration of class vProjector.
FLTNB * GetBufferOrientation1()
This function is used to get the pointer to the mp_bufferOrientation1 (3-values tab).
virtual ~vProjector()
The destructor of vProjector.
Declaration of class vScanner.
virtual int ProjectTOFHistogram(int a_direction, oProjectionLine *ap_ProjectionLine)=0
A function to project with TOF binned information.
Declaration of class vDataFile.
int CheckParameters()
A public function used to check the parameters settings.
FLTNB m_TOFResolutionInMm
virtual int ProjectTOFListmode(int a_direction, oProjectionLine *ap_ProjectionLine)=0
A function to project with TOF continuous information.
FLTNB * GetBufferOrientation2()
This function is used to get the pointer to the mp_bufferOrientation2 (3-values tab).
void SetIndex1(int a_index1)
This function is used to set the index m_index1 of point 1.
This class is designed to manage and store system matrix elements associated to a vEvent...
FLTNB m_TOFPrecomputedSamplingFactor
virtual int InitializeSpecific()=0
A private function used to initialize everything specific to the child projector. ...
INTNB GetNbVoxXYZ()
Get the total number of voxels.
FLTNB m_TOFMeasurementRangeInMm
This class is designed to manage all dimensions and quantification related stuff. ...
FLTNB * GetPosition2()
This function is used to get the pointer to the mp_position2 (3-values tab).
INTNB GetNbVoxX()
Get the number of voxels along the X axis.
#define DEBUG_VERBOSE(IGNORED1, IGNORED2)
INTNB GetNbVoxZ()
Get the number of voxels along the Z axis.
virtual INTNB EstimateMaxNumberOfVoxelsPerLine()
This function is used to compute and provide an estimate of the maximum number of voxels that could c...
bool m_compatibleWithCompression
void ShowHelp()
A function used to show help about the projector.
FLTNB * GetPOI2()
This function is used to get the pointer to POI of point 2 (3-values tab).
int SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
Set the pointer to the image dimensions in use and copy locally some often use variables.
int ReadStringOption(const string &a_input, T *ap_return, int a_nbElts, const string &sep, const string &a_option)
Parse the 'a_input' string corresponding to the 'a_option' into 'a_nbElts' elements, using the 'sep' separator. The results are returned in the templated 'ap_return' dynamic templated array. Call "ConvertFromString()" to perform the correct conversion depending on the type of the data to convert.
virtual int GetPositionsAndOrientations(int a_index1, int a_index2, FLTNB ap_Position1[3], FLTNB ap_Position2[3], FLTNB ap_Orientation1[3], FLTNB ap_Orientation2[3], FLTNB *ap_POI1=NULL, FLTNB *ap_POI2=NULL)=0
This is a pure virtual method that must be implemented by children. Get the central positions and o...
void ApplyBedOffset()
Apply the bed offset of m_bedOffset to the mp_position1 and mp_position2.
INTNB GetNbVoxY()
Get the number of voxels along the Y axis.
INTNB m_TOFWeightingFcnNbSamples