![]() |
CASToR
1.0
Tomographic Reconstruction (PET/SPECT)
|
00001 00002 /* 00003 Implementation of class vScanner 00004 00005 - separators: X 00006 - doxygen: X 00007 - default initialization: X 00008 - CASTOR_DEBUG: none 00009 - CASTOR_VERBOSE: none 00010 */ 00011 00018 #include "vScanner.hh" 00019 00020 00021 00022 // ===================================================================== 00023 // --------------------------------------------------------------------- 00024 // --------------------------------------------------------------------- 00025 // ===================================================================== 00026 /* 00027 \brief vScanner constructor. 00028 Initialize the member variables to their default values. 00029 */ 00030 vScanner::vScanner() 00031 { 00032 m_scannerType = -1; 00033 m_verbose = -1; 00034 m_allParametersChecked = false; 00035 00036 mp_rotationMatrix = NULL; 00037 mp_positionMatrix_ref = NULL; 00038 mp_positionMatrix_out = NULL; 00039 } 00040 00041 00042 00043 // ===================================================================== 00044 // --------------------------------------------------------------------- 00045 // --------------------------------------------------------------------- 00046 // ===================================================================== 00047 /* 00048 \brief vScanner destructor. 00049 */ 00050 vScanner::~vScanner() 00051 { 00052 if(mp_rotationMatrix) delete mp_rotationMatrix; 00053 if(mp_positionMatrix_ref) delete mp_positionMatrix_ref; 00054 if(mp_positionMatrix_out) delete mp_positionMatrix_out; 00055 } 00056 00057 00058 00059 // ===================================================================== 00060 // --------------------------------------------------------------------- 00061 // --------------------------------------------------------------------- 00062 // ===================================================================== 00063 /* 00064 \fn ComputeLUT 00065 \brief Virtual function which should be implemented by the child classes. 00066 It computes the LUT of the scanner from a generic (.geom) file. 00067 The vScanner implementation throws error by default as it should be implemented by the child class 00068 \todo Make the mother function virtual pure ? (should iScannerSinogram also implement this function ?) 00069 \todo iScannerCT implementation will probably consists in computing one projection, then computing 00070 the others on-the-fly during reconstruction (Often too much data to keep in memory for CT) 00071 Have to check if we offer the precomputation of the entire LUT in some situation, as for PET/SPECT 00072 \return 1 (error) if not surcharged by a daughter class 00073 */ 00074 int vScanner::ComputeLUT() 00075 { 00076 Cerr("*****vScanner::ComputeLUT()-> Error : call to ComputeLUT() which is not implemented by the scanner child class !" << endl); 00077 return 1; 00078 } 00079 00080 00081 00082 // ===================================================================== 00083 // --------------------------------------------------------------------- 00084 // --------------------------------------------------------------------- 00085 // ===================================================================== 00086 /* 00087 \fn LoadLUT 00088 \brief Virtual function which should be implemented by the child classes. 00089 Load a precomputed scanner LUT. 00090 The vScanner implementation throws error by default as it should be implemented by the child class 00091 \todo Make the mother function virtual pure ? (should iScannerSinogram also implement this function ?) 00092 \todo iScannerCT implementation will probably consists in computing one projection, then computing 00093 the others on-the-fly during reconstruction (Often too much data to keep in memory for CT) 00094 Have to check if we offer the precomputation of the entire LUT in some situation, as for PET/SPECT 00095 \return 1 (error) if not surcharged by a daughter class 00096 */ 00097 int vScanner::LoadLUT() 00098 { 00099 Cerr("*****vScanner::ComputeLUT()-> Error : call to ComputeLUT() which is not implemented by the scanner child class !" << endl); 00100 return 1; 00101 } 00102 00103 00104 00105 // ===================================================================== 00106 // --------------------------------------------------------------------- 00107 // --------------------------------------------------------------------- 00108 // ===================================================================== 00109 // ----- PET Specific Functions --- // 00110 /* 00111 \fn IsAvailableLOR 00112 \param a_elt1 : index of the 1st scanner element 00113 \param a_elt2 : index of the 2nd scanner element 00114 \brief This function is implemented in child classes. 00115 Check if the LOR is available according to the scanner restrictions 00116 \details This function is related to analytic projection and list-mode sensitivity image generation 00117 \return 1 if the LOR is available, 0 otherwise (vScanner implementation returns 1 by default) 00118 */ 00119 int vScanner::IsAvailableLOR(int a_elt1, int a_elt2) 00120 { 00121 Cerr("***** vScanner::IsAvailableLOR() -> This function is not implemented by the Instantiated scanner class !!" << endl); 00122 Cerr(" This function only works with PET scanner objects !!" << endl); 00123 return 1; 00124 } 00125 00126 00127 00128 00129 // ===================================================================== 00130 // --------------------------------------------------------------------- 00131 // --------------------------------------------------------------------- 00132 // ===================================================================== 00133 /* 00134 \fn SetPETMaxRingDiff 00135 \param a_maxRingDiff 00136 \brief Set the maximal ring difference 00137 \details This function is surcharged by the PET scanner daughter class 00138 Returns an error by default. 00139 \return 1 (error) if not surcharged by a daughter class 00140 */ 00141 int vScanner::SetPETMaxRingDiff(int a_maxRingDiff) 00142 { 00143 Cerr("***** vScanner::SetPETMaxRingDiff() -> This function is not implemented by the Instantiated scanner class !!" << endl); 00144 Cerr(" This function only works with PET scanner objects !!" << endl); 00145 return 1; 00146 } 00147 00148 // ===================================================================== 00149 // --------------------------------------------------------------------- 00150 // --------------------------------------------------------------------- 00151 // ===================================================================== 00152 /* 00153 \fn GetScannerLayerNbRings 00154 \param a_layer 00155 \brief Return an error by default. 00156 \details This function is surcharged by the PET scanner daughter class 00157 \return 1 (error) if not surcharged by a daughter class 00158 */ 00159 int vScanner::GetScannerLayerNbRings(int a_layer) 00160 { 00161 Cerr("***** vScanner::GetScannerNbRings() -> This function is not implemented by the Instantiated scanner class !!" << endl); 00162 Cerr(" This function only works with PET scanner objects !!" << endl); 00163 return 1; 00164 } 00165 00166 00167 00168 // ===================================================================== 00169 // --------------------------------------------------------------------- 00170 // --------------------------------------------------------------------- 00171 // ===================================================================== 00172 /* 00173 \fn PROJ_GetPETSpecificParameters 00174 \param ap_maxRingDiff 00175 \brief Get geometric PET specific parameters to initialize the datafile 00176 \details This function is surcharged by the PET scanner daughter classes 00177 Returns an error by default. 00178 \return 1 (error) if not surcharged by a daughter class 00179 */ 00180 int vScanner::PROJ_GetPETSpecificParameters(int* ap_maxRingDiff) 00181 { 00182 Cerr("***** vScanner::SetPETMaxRingDiff() -> This function is not implemented by the Instantiated scanner class !!" << endl); 00183 Cerr(" This function only works with PET scanner objects !!" << endl); 00184 return 1; 00185 } 00186 00187 00188 00189 // ===================================================================== 00190 // --------------------------------------------------------------------- 00191 // --------------------------------------------------------------------- 00192 // ===================================================================== 00193 // ----- SPECT Specific Functions --- // 00194 /* 00195 \fn GetSPECTSpecificParameters 00196 \param ap_nbOfProjections 00197 \param ap_nbHeads 00198 \param ap_nbOfBins 00199 \param ap_pixSizeXY 00200 \param ap_angles 00201 \param ap_CORtoDetectorDistance 00202 \param ap_headRotDirection 00203 \brief Recover geometric SPECT specific parameters from the scanner to initialize the datafile 00204 \details This function is surcharged by the SPECT scanner daughter classes 00205 Returns an error by default. 00206 \return 1 (error) if not surcharged by a daughter class 00207 */ 00208 int vScanner::GetSPECTSpecificParameters(uint16_t* ap_nbOfProjections, 00209 uint16_t* ap_nbHeads, 00210 uint16_t* ap_nbOfBins, 00211 FLTNB* ap_pixSizeXY, 00212 FLTNB*& ap_angles, 00213 FLTNB*& ap_CORtoDetectorDistance, 00214 int* ap_headRotDirection) 00215 { 00216 Cerr("***** vScanner::GetSPECTSpecificParameters() -> This function is not implemented by the Instantiated scanner class !!" << endl); 00217 Cerr(" This function only works with SPECT scanner objects !!" << endl); 00218 return 1; 00219 } 00220 00221 00222 00223 // ===================================================================== 00224 // --------------------------------------------------------------------- 00225 // --------------------------------------------------------------------- 00226 // ===================================================================== 00227 /* 00228 \fn PROJ_SetSPECTNbBins 00229 \param ap_nbOfBins 00230 \brief Set SPECT number of Bins 00231 \details This function is surcharged by the SPECT scanner daughter classes 00232 Returns an error by default. 00233 \return 1 (error) if not surcharged by a daughter class 00234 */ 00235 int vScanner::PROJ_SetSPECTNbBins(uint16_t* ap_nbOfBins) 00236 { 00237 Cerr("***** vScanner::PROJ_SetSPECTNbBins() -> This function is not implemented by the Instantiated scanner class !!" << endl); 00238 Cerr(" This function only works with SPECT scanner objects !!" << endl); 00239 return 1; 00240 } 00241 00242 00243 00244 // ===================================================================== 00245 // --------------------------------------------------------------------- 00246 // --------------------------------------------------------------------- 00247 // ===================================================================== 00248 /* 00249 \fn PROJ_SetSPECTNbProjections 00250 \param a_nbOfProjections 00251 \brief Set SPECT number of views 00252 \details This function is surcharged by the SPECT scanner daughter classes 00253 Returns an error by default. 00254 \return 1 (error) if not surcharged by a daughter class 00255 */ 00256 int vScanner::PROJ_SetSPECTNbProjections(uint32_t a_nbOfProjections) 00257 { 00258 Cerr("***** vScanner::PROJ_SetSPECTNbProjections() -> This function is not implemented by the Instantiated scanner class !!" << endl); 00259 Cerr(" This function only works with SPECT scanner objects !!" << endl); 00260 return 1; 00261 } 00262 00263 00264 00265 00266 // ===================================================================== 00267 // --------------------------------------------------------------------- 00268 // --------------------------------------------------------------------- 00269 // ===================================================================== 00270 /* 00271 \fn PROJ_SetSPECTRotDirection 00272 \param a_rotDirection 00273 \brief Set head rotation orientation 00274 \details This function is surcharged by the SPECT scanner daughter classes 00275 Returns an error by default. 00276 \return 1 (error) if not surcharged by a daughter class 00277 */ 00278 int vScanner::PROJ_SetSPECTRotDirection( string a_rotDirection ) 00279 { 00280 Cerr("***** vScanner::PROJ_SetSPECTRotDirection() -> This function is not implemented by the Instantiated scanner class !!" << endl); 00281 Cerr(" This function only works with SPECT scanner objects !!" << endl); 00282 return 1; 00283 } 00284 00285 00286 00287 00288 // ===================================================================== 00289 // --------------------------------------------------------------------- 00290 // --------------------------------------------------------------------- 00291 // ===================================================================== 00292 /* 00293 \fn PROJ_SetSPECTAngles 00294 \param ap_projectionAngles 00295 \brief Set SPECT projection angles 00296 \details This function is surcharged by the SPECT scanner daughter classes 00297 Returns an error by default. 00298 \return 1 (error) if not surcharged by a daughter class 00299 */ 00300 int vScanner::PROJ_SetSPECTAngles(FLTNB* a2p_projectionAngles) 00301 { 00302 Cerr("***** vScanner::SetSPECTAngles() -> This function is not implemented by the Instantiated scanner class !!" << endl); 00303 Cerr(" This function only works with SPECT scanner objects !!" << endl); 00304 return 1; 00305 } 00306 00307 00308 00309 // ===================================================================== 00310 // --------------------------------------------------------------------- 00311 // --------------------------------------------------------------------- 00312 // ===================================================================== 00313 /* 00314 \fn PROJ_SetSPECTCORtoDetectorDistance 00315 \param a_CORtoDetectorDistance 00316 \brief Set distance between center of rotation and SPECT detectors 00317 \details This function is surcharged by the SPECT scanner daughter classes 00318 Returns an error by default. 00319 \return 1 (error) if not surcharged by a daughter class 00320 */ 00321 int vScanner::PROJ_SetSPECTCORtoDetectorDistance(FLTNB a_CORtoDetectorDistance) 00322 { 00323 Cerr("***** vScanner::SetSPECTCORtoDetectorDistance() -> This function is not implemented by the Instantiated scanner class !!" << endl); 00324 Cerr(" This function only works with SPECT scanner objects !!" << endl); 00325 return 1; 00326 } 00327 00328 00329 00330 // ===================================================================== 00331 // --------------------------------------------------------------------- 00332 // --------------------------------------------------------------------- 00333 // ===================================================================== 00334 /* 00335 \fn PROJ_GetSPECTNbProjections 00336 \brief return the total number of projections for a SPECT acquisition 00337 \details This function is surcharged by the SPECT scanner daughter classes 00338 Returns an error by default. 00339 \return 1 (error) if not surcharged by a daughter class 00340 */ 00341 uint16_t vScanner::PROJ_GetSPECTNbProjections() 00342 { 00343 Cerr("***** vScanner::GetSPECTNbProjections() -> This function is not implemented by the Instantiated scanner class !!" << endl); 00344 Cerr(" This function only works with SPECT scanner objects !!" << endl); 00345 return 1; 00346 } 00347 00348 00349 00350 // ===================================================================== 00351 // --------------------------------------------------------------------- 00352 // --------------------------------------------------------------------- 00353 // ===================================================================== 00354 /* 00355 \fn PROJ_GetSPECTNbPixels 00356 \brief return the total number of pixels for a SPECT reconstruction 00357 \details This function is surcharged by the SPECT scanner daughter classes 00358 Returns an error by default. 00359 \return 1 (error) if not surcharged by a daughter class 00360 */ 00361 uint16_t vScanner::PROJ_GetSPECTNbPixels() 00362 { 00363 Cerr("***** vScanner::GetSPECTNbPixels() -> This function is not implemented by the Instantiated scanner class !!" << endl); 00364 Cerr(" This function only works with SPECT scanner objects !!" << endl); 00365 return 1; 00366 } 00367