8 #include "oProjectionLine.hh" 9 #include "sOutputManager.hh" 10 #include "vProjector.hh" 123 Cerr(
"***** oProjectionLine::CheckParameters() -> Forbidden number of TOF bins (" << m_nbTOFBins <<
") !" << endl);
128 Cerr(
"***** oProjectionLine::CheckParameters() -> Computation strategy incorrectly set !" << endl);
133 Cerr(
"***** oProjectionLine::CheckParameters() -> POI resolution not set !" << endl);
138 Cerr(
"***** oProjectionLine::CheckParameters() -> oImageDimensionsAndQuantification not set !" << endl);
143 Cerr(
"***** oProjectionLine::CheckParameters() -> The thread number associated to this line is not set !" << endl);
161 Cerr(
"***** oProjectionLine::Initialize() -> Must call CheckParameters() before Initialize() !" << endl);
208 Cerr(
"***** oProjectionLine::Initialize() -> Image computation strategy is not compatible with the use of system matrix projectors !" << endl);
212 if (
m_verbose>=5)
Cout(
" --> Choose the image computation strategy" << endl);
243 if (
m_verbose>=5)
Cout(
" --> Choose the fixed list computation strategy" << endl);
251 if (
m_verbose>=5)
Cout(
" --> System matrix for forward projection" << endl);
269 if (m_nbTOFBins>1)
Cout(
" --> Allocate " <<
m2p_allocatedNbVoxels[FORWARD][b] <<
" voxels for forward projection of TOF bin " << b << endl);
284 if (
m_verbose>=5)
Cout(
" --> System matrix for backward projection" << endl);
302 if (m_nbTOFBins>1)
Cout(
" --> Allocate " <<
m2p_allocatedNbVoxels[FORWARD][b] <<
" voxels for backward projection of TOF bin " << b << endl);
320 Cerr(
"***** oProjectionLine::Initialize() -> Adaptative list computation strategy is not compatible with the use of system matrix projectors !" << endl);
326 if (
m_verbose>=5)
Cout(
" --> Choose the adaptative list computation strategy, starting with " << nb_voxels <<
" allocated voxels" << endl);
376 Cerr(
"***** oProjectionLine::ComputeLineLength() -> Called while not initialized !" << endl);
381 #ifdef CASTOR_VERBOSE 382 if (
m_verbose>=10)
Cout(
"oProjectionLine::ComputeLineLength() -> Compute length of the line" << endl);
400 Cerr(
"***** oProjectionLine::NotEmptyLine() -> Called while not initialized !" << endl);
405 #ifdef CASTOR_VERBOSE 406 if (
m_verbose>=10)
Cout(
"oProjectionLine::NotEmptyLine() -> Look if line is empty" << endl);
424 Cerr(
"***** oProjectionLine::Reset() -> Called while not initialized !" << endl);
429 #ifdef CASTOR_VERBOSE 430 if (
m_verbose>=10)
Cout(
"oProjectionLine::Reset() -> Reset buffers of the line" << endl);
472 Cerr(
"***** oProjectionLine::ApplyOffset() -> Called while not initialized !" << endl);
477 #ifdef CASTOR_VERBOSE 478 if (
m_verbose>=10)
Cout(
"oProjectionLine::ApplyOffset() -> Apply the global offset to the line end points" << endl);
501 Cerr(
"***** oProjectionLine::ApplyBedOffset() -> Called while not initialized !" << endl);
506 #ifdef CASTOR_VERBOSE 507 if (
m_verbose>=10)
Cout(
"oProjectionLine::ApplyBedOffset() -> Apply the bed position offset to the line end points" << endl);
526 Cerr(
"***** oProjectionLine::GetVoxelIndex() -> Called while not initialized !" << endl);
531 #ifdef CASTOR_VERBOSE 534 string direction =
"";
535 if (a_direction==FORWARD) direction =
"forward";
536 else direction =
"backward";
537 Cout(
"oProjectionLine::GetVoxelIndex() -> Get voxel index of voxel number " << a_voxelInLine <<
" in TOF bin " << a_TOFBin <<
" of " << direction <<
" projector" << endl);
543 return a_voxelInLine;
559 Cerr(
"***** oProjectionLine::AddVoxelInTOFBin() -> Called while not initialized !" << endl);
564 #ifdef CASTOR_VERBOSE 567 string direction =
"";
568 if (a_direction==FORWARD) direction =
"forward";
569 else direction =
"backward";
570 Cout(
"oProjectionLine::AddVoxelInTOFBin() -> Add voxel index " << a_voxelIndex <<
" of weight " << a_voxelWeight <<
571 " into TOF bin " << a_TOFBin <<
" of " << direction <<
" projector" << endl);
579 m3p_voxelWeights[a_direction][a_TOFBin][m2p_currentNbVoxels[a_direction][a_TOFBin]] = a_voxelWeight;
580 m2p_currentNbVoxels[a_direction][a_TOFBin]++;
585 if (
m2p_currentNbVoxels[a_direction][a_TOFBin]==m2p_allocatedNbVoxels[a_direction][a_TOFBin])
588 m2p_allocatedNbVoxels[a_direction][a_TOFBin]++;
594 m3p_voxelWeights[a_direction][a_TOFBin][m2p_currentNbVoxels[a_direction][a_TOFBin]] = a_voxelWeight;
595 m2p_currentNbVoxels[a_direction][a_TOFBin]++;
615 Cerr(
"***** oProjectionLine::AddVoxelAllTOFBins() -> Called while not initialized !" << endl);
620 #ifdef CASTOR_VERBOSE 623 string direction =
"";
624 if (a_direction==FORWARD) direction =
"forward";
625 else direction =
"backward";
626 Cout(
"oProjectionLine::AddVoxelAllTOFBin() -> Add voxel index " << a_voxelIndex <<
" and weights for all TOF bins of " 627 << direction <<
" projector" << endl);
633 for (
INTNB t=a_tofBinFirst; t<=a_tofBinLast; t++)
637 m3p_voxelWeights[a_direction][t][m2p_currentNbVoxels[a_direction][t]] = a_voxelWeight * (
FLTNB)(a_tofWeights[t]);
638 m2p_currentNbVoxels[a_direction][t]++;
643 for (
INTNB t=a_tofBinFirst; t<=a_tofBinLast; t++)
649 m2p_allocatedNbVoxels[a_direction][t]++;
655 m3p_voxelWeights[a_direction][t][m2p_currentNbVoxels[a_direction][t]] = a_voxelWeight * (
FLTNB)(a_tofWeights[t]);
656 m2p_currentNbVoxels[a_direction][t]++;
663 for (
INTNB t=a_tofBinFirst; t<=a_tofBinLast; t++)
680 Cerr(
"***** oProjectionLine::AddVoxel() -> Called while not initialized !" << endl);
685 #ifdef CASTOR_VERBOSE 688 string direction =
"";
689 if (a_direction==FORWARD) direction =
"forward";
690 else direction =
"backward";
691 Cout(
"oProjectionLine::AddVoxel() -> Add voxel index " << a_voxelIndex <<
" of weight " << a_voxelWeight <<
692 " in " << direction <<
" projector" << endl);
703 m3p_voxelWeights[a_direction][no_tof_bin][m2p_currentNbVoxels[a_direction][no_tof_bin]] = a_voxelWeight;
704 m2p_currentNbVoxels[a_direction][no_tof_bin]++;
709 if (
m2p_currentNbVoxels[a_direction][no_tof_bin]==m2p_allocatedNbVoxels[a_direction][no_tof_bin])
712 m2p_allocatedNbVoxels[a_direction][no_tof_bin]++;
718 m3p_voxelWeights[a_direction][no_tof_bin][m2p_currentNbVoxels[a_direction][no_tof_bin]] = a_voxelWeight;
719 m2p_currentNbVoxels[a_direction][no_tof_bin]++;
779 Cerr(
"***** oProjectionLine::ForwardProjectWithSPECTAttenuation() -> Cannot be used with an image computation strategy over the projection line !" << endl);
785 Cerr(
"***** oProjectionLine::ForwardProjectWithSPECTAttenuation() -> Cannot be used with an incompatible projector !" << endl);
798 if (ap_attenuation == NULL)
818 atn_sum = std::exp( -atn_sum *0.1 );
828 if (ap_attenuation == NULL)
848 atn_sum = exp( atn_sum * ((
FLTNB)(-0.1)) );
896 Cerr(
"***** oProjectionLine::BackwardProjectWithSPECTAttenuation() -> Cannot be used with an image computation strategy over the projection line !" << endl);
902 Cerr(
"***** oProjectionLine::BackwardProjectWithSPECTAttenuation() -> Cannot be used with an incompatible projector !" << endl);
912 if (ap_attenuation == NULL)
932 atn_sum = exp( atn_sum * ((
FLTNB)(-0.1)) );
949 for (
int v=0; v<m2p_currentNbVoxels[a_direction][
m_currentTOFBin]; v++)
~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
EVTFLTDATA * mp_customFLTData
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.
EVTINTDATA * mp_customINTData
void ApplyBedOffset()
Apply the bed offset of m_bedOffset to the mp_position1 and mp_position2.
INTNB ** m2p_currentNbVoxels
FLTNB ComputeLineIntegral(int a_direction)