33 mp_ID = ap_ImageDimensionsAndQuantification;
86 if(
m_verbose >=4)
Cout(
"oComputeProjection::DataUpdateStep ... " << endl);
89 FLTNB fp = 0., fp_atn = 0.;
104 fp *= std::exp(-fp_atn);
107 (
dynamic_cast<iEventPET*
>(ap_Event))->SetAttenuationCorrectionFactor(1/exp(-fp_atn));
120 #ifdef CASTOR_VERBOSE
121 if(
m_verbose >=4)
Cout(
"oComputeProjection::DataUpdateStep : Projeted value = "<< fp << endl);
129 #ifdef CASTOR_VERBOSE
130 if(
m_verbose >=4)
Cout(
"oComputeProjection::DataUpdateStep : Projeted value with Poisson noise = "<< fp << endl);
140 Cerr(
"*****oComputeProjection::DataUpdateStep()-> Error while trying to write a projeted event" << endl);
170 if(
m_verbose >=3)
Cout(
"oComputeProjection::InitNoiseModel ... " << endl);
182 string name_noise_model =
"";
183 string list_options_noise_model =
"";
184 string file_options_noise_model =
"";
187 size_t colon = aNoiseModel.find_first_of(
":");
188 size_t comma = aNoiseModel.find_first_of(
",");
191 if (colon!=string::npos)
194 name_noise_model = aNoiseModel.substr(0,colon);
196 file_options_noise_model = aNoiseModel.substr(colon+1);
198 list_options_noise_model =
"";
201 else if (comma!=string::npos)
204 name_noise_model = aNoiseModel.substr(0,comma);
206 list_options_noise_model = aNoiseModel.substr(comma+1);
208 file_options_noise_model =
"";
214 name_noise_model = aNoiseModel;
216 file_options_noise_model =
"";
218 list_options_noise_model =
"";
222 if (aNoiseModel ==
"poisson")
229 Cerr(
"*****oComputeProjection::InitNoiseModel()-> Error while trying to initialize noise model. Model '"<<aNoiseModel<<
"' is unknown"<<endl;);
257 #ifdef CASTOR_VERBOSE
258 if(
m_verbose >=4)
Cout(
"oComputeProjection::GetPoissonNoise ... " << endl);
264 double return_value = 0.;
269 double rdm_1, rdm_2, w;
275 w = rdm_1*rdm_1 + rdm_2*rdm_2;
278 w = sqrt( (-2.0 * log(w) ) / w );
280 return_value = a_lambda + sqrt(a_lambda)*rdm_1*w;
282 return_value = (return_value<0) ? 0 : round(return_value);
287 double L = exp(-(a_lambda));
301 return (uint32_t) return_value;
FLTNB **** m4p_forwardImage
This class is designed to be a mother virtual class for Datafile.
FLTNB ** m2p_projectionImage
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)
Forward projects the provided image for the current TOF bin with an inner loop on the attenuation (fo...
double GenerateRdmNber()
Generate a random number for the thread whose index is recovered from the ompenMP function...
uint32_t GetID2(int a_line)
virtual void SetEventValue(int a_bin, FLTNBDATA a_value)=0
This function is implemented by child classes.
int InitNoiseModel(string aNoiseModel)
This is a premature implementation of noise model initialization for analytic simulator. Currently, only the Poisson noise can be selected.
virtual int PROJ_WriteEvent(vEvent *ap_Event, int a_th)=0
This function is implemented in child classes Write event according to the chosen type of data...
oComputeProjection(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
oComputeProjection constructor.
Singleton class that generate a thread-safe random generator number for openMP As singleton...
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)
Perform the forward-projection, and send the result to the datafile for writing. Implements random ...
Inherit from vEvent. Main PET class for the Event objects.
This class is designed to manage and store system matrix elements associated to a vEvent...
void SetTimeInMs(uint32_t a_value)
Set the timestamp of the Event.
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)
Simply forward projects the provided image if not null, or else 1, for the current TOF bin...
uint32_t GetID1(int a_line)
This class is designed to manage all dimensions and quantification related stuff. ...
uint32_t GetPoissonNoise(int32_t a_lambda)
Generate a Poisson random variable from a provided lambda.
oImageDimensionsAndQuantification * mp_ID
FLTNB **** m4p_attenuation
~oComputeProjection()
oComputeProjection destructor.
Declaration of class oComputeProjection.