9 #include "oComputeProjection.hh" 22 mp_ID = ap_ImageDimensionsAndQuantification;
73 bool a_discardZeroEvent )
77 if(
m_verbose >=4)
Cout(
"oComputeProjection::DataUpdateStep ... " << endl);
80 FLTNB fp = 0., fp_atn = 0.;
95 fp *= std::exp(-fp_atn);
98 (
dynamic_cast<iEventPET*
>(ap_Event))->SetAttenuationCorrectionFactor(1/exp(-fp_atn));
111 #ifdef CASTOR_VERBOSE 112 if(
m_verbose >=4)
Cout(
"oComputeProjection::DataUpdateStep : Projeted value = "<< fp << endl);
120 #ifdef CASTOR_VERBOSE 121 if(
m_verbose >=4)
Cout(
"oComputeProjection::DataUpdateStep : Projeted value with Poisson noise = "<< fp << endl);
130 if(!a_discardZeroEvent
135 Cerr(
"*****oComputeProjection::DataUpdateStep()-> Error while trying to write a projeted event" << endl);
166 if(
m_verbose >=3)
Cout(
"oComputeProjection::InitNoiseModel ... " << endl);
178 string name_noise_model =
"";
179 string list_options_noise_model =
"";
180 string file_options_noise_model =
"";
183 size_t colon = aNoiseModel.find_first_of(
":");
184 size_t comma = aNoiseModel.find_first_of(
",");
187 if (colon!=string::npos)
190 name_noise_model = aNoiseModel.substr(0,colon);
192 file_options_noise_model = aNoiseModel.substr(colon+1);
194 list_options_noise_model =
"";
197 else if (comma!=string::npos)
200 name_noise_model = aNoiseModel.substr(0,comma);
202 list_options_noise_model = aNoiseModel.substr(comma+1);
204 file_options_noise_model =
"";
210 name_noise_model = aNoiseModel;
212 file_options_noise_model =
"";
214 list_options_noise_model =
"";
218 if (aNoiseModel ==
"poisson")
225 Cerr(
"*****oComputeProjection::InitNoiseModel()-> Error while trying to initialize noise model. Model '"<<aNoiseModel<<
"' is unknown"<<endl;);
254 #ifdef CASTOR_VERBOSE 255 if(
m_verbose >=4)
Cout(
"oComputeProjection::GetPoissonNoise ... " << endl);
272 w = rdm_1*rdm_1 + rdm_2*rdm_2;
275 w = sqrt( (-2.0 * log(w) ) / w );
277 return_value = a_lambda + sqrt(a_lambda)*rdm_1*w;
279 return_value = (return_value<0) ? 0 : round(return_value);
299 return (uint32_t) return_value;
uint32_t GetID2(int a_line)
This class is designed to be a mother virtual class for DataFile.
static sRandomNumberGenerator * GetInstance()
Instanciate the singleton object and Initialize member variables if not already done, return a pointer to this object otherwise.
FLTNB ForwardProjectWithSPECTAttenuation(FLTNB *ap_attenuation, FLTNB *ap_image=NULL)
uint32_t GetPoissonNoise(FLTNB a_lambda)
virtual int WriteEvent(vEvent *ap_Event, int a_th=0)=0
FLTNB ** m2p_projectionImage
int DataUpdateStep(vDataFile *ap_DataFile, oProjectionLine *a2p_Line, oImageSpace *ap_Image, vEvent *ap_Event, int a_fr, int a_rg, int a_cg, int th, uint32_t a_timestamp, bool a_discardZeroEvent)
int InitNoiseModel(string aNoiseModel)
oImageDimensionsAndQuantification * mp_ID
virtual void SetEventValue(int a_bin, FLTNBDATA a_value)=0
HPFLTNB GenerateRdmNber()
Generate a random number for the thread which index is recovered from the OpenMP function.
FLTNB **** m4p_attenuation
oComputeProjection(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
oComputeProjection constructor.
Singleton class that generate a thread-safe random generator number for openMP As singleton...
Inherit from vEvent. Main PET class for the Event objects.
FLTNB **** m4p_forwardImage
This class is designed to manage and store system matrix elements associated to a vEvent...
void SetTimeInMs(uint32_t a_value)
This class holds all the matrices in the image domain that can be used in the algorithm: image...
Mother class for the Event objects.
FLTNB ForwardProject(FLTNB *ap_image=NULL)
This class is designed to manage all dimensions and quantification related stuff. ...
uint32_t GetID1(int a_line)
~oComputeProjection()
oComputeProjection destructor.