CASToR  1.1
Tomographic Reconstruction (PET/SPECT)
 All Classes Files Functions Variables Typedefs Macros Groups Pages
vScanner.cc
Go to the documentation of this file.
1 
2 /*
3  Implementation of class vScanner
4 
5  - separators: X
6  - doxygen: X
7  - default initialization: X
8  - CASTOR_DEBUG: none
9  - CASTOR_VERBOSE: none
10 */
11 
18 #include "sScannerManager.hh"
19 #include "vScanner.hh"
20 
21 
22 
23 // =====================================================================
24 // ---------------------------------------------------------------------
25 // ---------------------------------------------------------------------
26 // =====================================================================
27 
29 {
30  // Initialize all members to default values
32  m_verbose = -1;
33  m_allParametersChecked = false;
34  mp_rotationMatrix = NULL;
35  mp_positionMatrix_ref = NULL;
36  mp_positionMatrix_out = NULL;
39 }
40 
41 // =====================================================================
42 // ---------------------------------------------------------------------
43 // ---------------------------------------------------------------------
44 // =====================================================================
45 
47 {
51 }
52 
53 
54 
55 // =====================================================================
56 // ---------------------------------------------------------------------
57 // ---------------------------------------------------------------------
58 // =====================================================================
59 /*
60  \fn ComputeLUT
61  \brief Virtual function which should be implemented by the child classes.
62  It computes the LUT of the scanner from a generic (.geom) file.
63  The vScanner implementation throws error by default as it should be implemented by the child class
64  \todo Make the mother function virtual pure ? (should iScannerSinogram also implement this function ?)
65  \todo iScannerCT implementation will probably consists in computing one projection, then computing
66  the others on-the-fly during reconstruction (Often too much data to keep in memory for CT)
67  Have to check if we offer the precomputation of the entire LUT in some situation, as for PET/SPECT
68  \return 1 (error) if not surcharged by a daughter class
69 */
71 {
72  Cerr("***** vScanner::ComputeLUT() -> Call to ComputeLUT() which is not implemented by the scanner child class !" << endl);
73  return 1;
74 }
75 
76 
77 
78 // =====================================================================
79 // ---------------------------------------------------------------------
80 // ---------------------------------------------------------------------
81 // =====================================================================
82 /*
83  \fn LoadLUT
84  \brief Virtual function which should be implemented by the child classes.
85  Load a precomputed scanner LUT.
86  The vScanner implementation throws error by default as it should be implemented by the child class
87  \todo Make the mother function virtual pure ? (should iScannerSinogram also implement this function ?)
88  \todo iScannerCT implementation will probably consists in computing one projection, then computing
89  the others on-the-fly during reconstruction (Often too much data to keep in memory for CT)
90  Have to check if we offer the precomputation of the entire LUT in some situation, as for PET/SPECT
91  \return 1 (error) if not surcharged by a daughter class
92 */
94 {
95  Cerr("***** vScanner::ComputeLUT() -> Call to ComputeLUT() which is not implemented by the scanner child class !" << endl);
96  return 1;
97 }
98 
99 
100 
101 // =====================================================================
102 // ---------------------------------------------------------------------
103 // ---------------------------------------------------------------------
104 // =====================================================================
105 // ----- PET Specific Functions --- //
106 /*
107  \fn IsAvailableLOR
108  \param a_elt1 : index of the 1st scanner element
109  \param a_elt2 : index of the 2nd scanner element
110  \brief This function is implemented in child classes.
111  Check if the LOR is available according to the scanner restrictions
112  \details This function is related to analytic projection and list-mode sensitivity image generation
113  \return 1 if the LOR is available, 0 otherwise (vScanner implementation returns 1 by default)
114 */
115 int vScanner::IsAvailableLOR(int a_elt1, int a_elt2)
116 {
117  Cerr("***** vScanner::IsAvailableLOR() -> This function is not implemented by the Instantiated scanner class !!" << endl);
118  Cerr(" This function only works with PET scanner objects !!" << endl);
119  return 1;
120 }
121 
122 
123 
124 
125 // =====================================================================
126 // ---------------------------------------------------------------------
127 // ---------------------------------------------------------------------
128 // =====================================================================
129 /*
130  \fn SetPETMaxRingDiff
131  \param a_maxRingDiff
132  \brief Set the maximal ring difference
133  \details This function is surcharged by the PET scanner daughter class
134  Returns an error by default.
135  \return 1 (error) if not surcharged by a daughter class
136 */
137 int vScanner::SetPETMaxRingDiff(int a_maxRingDiff)
138 {
139  Cerr("***** vScanner::SetPETMaxRingDiff() -> This function is not implemented by the Instantiated scanner class !!" << endl);
140  Cerr(" This function only works with PET scanner objects !!" << endl);
141  return 1;
142 }
143 
144 // =====================================================================
145 // ---------------------------------------------------------------------
146 // ---------------------------------------------------------------------
147 // =====================================================================
148 /*
149  \fn GetScannerLayerNbRings
150  \param a_layer
151  \brief Return an error by default.
152  \details This function is surcharged by the PET scanner daughter class
153  \return 1 (error) if not surcharged by a daughter class
154 */
156 {
157  Cerr("***** vScanner::GetScannerNbRings() -> This function is not implemented by the Instantiated scanner class !!" << endl);
158  Cerr(" This function only works with PET scanner objects !!" << endl);
159  return 1;
160 }
161 
162 
163 
164 // =====================================================================
165 // ---------------------------------------------------------------------
166 // ---------------------------------------------------------------------
167 // =====================================================================
168 /*
169  \fn PROJ_GetPETSpecificParameters
170  \param ap_maxRingDiff
171  \brief Get geometric PET specific parameters to initialize the datafile
172  \details This function is surcharged by the PET scanner daughter classes
173  Returns an error by default.
174  \return 1 (error) if not surcharged by a daughter class
175 */
177 {
178  Cerr("***** vScanner::SetPETMaxRingDiff() -> This function is not implemented by the Instantiated scanner class !!" << endl);
179  Cerr(" This function only works with PET scanner objects !!" << endl);
180  return 1;
181 }
182 
183 
184 
185 // =====================================================================
186 // ---------------------------------------------------------------------
187 // ---------------------------------------------------------------------
188 // =====================================================================
189 // ----- SPECT Specific Functions --- //
190 /*
191  \fn GetSPECTSpecificParameters
192  \param ap_nbOfProjections
193  \param ap_nbHeads
194  \param ap_nbOfBins
195  \param ap_pixSizeXY
196  \param ap_angles
197  \param ap_CORtoDetectorDistance
198  \param ap_headRotDirection
199  \brief Recover geometric SPECT specific parameters from the scanner to initialize the datafile
200  \details This function is surcharged by the SPECT scanner daughter classes
201  Returns an error by default.
202  \return 1 (error) if not surcharged by a daughter class
203 */
204 int vScanner::GetSPECTSpecificParameters(uint16_t* ap_nbOfProjections,
205  uint16_t* ap_nbHeads,
206  uint16_t* ap_nbOfBins,
207  FLTNB* ap_pixSizeXY,
208  FLTNB*& ap_angles,
209  FLTNB*& ap_CORtoDetectorDistance,
210  int* ap_headRotDirection)
211 {
212  Cerr("***** vScanner::GetSPECTSpecificParameters() -> This function is not implemented by the Instantiated scanner class !!" << endl);
213  Cerr(" This function only works with SPECT scanner objects !!" << endl);
214  return 1;
215 }
216 
217 
218 
219 
220 // =====================================================================
221 // ---------------------------------------------------------------------
222 // ---------------------------------------------------------------------
223 // =====================================================================
224 /*
225  \fn SetRotDirection
226  \param a_rotDirection
227  \brief Set rotation direction of the system
228  \details Set rotation direction of the scanner elements (head for SPECT, rsector/modules for PET)
229  for the generation of the geometry
230  \return 0 if success, positive value otherwise (unknown key)
231 */
232 int vScanner::SetRotDirection( string a_rotDirection )
233 {
234  if( a_rotDirection == "CCW" ||
235  a_rotDirection == "Ccw" ||
236  a_rotDirection == "ccw" )
238 
239  else if(a_rotDirection == "" || // Default
240  a_rotDirection == "CW" ||
241  a_rotDirection == "Cw" ||
242  a_rotDirection == "cw" )
244 
245  else
246  {
247  Cerr("***** vScanner::SetRotDirection -> Error while initializing rotation direction !" << endl);
248  Cerr(" "<< a_rotDirection <<"' is unknown. Direction must be 'CW' (clockwise) or 'CCW' (counter-clockwise).");
249  return 1;
250  }
251 
252  return 0;
253 }
254 
255 
256 // =====================================================================
257 // ---------------------------------------------------------------------
258 // ---------------------------------------------------------------------
259 // =====================================================================
260 /*
261  \fn PROJ_SetSPECTNbBins
262  \param ap_nbOfBins
263  \brief Set SPECT number of Bins
264  \details This function is surcharged by the SPECT scanner daughter classes
265  Returns an error by default.
266  \return 1 (error) if not surcharged by a daughter class
267 */
268 int vScanner::PROJ_SetSPECTNbBins(uint16_t* ap_nbOfBins)
269 {
270  Cerr("***** vScanner::PROJ_SetSPECTNbBins() -> This function is not implemented by the Instantiated scanner class !!" << endl);
271  Cerr(" This function only works with SPECT scanner objects !!" << endl);
272  return 1;
273 }
274 
275 
276 
277 // =====================================================================
278 // ---------------------------------------------------------------------
279 // ---------------------------------------------------------------------
280 // =====================================================================
281 /*
282  \fn PROJ_SetSPECTNbProjections
283  \param a_nbOfProjections
284  \brief Set SPECT number of views
285  \details This function is surcharged by the SPECT scanner daughter classes
286  Returns an error by default.
287  \return 1 (error) if not surcharged by a daughter class
288 */
289 int vScanner::PROJ_SetSPECTNbProjections(uint32_t a_nbOfProjections)
290 {
291  Cerr("***** vScanner::PROJ_SetSPECTNbProjections() -> This function is not implemented by the Instantiated scanner class !!" << endl);
292  Cerr(" This function only works with SPECT scanner objects !!" << endl);
293  return 1;
294 }
295 
296 
297 
298 
299 
300 
301 // =====================================================================
302 // ---------------------------------------------------------------------
303 // ---------------------------------------------------------------------
304 // =====================================================================
305 /*
306  \fn PROJ_SetSPECTAngles
307  \param ap_projectionAngles
308  \brief Set SPECT projection angles
309  \details This function is surcharged by the SPECT scanner daughter classes
310  Returns an error by default.
311  \return 1 (error) if not surcharged by a daughter class
312 */
313 int vScanner::PROJ_SetSPECTAngles(FLTNB* a2p_projectionAngles)
314 {
315  Cerr("***** vScanner::SetSPECTAngles() -> This function is not implemented by the Instantiated scanner class !!" << endl);
316  Cerr(" This function only works with SPECT scanner objects !!" << endl);
317  return 1;
318 }
319 
320 
321 
322 // =====================================================================
323 // ---------------------------------------------------------------------
324 // ---------------------------------------------------------------------
325 // =====================================================================
326 /*
327  \fn PROJ_SetSPECTCORtoDetectorDistance
328  \param a_CORtoDetectorDistance
329  \brief Set distance between center of rotation and SPECT detectors
330  \details This function is surcharged by the SPECT scanner daughter classes
331  Returns an error by default.
332  \return 1 (error) if not surcharged by a daughter class
333 */
335 {
336  Cerr("***** vScanner::SetSPECTCORtoDetectorDistance() -> This function is not implemented by the Instantiated scanner class !!" << endl);
337  Cerr(" This function only works with SPECT scanner objects !!" << endl);
338  return 1;
339 }
340 
341 
342 
343 // =====================================================================
344 // ---------------------------------------------------------------------
345 // ---------------------------------------------------------------------
346 // =====================================================================
347 /*
348  \fn PROJ_GetSPECTNbProjections
349  \brief return the total number of projections for a SPECT acquisition
350  \details This function is surcharged by the SPECT scanner daughter classes
351  Returns an error by default.
352  \return 1 (error) if not surcharged by a daughter class
353 */
355 {
356  Cerr("***** vScanner::GetSPECTNbProjections() -> This function is not implemented by the Instantiated scanner class !!" << endl);
357  Cerr(" This function only works with SPECT scanner objects !!" << endl);
358  return 1;
359 }
360 
361 
362 
363 // =====================================================================
364 // ---------------------------------------------------------------------
365 // ---------------------------------------------------------------------
366 // =====================================================================
367 /*
368  \fn PROJ_GetSPECTNbPixels
369  \brief return the total number of pixels for a SPECT reconstruction
370  \details This function is surcharged by the SPECT scanner daughter classes
371  Returns an error by default.
372  \return 1 (error) if not surcharged by a daughter class
373 */
375 {
376  Cerr("***** vScanner::GetSPECTNbPixels() -> This function is not implemented by the Instantiated scanner class !!" << endl);
377  Cerr(" This function only works with SPECT scanner objects !!" << endl);
378  return 1;
379 }
380 
virtual int PROJ_SetSPECTNbBins(uint16_t *ap_nbOfBins)
Set SPECT number of Bins.
Definition: vScanner.cc:268
virtual int PROJ_SetSPECTNbProjections(uint32_t a_nbOfProjections)
Set SPECT number of views.
Definition: vScanner.cc:289
#define FLTNB
Definition: gVariables.hh:55
virtual int PROJ_SetSPECTAngles(FLTNB *ap_projectionAngles)
Set SPECT projection angles.
Definition: vScanner.cc:313
oMatrix * mp_positionMatrix_out
Definition: vScanner.hh:368
virtual int PROJ_GetPETSpecificParameters(int *ap_maxRingDiff)
Get geometric PET specific parameters to initialize the datafile.
Definition: vScanner.cc:176
#define GEO_ROT_CCW
Definition: vScanner.hh:30
#define SCANNER_UNKNOWN
vScanner()
vScanner constructor. Initialize the member variables to their default values.
Definition: vScanner.cc:28
virtual uint16_t PROJ_GetSPECTNbProjections()
return the total number of projections for a SPECT acquisition
Definition: vScanner.cc:354
virtual int GetScannerLayerNbRings(int a_layer)
Return an error by default.
Definition: vScanner.cc:155
virtual uint16_t PROJ_GetSPECTNbPixels()
return the total number of pixels for a SPECT reconstruction
Definition: vScanner.cc:374
FLTNB m_multiBedDisplacementInMm
Definition: vScanner.hh:370
oMatrix * mp_rotationMatrix
Definition: vScanner.hh:366
#define Cerr(MESSAGE)
virtual int SetRotDirection(string a_rotDirection)
Set rotation direction of the system.
Definition: vScanner.cc:232
Declaration of class vScanner.
virtual ~vScanner()
vScanner destructor.
Definition: vScanner.cc:46
Declaration of class sScannerManager.
int m_verbose
Definition: vScanner.hh:364
virtual int ComputeLUT()
Virtual function which should be implemented by the child classes. It computes the LUT of the scann...
Definition: vScanner.cc:70
bool m_allParametersChecked
Definition: vScanner.hh:365
virtual int GetSPECTSpecificParameters(uint16_t *ap_nbOfProjections, uint16_t *ap_nbHeads, uint16_t *ap_nbOfBins, FLTNB *ap_pixSizeXY, FLTNB *&ap_angles, FLTNB *&ap_CORtoDetectorDistance, int *ap_headRotDirection)
Recover geometric SPECT specific parameters from the scanner to initialize the datafile.
Definition: vScanner.cc:204
virtual int PROJ_SetSPECTCORtoDetectorDistance(FLTNB a_CORtoDetectorDistance)
Set distance between center of rotation and SPECT detectors.
Definition: vScanner.cc:334
int m_scannerType
Definition: vScanner.hh:363
virtual int SetPETMaxRingDiff(int a_maxRingDiff)
Set the maximal ring difference.
Definition: vScanner.cc:137
oMatrix * mp_positionMatrix_ref
Definition: vScanner.hh:367
virtual int LoadLUT()
Virtual function which should be implemented by the child classes. Load a precomputed scanner LUT...
Definition: vScanner.cc:93
virtual int IsAvailableLOR(int a_elt1, int a_elt2)
This function is implemented in child classes. Check if the LOR is available according to the scann...
Definition: vScanner.cc:115
int m_rotDirection
Definition: vScanner.hh:369
#define GEO_ROT_CW
Definition: vScanner.hh:28