![]() |
CASToR
1.0
Tomographic Reconstruction (PET/SPECT)
|
00001 00002 /* 00003 Implementation of class iEventHistoPET 00004 00005 - separators: X 00006 - doxygen: X 00007 - default initialization: X 00008 - CASTOR_DEBUG: none 00009 - CASTOR_VERBOSE: none 00010 */ 00011 00012 00021 #include "iEventHistoPET.hh" 00022 #include "vDataFile.hh" // DATA_MODE/ DATA_TYPE macros 00023 #include "sOutputManager.hh" // Cout()/Cerr() 00024 00025 00026 // ===================================================================== 00027 // --------------------------------------------------------------------- 00028 // --------------------------------------------------------------------- 00029 // ===================================================================== 00030 /* 00031 Constructor() 00032 */ 00033 iEventHistoPET::iEventHistoPET() : iEventPET() 00034 { 00035 m_dataType = TYPE_PET; 00036 m_dataMode = MODE_HISTOGRAM; 00037 m_eventNbTOFBins = 1; 00038 mp_eventValue =NULL; 00039 mp_eventScatRate =NULL; 00040 m_nbLines = 1; 00041 } 00042 00043 00044 // ===================================================================== 00045 // --------------------------------------------------------------------- 00046 // --------------------------------------------------------------------- 00047 // ===================================================================== 00048 /* 00049 Destructor() 00050 */ 00051 iEventHistoPET::~iEventHistoPET() 00052 { 00053 if(mp_eventValue != NULL) delete mp_eventValue; 00054 if(mp_eventScatRate != NULL) delete mp_eventScatRate; 00055 } 00056 00057 00058 00059 // ===================================================================== 00060 // --------------------------------------------------------------------- 00061 // --------------------------------------------------------------------- 00062 // ===================================================================== 00063 /* 00064 \fn virtual int AllocateSpecificData() 00065 \brief Function allowing the allocation of specific data. 00066 Instantiate and initialize the mp_eventValue and mp_eventScatIntensity arrays depending of the number of TOF bins 00067 \return 0 is success, positive value otherwise 00068 */ 00069 int iEventHistoPET::AllocateSpecificData() 00070 { 00071 if(m_eventNbTOFBins<1) 00072 { 00073 Cerr("*****iEventHistoPET::AllocateSpecificData() -> Error, number of TOF bins has not been initialized (<1) !"); 00074 return 1; 00075 } 00076 00077 mp_eventValue = new FLTNB[m_eventNbTOFBins]; 00078 mp_eventScatRate = new FLTNB[m_eventNbTOFBins]; 00079 00080 for(int tb=0 ; tb<m_eventNbTOFBins ; tb++) 00081 { 00082 mp_eventValue[tb] = 1.; 00083 mp_eventScatRate[tb] = 0.; 00084 } 00085 00086 return 0; 00087 } 00088 00089 00090 00091 // ===================================================================== 00092 // --------------------------------------------------------------------- 00093 // --------------------------------------------------------------------- 00094 // ===================================================================== 00095 /* 00096 \fn virtual FLTNB GetAdditiveCorrections() 00097 \return the sum of additive correction terms, summed for the given TOF bins 00098 */ 00099 FLTNB iEventHistoPET::GetAdditiveCorrections(int a_bin) 00100 { 00101 return mp_eventScatRate[a_bin] + m_eventRdmRate/((FLTNB)m_eventNbTOFBins); 00102 } 00103 00104 00105 00106 // ===================================================================== 00107 // --------------------------------------------------------------------- 00108 // --------------------------------------------------------------------- 00109 // ===================================================================== 00110 /* 00111 \fn virtual void Describe() 00112 \brief This function can be used to get a description of the event printed out 00113 */ 00114 void iEventHistoPET::Describe() 00115 { 00116 Cout("---------------------- iEventHistoPET::Describe() --------------------------" << endl); 00117 Cout("sizeof(FLTNB): " << sizeof(FLTNB) << endl); 00118 // From vEvent 00119 // uint32_t m_timeInMs; /*!< Timestamp of the event in ms. Default value =0 */ 00120 Cout("Time: " << m_timeInMs << " ms" << endl); 00121 // uint16_t m_nbLines; /*!< Number of lines in the event. Default value =0 */ 00122 Cout("Number of lines: " << m_nbLines << endl); 00123 // uint32_t* mp_ID1; /*!< Pointer containing the indice(s) of the 1st ID of the Event. Default value =NULL */ 00124 // uint32_t* mp_ID2; /*!< Pointer containing the indice(s) of the 2nd ID of the Event. Default value =0 */ 00125 for (uint16_t l=0; l<m_nbLines; l++) Cout(" --> ID1: " << mp_ID1[l] << " | ID2: " << mp_ID2[l] << endl); 00126 // From iEventPET 00127 // FLTNB m_eventRdmRate; /*!< Correction term for randoms rate (unit: s-1). Default value =0.0 */ 00128 Cout("Random rate: " << m_eventRdmRate << endl); 00129 // FLTNB m_eventNormFactor; /*!< Normalization term. Default value =1.0 */ 00130 Cout("Normalization factor: " << m_eventNormFactor << endl); 00131 // FLTNB m_atnCorrFactor; /*!< Correction term for attenuation. Default value =1.0 */ 00132 Cout("ACF: " << m_atnCorrFactor << endl); 00133 // From iEventHistoPET 00134 // uint16_t m_eventNbTOFBins; /*!< Number of TOF bins in the Event. Default value =1 */ 00135 Cout("Number of TOF bins: " << m_eventNbTOFBins << endl); 00136 // FLTNB* mp_eventValue; /*!< Pointer containing the amount of data in each potential TOF bin. Default value =1.0 */ 00137 // FLTNB* mp_eventScatRate; /*!< Pointer containing the scatter correction term (as a rate in s-1) for each potential TOF bin. Default value =0.0 */ 00138 for (uint16_t t=0; t<m_eventNbTOFBins; t++) Cout(" --> Event value: " << mp_eventValue[t] << " | Scatter rate: " << mp_eventScatRate[t] << endl); 00139 Cout("----------------------------------------------------------------------------" << endl); 00140 Cout(flush); 00141 }