143 Cerr(
"***** oProjectionLine::CheckParameters() -> Forbidden number of TOF bins (" <<
m_nbTOFBins <<
") !" << endl);
148 Cerr(
"***** oProjectionLine::CheckParameters() -> Computation strategy incorrectly set !" << endl);
153 Cerr(
"***** oProjectionLine::CheckParameters() -> POI resolution not set !" << endl);
158 Cerr(
"***** oProjectionLine::CheckParameters() -> oImageDimensionsAndQuantification not set !" << endl);
163 Cerr(
"***** oProjectionLine::CheckParameters() -> The thread number associated to this line is not set !" << endl);
181 Cerr(
"***** oProjectionLine::Initialize() -> Must call CheckParameters() before Initialize() !" << endl);
228 Cerr(
"***** oProjectionLine::Initialize() -> Image computation strategy is not compatible with the use of system matrix projectors !" << endl);
232 if (
m_verbose>=5)
Cout(
" --> Choose the image computation strategy" << endl);
263 if (
m_verbose>=5)
Cout(
" --> Choose the fixed list computation strategy" << endl);
271 if (
m_verbose>=5)
Cout(
" --> System matrix for forward projection" << endl);
300 if (
m_verbose>=5)
Cout(
" --> System matrix for backward projection" << endl);
332 Cerr(
"***** oProjectionLine::Initialize() -> Adaptative list computation strategy is not compatible with the use of system matrix projectors !" << endl);
338 if (
m_verbose>=5)
Cout(
" --> Choose the adaptative list computation strategy, starting with " << nb_voxels <<
" allocated voxels" << endl);
388 Cerr(
"***** oProjectionLine::ComputeLineLength() -> Called while not initialized !" << endl);
393 #ifdef CASTOR_VERBOSE
394 if (
m_verbose>=10)
Cout(
"oProjectionLine::ComputeLineLength() -> Compute length of the line" << endl);
412 Cerr(
"***** oProjectionLine::NotEmptyLine() -> Called while not initialized !" << endl);
417 #ifdef CASTOR_VERBOSE
418 if (
m_verbose>=10)
Cout(
"oProjectionLine::NotEmptyLine() -> Look if line is empty" << endl);
436 Cerr(
"***** oProjectionLine::Reset() -> Called while not initialized !" << endl);
441 #ifdef CASTOR_VERBOSE
442 if (
m_verbose>=10)
Cout(
"oProjectionLine::Reset() -> Reset buffers of the line" << endl);
484 Cerr(
"***** oProjectionLine::ApplyOffset() -> Called while not initialized !" << endl);
489 #ifdef CASTOR_VERBOSE
490 if (
m_verbose>=10)
Cout(
"oProjectionLine::ApplyOffset() -> Apply the global offset to the line end points" << endl);
513 Cerr(
"***** oProjectionLine::ApplyBedOffset() -> Called while not initialized !" << endl);
518 #ifdef CASTOR_VERBOSE
519 if (
m_verbose>=10)
Cout(
"oProjectionLine::ApplyBedOffset() -> Apply the bed position offset to the line end points" << endl);
538 Cerr(
"***** oProjectionLine::GetVoxelIndex() -> Called while not initialized !" << endl);
543 #ifdef CASTOR_VERBOSE
546 string direction =
"";
547 if (a_direction==
FORWARD) direction =
"forward";
548 else direction =
"backward";
549 Cout(
"oProjectionLine::GetVoxelIndex() -> Get voxel index of voxel number " << a_voxelInLine <<
" in TOF bin " << a_TOFBin <<
" of " << direction <<
" projector" << endl);
555 return a_voxelInLine;
571 Cerr(
"***** oProjectionLine::AddVoxelInTOFBin() -> Called while not initialized !" << endl);
576 #ifdef CASTOR_VERBOSE
579 string direction =
"";
580 if (a_direction==
FORWARD) direction =
"forward";
581 else direction =
"backward";
582 Cout(
"oProjectionLine::AddVoxelInTOFBin() -> Add voxel index " << a_voxelIndex <<
" of weight " << a_voxelWeight <<
583 " into TOF bin " << a_TOFBin <<
" of " << direction <<
" projector" << endl);
591 m3p_voxelWeights[a_direction][a_TOFBin][m2p_currentNbVoxels[a_direction][a_TOFBin]] = a_voxelWeight;
592 m2p_currentNbVoxels[a_direction][a_TOFBin]++;
606 m3p_voxelWeights[a_direction][a_TOFBin][m2p_currentNbVoxels[a_direction][a_TOFBin]] = a_voxelWeight;
607 m2p_currentNbVoxels[a_direction][a_TOFBin]++;
627 Cerr(
"***** oProjectionLine::AddVoxelAllTOFBins() -> Called while not initialized !" << endl);
632 #ifdef CASTOR_VERBOSE
635 string direction =
"";
636 if (a_direction==
FORWARD) direction =
"forward";
637 else direction =
"backward";
638 Cout(
"oProjectionLine::AddVoxelAllTOFBin() -> Add voxel index " << a_voxelIndex <<
" and weights for all TOF bins of "
639 << direction <<
" projector" << endl);
645 for (
INTNB t=a_tofBinFirst; t<=a_tofBinLast; t++)
649 m3p_voxelWeights[a_direction][t][m2p_currentNbVoxels[a_direction][t]] = a_voxelWeight * (
FLTNB)(a_tofWeights[t]);
650 m2p_currentNbVoxels[a_direction][t]++;
655 for (
INTNB t=a_tofBinFirst; t<=a_tofBinLast; t++)
667 m3p_voxelWeights[a_direction][t][m2p_currentNbVoxels[a_direction][t]] = a_voxelWeight * (
FLTNB)(a_tofWeights[t]);
668 m2p_currentNbVoxels[a_direction][t]++;
675 for (
INTNB t=a_tofBinFirst; t<=a_tofBinLast; t++)
692 Cerr(
"***** oProjectionLine::AddVoxel() -> Called while not initialized !" << endl);
697 #ifdef CASTOR_VERBOSE
700 string direction =
"";
701 if (a_direction==
FORWARD) direction =
"forward";
702 else direction =
"backward";
703 Cout(
"oProjectionLine::AddVoxel() -> Add voxel index " << a_voxelIndex <<
" of weight " << a_voxelWeight <<
704 " in " << direction <<
" projector" << endl);
715 m3p_voxelWeights[a_direction][no_tof_bin][m2p_currentNbVoxels[a_direction][no_tof_bin]] = a_voxelWeight;
716 m2p_currentNbVoxels[a_direction][no_tof_bin]++;
730 m3p_voxelWeights[a_direction][no_tof_bin][m2p_currentNbVoxels[a_direction][no_tof_bin]] = a_voxelWeight;
731 m2p_currentNbVoxels[a_direction][no_tof_bin]++;
791 Cerr(
"***** oProjectionLine::ForwardProjectWithSPECTAttenuation() -> Cannot be used with an image computation strategy over the projection line !" << endl);
797 Cerr(
"***** oProjectionLine::ForwardProjectWithSPECTAttenuation() -> Cannot be used with an incompatible projector !" << endl);
810 if (ap_attenuation == NULL)
830 atn_sum = std::exp( -atn_sum *0.1 );
840 if (ap_attenuation == NULL)
860 atn_sum = exp( atn_sum * ((
FLTNB)(-0.1)) );
908 Cerr(
"***** oProjectionLine::BackwardProjectWithSPECTAttenuation() -> Cannot be used with an image computation strategy over the projection line !" << endl);
914 Cerr(
"***** oProjectionLine::BackwardProjectWithSPECTAttenuation() -> Cannot be used with an incompatible projector !" << endl);
924 if (ap_attenuation == NULL)
944 atn_sum = exp( atn_sum * ((
FLTNB)(-0.1)) );
~oProjectionLine()
The destructor of oProjectionLine.
#define IMAGE_COMPUTATION_STRATEGY
FLTNB ForwardProjectWithSPECTAttenuation(FLTNB *ap_attenuation, FLTNB *ap_image=NULL)
Forward projects the provided image for the current TOF bin with an inner loop on the attenuation (fo...
void AddVoxelAllTOFBins(int a_direction, INTNB a_voxelIndex, FLTNB a_voxelWeight, HPFLTNB *a_tofWeights, INTNB a_tofBinFirst, INTNB a_tofBinLast)
Add a voxel contribution to the line for all relevant TOF bins.
FLTNB * mp_bufferOrientation1
vProjector * mp_ForwardProjector
#define ADAPTATIVE_LIST_COMPUTATION_STRATEGY
bool GetCompatibilityWithSPECTAttenuationCorrection()
oProjectionLine()
The constructor of oProjectionLine.
void ComputeLineLength()
Simply compute and update the m_length using the associated mp_position1 and mp_position2.
#define FIXED_LIST_COMPUTATION_STRATEGY
INTNB GetVoxelIndex(int a_direction, int a_TOFBin, INTNB a_voxelInLine)
This function is used to get the contributing voxel index of the provided direction, TOF bin and voxel rank.
INTNB *** m3p_voxelIndices
Declaration of class oProjectionLine.
void BackwardProject(FLTNB *ap_image, FLTNB a_value)
Simply backward projects the provided value inside the provided image, for the current TOF bin...
void ApplyOffset()
Apply the offset of oImageDimensionsAndQuantification to the mp_position1 and mp_position2.
FLTNB *** m3p_voxelWeights
Declaration of class vProjector.
void BackwardProjectWithSPECTAttenuation(FLTNB *ap_attenuation, FLTNB *ap_image, FLTNB a_value)
Backward project the provided value inside the provided image with an inner loop on the attenuation (...
void AddVoxel(int a_direction, INTNB a_voxelIndice, FLTNB a_voxelWeight)
This function is used to add a voxel contribution to the line, assuming TOF bin 0 (i...
void Reset()
Reset length and all the voxel indices and weights tabs.
bool NotEmptyLine()
This function is used to know if the line contains any voxel contribution.
FLTNB m_multiplicativeCorrection
FLTNB GetOffsetY()
Get the image offset along the Y axis, in mm.
INTNB GetNbVoxDiagonal()
Get an estimation of the number of voxels along the image diagonal.
FLTNB GetOffsetZ()
Get the image offset along the Z axis, in mm.
Declaration of class sOutputManager.
int m_computationStrategy
FLTNB ForwardProject(FLTNB *ap_image=NULL)
Simply forward projects the provided image if not null, or else 1, for the current TOF bin...
INTNB GetNbVoxXYZ()
Get the total number of voxels.
FLTNB * mp_bufferPosition1
FLTNB * mp_bufferOrientation2
FLTNB GetOffsetX()
Get the image offset along the X axis, in mm.
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification
INTNB ** m2p_allocatedNbVoxels
virtual INTNB EstimateMaxNumberOfVoxelsPerLine()
This function is used to compute and provide an estimate of the maximum number of voxels that could c...
void AddVoxelInTOFBin(int a_direction, int a_TOFBin, INTNB a_voxelIndice, FLTNB a_voxelWeight)
This function is used to add a voxel contribution to the line and provided TOF bin.
int CheckParameters()
A function used to check the parameters settings.
bool m_useMatchedProjectors
int Initialize()
A function used to initialize a bunch of stuff after parameters have been checked.
FLTNB * mp_bufferPosition2
void ApplyBedOffset()
Apply the bed offset of m_bedOffset to the mp_position1 and mp_position2.
INTNB ** m2p_currentNbVoxels
vProjector * mp_BackwardProjector
FLTNB ComputeLineIntegral(int a_direction)
It simply computes the sum of all voxels contributions following the provided direction.