aimsdata  5.0.5
Neuroimaging data handling
sino.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 #ifndef AIMS_SINO_SINO_H
35 #define AIMS_SINO_SINO_H
36 
37 #include <aims/data/data_g.h>
38 #include <aims/io/ecatSinoheader.h>
39 #include <ecat+/io/io.h>
40 #include <iostream>
41 
42 
43 namespace aims
44 {
45 
49  {
50  public:
51  // Ring Difference = cros
52  ScannerConf( int ring, int numSeg, int ringDiff, int span, int numAngles, int numBin,
53  float zResolution, float binResolution, float faceRadius ) ;
54  ScannerConf( UnifiedEcatSinoInfo *u );
55  ScannerConf( const ScannerConf &s);
57 
58  int getSpan() const {return _span ; }
59  int getMaxSeg() const{ return _numSeg; }
60  int getZ( int segment ) const { return _numZ[ segment ]; }
61  int getNumAngles() const {return _numAngles ; }
62  int getNumBins() const { return _numBins ;}
63  float getZResolution() const {return _zResolution ;}
64  float getXResolution() const {return _binResolution ;}
65 
66  bool operator!=(const ScannerConf& conf) const ;
67 
69  //private:
70  int _ring;
71  int _ringDiff;
72  int _span;
73  int _numSeg;
74  int _numAngles ;
75  int _numBins ;
76 
77  float _zResolution ;
79  std::vector<int> _numZ;
80  };
81  static ScannerConf ecatHRPlusUsual(63, 5, 22, 9, 0, 0, 0., 0., 0.);
82 
83 
84  template <class T>
86  {
87  public:
88  enum Mode { VIEW, SINO };
89 
90  Sinogram( const ScannerConf& conf = ecatHRPlusUsual ) :
91  _scannerConfig(conf)
92  {
93  _internalMode = Sinogram<T>::VIEW;
94  _displayMode = Sinogram<T>::VIEW;
95  }
96  Sinogram( const ScannerConf& conf, Sinogram<T>::Mode create_mode );
97 
98  // To Do !!! Ne pas oublier de donner des sizeX et sizeY aux aimsData en dessous du premier, pour que getPlaneInInternalMode fonctionne.
99  void allocate( int, int );
100 
102  { return _internalMode; }
103 
104  void setInternalMode( const Sinogram<T>::Mode& /*internalMode*/ )
105  {
106  ASSERT( 0 ); //not coded yet.
107  }
108 
110  { return _displayMode; }
111 
112  void setDisplayMode( Mode displayMode)
113  { _displayMode = displayMode; }
114 
115 
116  AimsData<AimsData<AimsData< T > > >& start() { return _bin; }
117 
118  int transCodeSegment( int s) const ;
119  int getZ( int segment ) { return _scannerConfig.getZ(segment); };
120 
122  {}
123 
124  Sinogram<T>& operator = (const Sinogram<T>& other);
125 
126  inline T& operator() ( int segment, int zOrAlpha, int alphaOrZ, int ro )
127  {
128  if( _internalMode == _displayMode )
129  return _bin( segment )( zOrAlpha )( ro, alphaOrZ );
130  else
131  return _bin( segment )( alphaOrZ )( ro, zOrAlpha );
132  }
133 
134  inline AimsData< AimsData< T > >& operator() ( int segment )
135  { return _bin( segment ); }
136 
137  AimsData<T> getPlaneInDisplayMode( int, int );
138  AimsData<T>& getPlaneInInternalMode( int, int );
139 
140  AimsData<T> extractView( int, int );
141  AimsData<T>& getView( int, int);
142  const AimsData<T>& getView( int, int ) const;
143 
144  AimsData<T> extractSino( int, int );
145  AimsData<T>& getSino( int, int );
146  const AimsData<T>& getSino( int, int ) const;
147 
148  const aims::PythonHeader& header() const { return _header; } ;
149  void setHeader( const PythonHeader& hdr )
150  {
151  _header.copy( hdr ) ;
152  }
153 
154  int getNumAngles() const ;
155  int getNumPlanes( int seg ) const ;
156  int getNumBins() const ;
157  int getNumSeg() const ;
158 
159 
160  int getRing() const { return _scannerConfig._ring; }
161  int getSpan() const { return _scannerConfig._span; }
162  int getRingDiff() const { return _scannerConfig._ringDiff; }
163 
164  std::string getFileType() const ;
165  std::string getEcatFileType() const ;
166  short getSystemType() const ;
167  unsigned int getScanStartTime() const ;
168  std::string getRadioPharmaceutical() const ;
169  std::string getIsotopeName() const ;
170  float getIsotopeHalfLife() const ;
171  float getDistanceScanned() const ;
172  float getTransaxialFOV() const ;
173  short getAngularCompression() const ;
174  std::string getStudyType() const ;
175  short getPatientOrientation() const ;
176  float getPlaneSeparation() const ;
177  short getTotalNumPlanes() const ;
178  int getMultiFileType() const ; // Is it a multi bed, multi frame or multi gate
179  float getInitBedPosition() const ;
180  short getLowerTrueThreshold() const ;
181  short getUpperTrueThreshold() const ;
182  short getAcquisitionMode() const ;
183  short getAcquisitionType() const ;
184  float getBinSize() const ;
185  float getBranchingFraction() const ;
186  unsigned int getDoseStartTime() const ;
187  float getBedElevation() const ;
188  short getCoinSampleMode() const ;
189  short getAxialSampleMode() const ;
190  float getCalibrationFactor() const ;
191  std::vector<float> getBedOffset() const ;
192  short getLowerScatterThreshold() const ;
193  float getDosage() const ;
194  float getWellCounterFactor() const ;
195  short getSeptaState() const ;
196  float getXResolution() const ;
197  float getVResolution() const ;
198  float getZResolution() const ;
199  float getWResolution() const ;
200  short getScanMin() const ;
201  short getScanMax() const ;
202 
203  int getPrompts() const ;
204  std::vector<float> getUncorrectedSingles( ) const ;
205  int getDelayed() const ;
206  int getMultiples() const ;
207  int getTrues() const ;
208  float getTotalAverageCorrected() const ;
209  float getTotalAverageUncorrected() const ;
210  int getTotalCoinRate() const ;
211  float getDeadTimeCorrectionFactor() const ;
212  unsigned int getStartTime() const ;
213  unsigned int getDurationTime() const ;
214  unsigned int getGateDuration() const ;
215 
216  void setFileType(const std::string& fileType);
217  void setEcatFileType( const std::string& fileType ) ;
218  void setSystemType( short systemType) ;
219  void setScanStartTime( unsigned int scanStartTime) ;
220 
221  void setPrompts( int prompts);
222  void setUncorrectedSingles( const std::vector<float>& uncorrSingles ) ;
223  void setDelayed( int delayed);
224  void setMultiples( int multiples);
225  void setTrues( int trues);
226 
227  void setTotalAverageCorrected( float ) ;
228  void setTotalAverageUncorrected( float) ;
229  void setTotalCoinRate( int) ;
230  void setDeadTimeCorrectionFactor(float) ;
231  void setStartTime(unsigned int) ;
232  void setDurationTime(unsigned int) ;
233  void setGateDuration(unsigned int) ;
234 
235  void setRadioPharmaceutical(const std::string& radiopharmaceutical) ;
236  void setIsotopeName(const std::string& isotopeName);
237  void setIsotopeHalfLife(float isotopeHalfLife);
238  void setDistanceScanned(float DistanceScanned);
239  void setTransaxialFOV(float TransaxialFOV);
240  void setAngularCompression(short AngularCompression);
241  void setStudyType(const std::string& StudyType);
242  void setPatientOrientation(short PatientOrientation);
243  void setPlaneSeparation(float planeSep) ;
244  void setTotalNumPlanes(short NumPlanes);
245  void setMultiFileType( int MultiFileType );
246  void setInitBedPosition(float InitBedPosition);
247  void setLowerTrueThreshold(short LowerTrueThreshold);
248  void setUpperTrueThreshold(short UpperTrueThreshold);
249  void setAcquisitionMode(short AquisitionMode);
250  void setAcquisitionType(short AquisitionType);
251  void setBinSize(float BinSize);
252  void setBranchingFraction(float BranchingFraction);
253  void setDoseStartTime(unsigned int DoseStartTime);
254  void setBedElevation (float) ;
255  void setCoinSampleMode (short) ;
256  void setAxialSampleMode (short) ;
257  void setCalibrationFactor (float) ;
258  void setBedOffset (const std::vector<float>&) ;
259  void setLowerScatterThreshold (short) ;
260  void setDosage (float) ;
261  void setWellCounterFactor (float) ;
262  void setSeptaState (short) ;
263  void setXResolution (float) ;
264  void setVResolution (float) ;
265  void setZResolution (float) ;
266  void setWResolution (float) ;
267  void setScanMin(short scanMin) ;
268  void setScanMax(short scanMax) ;
269 
270  void printHeader() const ;
271  Sinogram<T> clone() const ;
272 
273  const ScannerConf& getScannerConf() const { return _scannerConfig ; }
274  private:
275  PythonHeader _header ;
277  Mode _internalMode;
278  Mode _displayMode;
279  ScannerConf _scannerConfig;
280  };
281 }
282 
283 #endif
int getSpan() const
Definition: sino.h:58
float getZResolution() const
Definition: sino.h:63
Attributed python-like header, stores all needed information about an object, currently used for volu...
Definition: pheader.h:51
ScannerConf(int ring, int numSeg, int ringDiff, int span, int numAngles, int numBin, float zResolution, float binResolution, float faceRadius)
int getNumAngles() const
Definition: sino.h:61
int getRingDiff() const
Definition: sino.h:162
float getXResolution() const
Definition: sino.h:64
#define AIMSDATA_API
The class for EcatSino data write operation.
Definition: border.h:44
float _zResolution
Definition: sino.h:77
int getSpan() const
Definition: sino.h:161
int getRing() const
Definition: sino.h:160
AimsData< AimsData< AimsData< T > > > & start()
Definition: sino.h:116
int getZ(int segment) const
Definition: sino.h:60
An attempt to efficiently manage view/sinogram acquisition PET data.
Definition: sino.h:48
Mode getInternalMode() const
Definition: sino.h:101
void setInternalMode(const Sinogram< T >::Mode &)
Definition: sino.h:104
int getZ(int segment)
Definition: sino.h:119
void setDisplayMode(Mode displayMode)
Definition: sino.h:112
void setHeader(const PythonHeader &hdr)
Definition: sino.h:149
std::vector< int > _numZ
Definition: sino.h:79
int _ringDiff
Definition: sino.h:71
int _numAngles
Definition: sino.h:74
const ScannerConf & getScannerConf() const
Definition: sino.h:273
int getMaxSeg() const
Definition: sino.h:59
float _binResolution
Definition: sino.h:78
bool operator!=(const ScannerConf &conf) const
ScannerConf & operator=(const ScannerConf &)
int getNumBins() const
Definition: sino.h:62
#define ASSERT(EX)
int _numBins
Definition: sino.h:75
Mode displayMode()
Definition: sino.h:109
Sinogram(const ScannerConf &conf=ecatHRPlusUsual)
Definition: sino.h:90
const aims::PythonHeader & header() const
Definition: sino.h:148