8 #include "oProjectionLine.hh" 9 #include "sOutputManager.hh" 10 #include "vProjector.hh" 119 Cerr(
"***** oProjectionLine::CheckParameters() -> Forbidden number of TOF bins (" <<
m_nbTOFBins <<
") !" << endl);
124 Cerr(
"***** oProjectionLine::CheckParameters() -> Computation strategy incorrectly set !" << endl);
129 Cerr(
"***** oProjectionLine::CheckParameters() -> POI resolution not set !" << endl);
134 Cerr(
"***** oProjectionLine::CheckParameters() -> oImageDimensionsAndQuantification not set !" << endl);
139 Cerr(
"***** oProjectionLine::CheckParameters() -> The thread number associated to this line is not set !" << endl);
157 Cerr(
"***** oProjectionLine::Initialize() -> Must call CheckParameters() before Initialize() !" << endl);
204 Cerr(
"***** oProjectionLine::Initialize() -> Image computation strategy is not compatible with the use of system matrix projectors !" << endl);
208 if (
m_verbose>=5)
Cout(
" --> Choose the image computation strategy" << endl);
239 if (
m_verbose>=5)
Cout(
" --> Choose the fixed list computation strategy" << endl);
247 if (
m_verbose>=5)
Cout(
" --> System matrix for forward projection" << endl);
280 if (
m_verbose>=5)
Cout(
" --> System matrix for backward projection" << endl);
316 Cerr(
"***** oProjectionLine::Initialize() -> Adaptative list computation strategy is not compatible with the use of system matrix projectors !" << endl);
322 if (
m_verbose>=5)
Cout(
" --> Choose the adaptative list computation strategy, starting with " << nb_voxels <<
" allocated voxels" << endl);
372 Cerr(
"***** oProjectionLine::ComputeLineLength() -> Called while not initialized !" << endl);
377 #ifdef CASTOR_VERBOSE 378 if (
m_verbose>=10)
Cout(
"oProjectionLine::ComputeLineLength() -> Compute length of the line" << endl);
396 Cerr(
"***** oProjectionLine::NotEmptyLine() -> Called while not initialized !" << endl);
401 #ifdef CASTOR_VERBOSE 402 if (
m_verbose>=10)
Cout(
"oProjectionLine::NotEmptyLine() -> Look if line is empty" << endl);
420 Cerr(
"***** oProjectionLine::Reset() -> Called while not initialized !" << endl);
425 #ifdef CASTOR_VERBOSE 426 if (
m_verbose>=10)
Cout(
"oProjectionLine::Reset() -> Reset buffers of the line" << endl);
468 Cerr(
"***** oProjectionLine::ApplyOffset() -> Called while not initialized !" << endl);
473 #ifdef CASTOR_VERBOSE 474 if (
m_verbose>=10)
Cout(
"oProjectionLine::ApplyOffset() -> Apply the global offset to the line end points" << endl);
497 Cerr(
"***** oProjectionLine::ApplyBedOffset() -> Called while not initialized !" << endl);
502 #ifdef CASTOR_VERBOSE 503 if (
m_verbose>=10)
Cout(
"oProjectionLine::ApplyBedOffset() -> Apply the bed position offset to the line end points" << endl);
522 Cerr(
"***** oProjectionLine::GetVoxelIndex() -> Called while not initialized !" << endl);
527 #ifdef CASTOR_VERBOSE 530 string direction =
"";
531 if (a_direction==
FORWARD) direction =
"forward";
532 else direction =
"backward";
533 Cout(
"oProjectionLine::GetVoxelIndex() -> Get voxel index of voxel number " << a_voxelInLine <<
" in TOF bin " << a_TOFBin <<
" of " << direction <<
" projector" << endl);
539 return a_voxelInLine;
555 Cerr(
"***** oProjectionLine::AddVoxelInTOFBin() -> Called while not initialized !" << endl);
560 #ifdef CASTOR_VERBOSE 563 string direction =
"";
564 if (a_direction==
FORWARD) direction =
"forward";
565 else direction =
"backward";
566 Cout(
"oProjectionLine::AddVoxelInTOFBin() -> Add voxel index " << a_voxelIndex <<
" of weight " << a_voxelWeight <<
567 " into TOF bin " << a_TOFBin <<
" of " << direction <<
" projector" << endl);
575 m3p_voxelWeights[a_direction][a_TOFBin][m2p_currentNbVoxels[a_direction][a_TOFBin]] = a_voxelWeight;
576 m2p_currentNbVoxels[a_direction][a_TOFBin]++;
590 m3p_voxelWeights[a_direction][a_TOFBin][m2p_currentNbVoxels[a_direction][a_TOFBin]] = a_voxelWeight;
591 m2p_currentNbVoxels[a_direction][a_TOFBin]++;
611 Cerr(
"***** oProjectionLine::AddVoxelAllTOFBins() -> Called while not initialized !" << endl);
616 #ifdef CASTOR_VERBOSE 619 string direction =
"";
620 if (a_direction==
FORWARD) direction =
"forward";
621 else direction =
"backward";
622 Cout(
"oProjectionLine::AddVoxelAllTOFBin() -> Add voxel index " << a_voxelIndex <<
" and weights for all TOF bins of " 623 << direction <<
" projector" << endl);
629 for (
INTNB t=a_tofBinFirst; t<=a_tofBinLast; t++)
633 m3p_voxelWeights[a_direction][t][m2p_currentNbVoxels[a_direction][t]] = a_voxelWeight * (
FLTNB)(a_tofWeights[t]);
634 m2p_currentNbVoxels[a_direction][t]++;
639 for (
INTNB t=a_tofBinFirst; t<=a_tofBinLast; t++)
651 m3p_voxelWeights[a_direction][t][m2p_currentNbVoxels[a_direction][t]] = a_voxelWeight * (
FLTNB)(a_tofWeights[t]);
652 m2p_currentNbVoxels[a_direction][t]++;
659 for (
INTNB t=a_tofBinFirst; t<=a_tofBinLast; t++)
676 Cerr(
"***** oProjectionLine::AddVoxel() -> Called while not initialized !" << endl);
681 #ifdef CASTOR_VERBOSE 684 string direction =
"";
685 if (a_direction==
FORWARD) direction =
"forward";
686 else direction =
"backward";
687 Cout(
"oProjectionLine::AddVoxel() -> Add voxel index " << a_voxelIndex <<
" of weight " << a_voxelWeight <<
688 " in " << direction <<
" projector" << endl);
699 m3p_voxelWeights[a_direction][no_tof_bin][m2p_currentNbVoxels[a_direction][no_tof_bin]] = a_voxelWeight;
700 m2p_currentNbVoxels[a_direction][no_tof_bin]++;
714 m3p_voxelWeights[a_direction][no_tof_bin][m2p_currentNbVoxels[a_direction][no_tof_bin]] = a_voxelWeight;
715 m2p_currentNbVoxels[a_direction][no_tof_bin]++;
775 Cerr(
"***** oProjectionLine::ForwardProjectWithSPECTAttenuation() -> Cannot be used with an image computation strategy over the projection line !" << endl);
781 Cerr(
"***** oProjectionLine::ForwardProjectWithSPECTAttenuation() -> Cannot be used with an incompatible projector !" << endl);
794 if (ap_attenuation == NULL)
814 atn_sum = std::exp( -atn_sum *0.1 );
824 if (ap_attenuation == NULL)
844 atn_sum = exp( atn_sum * ((
FLTNB)(-0.1)) );
892 Cerr(
"***** oProjectionLine::BackwardProjectWithSPECTAttenuation() -> Cannot be used with an image computation strategy over the projection line !" << endl);
898 Cerr(
"***** oProjectionLine::BackwardProjectWithSPECTAttenuation() -> Cannot be used with an incompatible projector !" << endl);
908 if (ap_attenuation == NULL)
928 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)
FLTNB * mp_bufferOrientation1
FLTNB * mp_bufferPosition1
void AddVoxelAllTOFBins(int a_direction, INTNB a_voxelIndex, FLTNB a_voxelWeight, HPFLTNB *a_tofWeights, INTNB a_tofBinFirst, INTNB a_tofBinLast)
FLTNB m_TOFMeasurementInPs
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification
#define ADAPTATIVE_LIST_COMPUTATION_STRATEGY
INTNB ** m2p_allocatedNbVoxels
vProjector * mp_BackwardProjector
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)
void BackwardProject(FLTNB *ap_image, FLTNB a_value)
void ApplyOffset()
Apply the offset of oImageDimensionsAndQuantification to the mp_position1 and mp_position2.
void BackwardProjectWithSPECTAttenuation(FLTNB *ap_attenuation, FLTNB *ap_image, FLTNB a_value)
void AddVoxel(int a_direction, INTNB a_voxelIndice, FLTNB a_voxelWeight)
FLTNB *** m3p_voxelWeights
INTNB *** m3p_voxelIndices
FLTNB * mp_bufferOrientation2
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 * mp_bufferPosition2
FLTNB GetOffsetZ()
Get the image offset along the Z axis, in mm.
int m_computationStrategy
FLTNB ForwardProject(FLTNB *ap_image=NULL)
INTNB GetNbVoxXYZ()
Get the total number of voxels.
vProjector * mp_ForwardProjector
FLTNB GetOffsetX()
Get the image offset along the X axis, in mm.
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)
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.
void ApplyBedOffset()
Apply the bed offset of m_bedOffset to the mp_position1 and mp_position2.
INTNB ** m2p_currentNbVoxels
FLTNB ComputeLineIntegral(int a_direction)