aimsdata  5.1.2
Neuroimaging data handling
sino_d.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 ECAT_SINO_D_H
35 #define ECAT_SINO_D_H
36 
37 #include <aims/sino/sino.h>
39 #include <iostream>
40 
41 
42 template < class T >
44 {
45  int tmp = int( float(s)/2.0 + .5);
46  return( s%2 ? tmp : -tmp );
47 }
48 
49 
50 
51 
52 template < class T >
54  : _internalMode( mode ), _displayMode( mode ), _scannerConfig(config)
55 {
56  //cout << "setting res" << endl ;
57  setXResolution( config._binResolution ) ;
58  setZResolution( config._zResolution ) ;
59 
60  //cout << "Res set" << endl ;
61 
62  _bin = AimsData<AimsData<AimsData<T> > >( _scannerConfig.getMaxSeg() );
63 
64  //cout << "Bin created" << endl ;
65  int i, j;
66 
67  if ( _internalMode == aims::Sinogram<T>::SINO )
68  {
69  ForEach1d(_bin, i)
70  {
71  _bin(i) = AimsData<AimsData<T > >( _scannerConfig.getZ(i) );
72  ForEach1d( _bin(i), j)
73  {
74  _bin(i)(j) = AimsData< T >( _scannerConfig.getNumBins(), _scannerConfig.getNumAngles() );
75  }
76  }
77  }
78  else if ( _internalMode == aims::Sinogram<T>::VIEW )
79  {
80  ForEach1d(_bin, i)
81  {
82  //cout << "segment " << i << endl ;
83  _bin(i) = AimsData<AimsData<T > >( _scannerConfig.getNumAngles() );
84  ForEach1d( _bin(i), j)
85  {
86  ( _bin(i) )(j) = AimsData< T >( _scannerConfig.getNumBins(), _scannerConfig.getZ(i) );
87  }
88  }
89  }
90  else
91  {
92  // Mettre un throw
93 //std:: cerr << "Cannot initialize properly a sinogram" << endl;
94  }
95  //_header = 0 ;
96 }
97 
98 template < class T >
100  int alpha)
101 {
102 
103  _bin = AimsData<AimsData<AimsData<T> > >( _scannerConfig.getMaxSeg() );
104 
105  int i, j;
106 
107  if ( _internalMode == aims::Sinogram<T>::SINO )
108  {
109  ForEach1d(_bin, i)
110  {
111  _bin(i) = AimsData<AimsData<T > >( _scannerConfig.getZ(i) );
112  ForEach1d( ( _bin(i) ), j)
113  {
114  ( _bin(i) )(j) = AimsData< T >( r, alpha);
115  }
116  }
117  }
118  else if ( _internalMode == aims::Sinogram<T>::VIEW )
119  {
120  ForEach1d(_bin, i)
121  {
122  _bin(i) = AimsData<AimsData<T > >( alpha );
123  ForEach1d( ( _bin(i) ), j)
124  {
125  ( _bin(i) )(j) = AimsData< T >( r, _scannerConfig.getZ(i) );
126  }
127  }
128  }
129  else
130  {
131  // Mettre un throw
132 //std:: cerr << "Cannot initialize properly a sinogram" << endl;
133  }
134 }
135 
136 
137 template < class T >
139 {
140  if ( &other == this )
141  return *this;
142 
143 
144  _header.copy(other._header) ;
145 
146 /* std::cout << "scanner config copy" << std::endl ; */
147  _scannerConfig = other._scannerConfig ;
148 /* std::cout << "scanner config copied" << std::endl ; */
149 
150  _internalMode = other._internalMode;
151  _displayMode = other._displayMode;
152  _bin = other._bin;
153 /* std::cout << "copy complete" << std::endl ; */
154  return *this;
155 }
156 
157 template < class T >
159 {
160 
161  return _bin(segment)(zOrAlpha) ;
162 }
163 
164 template < class T >
166 {
167  if( _displayMode == _internalMode ){
168 // cout << "Display mode == internal mode" << endl ;
169  return _bin(segment)(zOrAlpha).clone() ;
170  }
171 
172  int dimX = _bin(segment)(0).dimX() ;
173  int dimY = _bin(segment).dimX() ;
174  float sizeX = _bin(segment)(0).sizeX() ;
175  float sizeY = _bin(segment).sizeX() ;
176 
177 //std:: cout << "Display mode != Internal mode. dimX = " << dimX << "\tdimY = " << dimY << endl ;
178 
179  AimsData<T> plane( dimX, dimY ) ;
180  plane.setSizeXYZT( sizeX, sizeY ) ;
181  for( int alphaOrZ = 0 ; alphaOrZ < dimY ; ++alphaOrZ )
182  for( int ro = 0 ; ro < dimX ; ++ro )
183  plane(ro, alphaOrZ) = _bin(segment)(alphaOrZ)(ro, zOrAlpha) ;
184  return plane ;
185 }
186 
187 
188 
189 
190 template < class T >
192 {
193  if (_internalMode == aims::Sinogram<T>::VIEW)
194  {
195  return _bin(seg)(alpha).clone() ;
196  }
197  else
198  {
199  int dimX = _bin(seg)(0).dimX() ;
200  int dimY = _bin(seg).dimX() ;
201  float sizeX = _bin(seg)(0).sizeX() ;
202  float sizeY = _bin(seg).sizeX() ;
203 
204 // cout << "Display mode != Internal mode. dimX = "
205 // << dimX << "\tdimY = " << dimY << endl ;
206 
207  AimsData<T> plane( dimX, dimY ) ;
208  plane.setSizeXYZT( sizeX, sizeY ) ;
209  for( int z = 0 ; z < dimY ; ++z )
210  for( int ro = 0 ; ro < dimX ; ++ro )
211  plane(ro, z) = _bin(seg)(z)(ro, alpha) ;
212  return plane ;
213  }
214 }
215 
216 template < class T >
218 {
219  if (_internalMode != aims::Sinogram<T>::VIEW)
220  throw carto::format_error("Attempt to reference in VIEW mode when internal is SINO");
221 
222  return (_bin(seg))(alpha) ;
223 
224 }
225 
226 template < class T >
227 const AimsData<T>& aims::Sinogram<T>::getView( int seg, int alpha ) const
228 {
229  if (_internalMode != aims::Sinogram<T>::VIEW)
230  throw carto::format_error("Attempt to reference in VIEW mode when internal is SINO");
231 
232  return (_bin(seg))(alpha) ;
233 
234 }
235 
236 template < class T >
238 {
239  if (_internalMode == aims::Sinogram<T>::SINO)
240  {
241  return _bin(seg)(z).clone() ;
242  }
243  else
244  {
245  int dimX = _bin(seg)(0).dimX() ;
246  int dimY = _bin(seg).dimX() ;
247  float sizeX = _bin(seg)(0).sizeX() ;
248  float sizeY = _bin(seg).sizeX() ;
249 
250 // cout << "Display mode != Internal mode. dimX = "
251 // << dimX << "\tdimY = " << dimY << endl ;
252 
253  AimsData<T> plane( dimX, dimY ) ;
254  plane.setSizeXYZT( sizeX, sizeY ) ;
255  for( int alpha = 0 ; alpha < dimY ; ++alpha )
256  for( int ro = 0 ; ro < dimX ; ++ro )
257  plane(ro, alpha) = _bin(seg)(alpha)(ro, z) ;
258  return plane ;
259  }
260 }
261 
262 template < class T >
264 {
265  if (_internalMode != aims::Sinogram<T>::SINO)
266  throw
267  carto::format_error("Attempt to reference in SINO mode when internal is VIEW");
268 
269  return (_bin(seg))(z) ;
270 }
271 
272 template < class T >
273 const AimsData<T>& aims::Sinogram<T>::getSino( int seg, int z ) const
274 {
275  if (_internalMode != aims::Sinogram<T>::SINO)
276  throw
277  carto::format_error("Attempt to reference in SINO mode when internal is VIEW");
278 
279  return (_bin(seg))(z) ;
280 }
281 
282 
283 template < class T >
285 {
286  if (_internalMode == aims::Sinogram<T>::VIEW)
287  return( _bin(0).dimX() );
288  else
289  return( _bin(0)(0).dimY() );
290 }
291 
292 template < class T >
293 int aims::Sinogram<T>::getNumPlanes( int seg ) const
294 {
295  if (_internalMode == aims::Sinogram<T>::VIEW)
296  return( _bin(seg)(0).dimY() );
297  else
298  return( _bin(seg).dimX() );
299 }
300 
301 template < class T >
303 {
304  return( _bin(0)(0).dimX() );
305 }
306 
307 template < class T >
309 {
310  return _bin.dimX();
311 }
312 
313 template < class T >
315 {
316  std::string fileType;
317  _header.getProperty("file_type", fileType);
318  return fileType;
319 }
320 
321 template < class T >
323 {
324  std::string fileType;
325  _header.getProperty("ecat_file_type", fileType);
326  return fileType;
327 }
328 
329 template < class T >
331 {
332  short systemType;
333  _header.getProperty("ecat_system_type", systemType);
334  return systemType;
335 }
336 
337 template < class T >
339 {
340  unsigned int startTime;
341  _header.getProperty("ecat_scan_start_time", startTime);
342  return startTime;
343 }
344 
345 template < class T >
347 {
348  int prompts;
349  _header.getProperty("ecat_prompts", prompts);
350  return prompts;
351 }
352 
353 template < class T >
355 {
356  std::vector<float> us;
357  _header.getProperty( "ecat_uncor_singles", us);
358  return us ;
359 }
360 
361 template < class T >
363 {
364  int delayed;
365  _header.getProperty("ecat_delayed", delayed);
366  return delayed;
367 }
368 
369 template < class T >
371 {
372  int multiples;
373  _header.getProperty("ecat_multiples", multiples);
374  return multiples;
375 }
376 
377 template < class T >
379 {
380  int trues;
381  _header.getProperty("ecat_net_trues", trues);
382  return trues;
383 }
384 
385 template < class T >
386 float
388 {
389  float tac ;
390  _header.getProperty("ecat_tot_avg_cor", tac);
391  return tac;
392 }
393 
394 template < class T >
395 float
397 {
398  float tau ;
399  _header.getProperty("ecat_tot_avg_uncor", tau);
400  return tau;
401 }
402 
403 template < class T >
404  int
406 {
407  int tcr ;
408  _header.getProperty("ecat_total_coin_rate", tcr);
409  return tcr;
410 }
411 
412 template < class T >
413 float
415 {
416  float dtcf ;
417  _header.getProperty("ecat_loss_correction_fctr", dtcf);
418  return dtcf;
419 }
420 
421 
422 template < class T >
423 unsigned int
425 {
426  int st;
427 
428  _header.getProperty("ecat_frame_start_time", st);
429  return st;
430 
431 }
432 
433 template < class T >
434 unsigned int
436 {
437  int dt;
438 
439  _header.getProperty("ecat_frame_duration", dt);
440  return dt;
441 }
442 
443 template < class T >
444 unsigned int
446 {
447  int dt;
448 
449  _header.getProperty("ecat_gate_duration", dt);
450  return dt;
451 }
452 
453 
454 template < class T >
456 {
457  std::string radiopharmac ;
458 
459  _header.getProperty("ecat_radiopharmaceutical", radiopharmac);
460  return radiopharmac;
461 }
462 
463 template < class T >
465 {
466  std::string isotopeName;
467 
468  _header.getProperty("ecat_isotope_name", isotopeName);
469  return isotopeName;
470 }
471 
472 template < class T >
474 {
475  float isotopeHalfLife;
476 
477  _header.getProperty("ecat_isotope_halflife", isotopeHalfLife);
478  return isotopeHalfLife;
479 }
480 
481 template < class T >
483 {
484  float distanceScanned;
485 
486  _header.getProperty("ecat_distance_scanned", distanceScanned);
487  return distanceScanned;
488 }
489 
490 template < class T >
492 {
493  float transaxialFOV;
494 
495  _header.getProperty("ecat_transaxial_FOV", transaxialFOV);
496  return transaxialFOV;
497 }
498 
499 template < class T >
501 {
502  short angularCompression;
503 
504  _header.getProperty("ecat_angular_compression", angularCompression);
505  return angularCompression;
506 }
507 
508 template < class T >
510 {
511  std::string studyType;
512 
513  _header.getProperty("ecat_study_type", studyType);
514  return studyType;
515 }
516 
517 template < class T >
519 {
520  short patientOrientation;
521 
522  _header.getProperty("ecat_patient_orientation", patientOrientation);
523  return patientOrientation;
524 }
525 
526 template < class T >
528 {
529  float planeSeparation ;
530 
531  _header.getProperty("ecat_plane_separation", planeSeparation);
532  return planeSeparation;
533 }
534 
535 template < class T >
537 {
538  short numPlanes;
539 
540  _header.getProperty("ecat_num_planes", numPlanes);
541  return numPlanes;
542 }
543 
544 template < class T >
546 {
547  int multiFileType;
548 
549  _header.getProperty("multi_files_type", multiFileType);
550  return multiFileType;
551 }
552 
553 template < class T >
555 {
556  float InitBedPosition;
557 
558  _header.getProperty("ecat_init_bed_position", InitBedPosition);
559  return InitBedPosition;
560 }
561 
562 template < class T >
564 {
565  short LowerTrueThreshold;
566 
567  _header.getProperty("ecat_lwr_true_thres", LowerTrueThreshold);
568  return LowerTrueThreshold;
569 }
570 
571 template < class T >
573 {
574  short UpperTrueThreshold;
575 
576  _header.getProperty("ecat_upr_true_thres", UpperTrueThreshold);
577  return UpperTrueThreshold;
578 }
579 
580 template < class T >
582 {
583  short aquisitionMode;
584 
585  _header.getProperty("ecat_acquisition_mode", aquisitionMode);
586  return aquisitionMode;
587 }
588 
589 template < class T >
591 {
592  short aquisitionType;
593 
594  _header.getProperty("ecat_acquisition_type", aquisitionType);
595  return aquisitionType;
596 }
597 
598 template < class T >
600 {
601  float BinSize;
602 
603  _header.getProperty("ecat_bin_size", BinSize);
604  return BinSize;
605 }
606 
607 template < class T >
609 {
610  float BranchingFraction;
611 
612  _header.getProperty("ecat_branching_fraction", BranchingFraction);
613  return BranchingFraction;
614 }
615 
616 template < class T >
618 {
619  unsigned int DoseStartTime;
620 
621  _header.getProperty("ecat_dose_start_time", DoseStartTime);
622  return DoseStartTime;
623 }
624 
625 template < class T >
627 {
628  float bedElevation;
629 
630  _header.getProperty("ecat_bed_elevation", bedElevation);
631  return bedElevation;
632 }
633 
634 template < class T >
636 {
637  short coinSampleMode;
638 
639  _header.getProperty("ecat_coin_samp_mode", coinSampleMode);
640  return coinSampleMode;
641 }
642 
643 template < class T >
645 {
646  short axialSampleMode;
647 
648  _header.getProperty("ecat_axial_samp_mode", axialSampleMode);
649  return axialSampleMode;
650 }
651 
652 template < class T >
654 {
655  float calibrationFactor;
656 
657  _header.getProperty("ecat_calibration_factor", calibrationFactor);
658  return calibrationFactor;
659 }
660 
661 template < class T >
662 std::vector<float> aims::Sinogram<T>::getBedOffset() const
663 {
664  std::vector<float> bedOffset;
665 
666  _header.getProperty( "ecat_bed_offset", bedOffset);
667  return bedOffset ;
668 }
669 
670 template < class T >
672 {
673  short lowerScatterThreshold;
674 
675  _header.getProperty("ecat_lwr_sctr_thres", lowerScatterThreshold);
676  return lowerScatterThreshold;
677 }
678 
679 template < class T >
681 {
682  float dosage;
683 
684  _header.getProperty("ecat_dosage", dosage);
685  return dosage;
686 }
687 
688 template < class T >
690 {
691  float wellCounterFactor;
692 
693  _header.getProperty("ecat_well_counter_factor", wellCounterFactor);
694  return wellCounterFactor;
695 }
696 
697 template < class T >
699 {
700  short septaState;
701 
702  _header.getProperty("ecat_septa_state", septaState);
703  return septaState;
704 }
705 
706 template < class T >
708 {
709  float xRresolution;
710 
711  _header.getProperty("ecat_x_resolution", xRresolution);
712  return xRresolution;
713 }
714 
715 template < class T >
717 {
718  float vRresolution;
719 
720  _header.getProperty("ecat_v_resolution", vRresolution);
721  return vRresolution;
722 }
723 
724 template < class T >
726 {
727  float zRresolution;
728 
729  _header.getProperty("ecat_z_resolution", zRresolution);
730  return zRresolution;
731 }
732 
733 template < class T >
735 {
736  float wRresolution;
737 
738  _header.getProperty("ecat_w_resolution", wRresolution);
739  return wRresolution;
740 }
741 
742 template < class T >
744 {
745  short scanMin;
746 
747  _header.getProperty("ecat_scan_min", scanMin);
748  return scanMin;
749 }
750 
751 template < class T >
753 {
754  short scanMax;
755 
756  _header.getProperty("ecat_scan_max", scanMax);
757  return scanMax;
758 }
759 
760 
761 
762 
763 template < class T >
764 void aims::Sinogram<T>::setFileType(const std::string& fileType)
765 {
766  _header.setProperty("file_type", fileType);
767 }
768 
769 template < class T >
770 void aims::Sinogram<T>::setEcatFileType(const std::string& fileType)
771 {
772  _header.setProperty("ecat_file_type", fileType);
773 }
774 
775 template < class T >
776 void aims::Sinogram<T>::setSystemType(short systemType)
777 {
778  _header.setProperty( "ecat_system_type", systemType ) ;
779 }
780 
781 template < class T >
782 void aims::Sinogram<T>::setScanStartTime(unsigned int scanStartTime)
783 {
784  _header.setProperty( "ecat_scan_start_time", scanStartTime ) ;
785 }
786 
787 template < class T >
789 {
790  _header.setProperty("ecat_prompts", prompts);
791 }
792 
793 template < class T >
794 void aims::Sinogram<T>::setUncorrectedSingles( const std::vector<float>& uncorr )
795 {
796  _header.setProperty("ecat_uncor_singles", uncorr);
797 }
798 
799 template < class T >
801 {
802  _header.setProperty("ecat_delayed", delayed);
803 }
804 
805 template < class T >
807 {
808  _header.setProperty("ecat_multiples", multiples);
809 }
810 
811 template < class T >
813 {
814  _header.setProperty("ecat_net_trues", trues);
815 }
816 
817 template < class T >
819 {
820  _header.setProperty("ecat_tot_avg_cor", tac);
821 }
822 
823 template < class T >
825 {
826  _header.setProperty("ecat_tot_avg_uncor", tau);
827 }
828 
829 template < class T >
831 {
832  _header.setProperty("ecat_total_coin_rate", tcr);
833 }
834 
835 template < class T >
837 {
838  _header.setProperty("ecat_loss_correction_fctr", dtcf);
839 }
840 
841 template < class T >
842 void aims::Sinogram<T>::setStartTime(unsigned int st)
843 {
844  _header.setProperty("ecat_frame_start_time", st);
845 }
846 
847 template < class T >
849 {
850  _header.setProperty("ecat_frame_duration", dt);
851 }
852 
853 template < class T >
855 {
856  _header.setProperty("ecat_gate_duration", dt);
857 }
858 
859 template < class T >
860 void aims::Sinogram<T>::setRadioPharmaceutical(const std::string& radiopharmaceutical)
861 {
862  _header.setProperty("ecat_radiopharmaceutical", radiopharmaceutical);
863 }
864 
865 template < class T >
866 void aims::Sinogram<T>::setIsotopeName(const std::string& isotopeName)
867 {
868  _header.setProperty("ecat_isotope_code", isotopeName);
869 }
870 
871 template < class T >
872 void aims::Sinogram<T>::setIsotopeHalfLife(float isotopeHalfLife)
873 {
874  _header.setProperty("ecat_isotope_halflife", isotopeHalfLife);
875 }
876 
877 template < class T >
878 void aims::Sinogram<T>::setDistanceScanned(float DistanceScanned)
879 {
880  _header.setProperty("ecat_distance_scanned", DistanceScanned);
881 }
882 
883 template < class T >
884 void aims::Sinogram<T>::setTransaxialFOV(float TransaxialFOV)
885 {
886  _header.setProperty("ecat_transaxial_FOV", TransaxialFOV);
887 }
888 
889 template < class T >
890 void aims::Sinogram<T>::setAngularCompression(short AngularCompression)
891 {
892  _header.setProperty("ecat_angular_compression", AngularCompression);
893 }
894 
895 template < class T >
896 void aims::Sinogram<T>::setStudyType(const std::string& studyType)
897 {
898  _header.setProperty("ecat_study_type", studyType);
899 }
900 
901 template < class T >
902 void aims::Sinogram<T>::setPatientOrientation(short PatientOrientation)
903 {
904  _header.setProperty("ecat_patient_orientation", PatientOrientation);
905 }
906 
907 template < class T >
909 {
910  _header.setProperty("ecat_plane_separation", planeSep);
911 }
912 
913 template < class T >
915 {
916  _header.setProperty("ecat_num_planes", numPlanes);
917 }
918 
919 template < class T >
920 void aims::Sinogram<T>::setMultiFileType( int multiFileType )
921 {
922  _header.setProperty("multi_files_type", multiFileType);
923 }
924 
925 template < class T >
926 void aims::Sinogram<T>::setInitBedPosition(float InitBedPosition)
927 {
928  _header.setProperty("ecat_init_bed_position", InitBedPosition);
929 }
930 
931 template < class T >
932 void aims::Sinogram<T>::setLowerTrueThreshold(short LowerTrueThreshold)
933 {
934  _header.setProperty("ecat_lwr_true_thres", LowerTrueThreshold);
935 }
936 
937 template < class T >
938 void aims::Sinogram<T>::setUpperTrueThreshold(short UpperTrueThreshold)
939 {
940  _header.setProperty("ecat_upr_true_thres", UpperTrueThreshold);
941 }
942 
943 template < class T >
944 void aims::Sinogram<T>::setAcquisitionMode(short AquisitionMode)
945 {
946  _header.setProperty("ecat_acquisition_mode", AquisitionMode);
947 }
948 
949 template < class T >
950 void aims::Sinogram<T>::setAcquisitionType( short AquisitionType )
951 {
952  _header.setProperty( "ecat_acquisition_type", AquisitionType );
953 }
954 
955 template < class T >
956 void aims::Sinogram<T>::setBinSize(float BinSize)
957 {
958  _header.setProperty("ecat_bin_size", BinSize);
959 }
960 
961 template < class T >
962 void aims::Sinogram<T>::setBranchingFraction(float BranchingFraction)
963 {
964  _header.setProperty("ecat_branching_fraction", BranchingFraction);
965 }
966 
967 template < class T >
968 void aims::Sinogram<T>::setDoseStartTime(unsigned int DoseStartTime)
969 {
970  _header.setProperty("ecat_dose_start_time", DoseStartTime);
971 }
972 
973 template < class T >
974 void aims::Sinogram<T>::setBedElevation(float bedElevation)
975 {
976  _header.setProperty("ecat_bed_elevation", bedElevation);
977 }
978 
979 template < class T >
980 void aims::Sinogram<T>::setCoinSampleMode( short coinSampleMode )
981 {
982  _header.setProperty( "ecat_coin_sample_mode", coinSampleMode );
983 }
984 
985 template < class T >
986 void aims::Sinogram<T>::setAxialSampleMode( short axialSampleMode )
987 {
988  _header.setProperty( "ecat_axial_sample_mode", axialSampleMode );
989 }
990 
991 template < class T >
992 void aims::Sinogram<T>::setCalibrationFactor(float calibrationFactor)
993 {
994  _header.setProperty("ecat_calibration_factor", calibrationFactor);
995 }
996 
997 template < class T >
998 void aims::Sinogram<T>::setBedOffset(const std::vector<float>& bedOffset)
999 {
1000  _header.setProperty("ecat_bed_offset", bedOffset);
1001 }
1002 
1003 template < class T >
1004 void aims::Sinogram<T>::setLowerScatterThreshold( short lowerScatterThreshold )
1005 {
1006  _header.setProperty( "ecat_lwr_sctr_thres", lowerScatterThreshold );
1007 }
1008 
1009 template < class T >
1011 {
1012  _header.setProperty("ecat_dosage", dosage);
1013 }
1014 
1015 template < class T >
1016 void aims::Sinogram<T>::setWellCounterFactor(float wellCounterFactor)
1017 {
1018  _header.setProperty("ecat_well_counter_factor", wellCounterFactor);
1019 }
1020 
1021 template < class T >
1022 void aims::Sinogram<T>::setSeptaState( short septaState )
1023 {
1024  _header.setProperty( "ecat_septa_state", septaState );
1025 }
1026 
1027 template < class T >
1028 void aims::Sinogram<T>::setXResolution(float xResolution)
1029 {
1030  _header.setProperty("ecat_x_resolution", xResolution);
1031 }
1032 
1033 template < class T >
1034 void aims::Sinogram<T>::setVResolution(float vResolution)
1035 {
1036  _header.setProperty("ecat_v_resolution", vResolution);
1037 }
1038 
1039 template < class T >
1040 void aims::Sinogram<T>::setZResolution(float zResolution)
1041 {
1042  _header.setProperty("ecat_z_resolution", zResolution);
1043 }
1044 
1045 template < class T >
1046 void aims::Sinogram<T>::setWResolution(float wResolution)
1047 {
1048  _header.setProperty("ecat_w_resolution", wResolution);
1049 }
1050 
1051 template < class T >
1053 {
1054  _header.setProperty("ecat_scan_min", scanMin);
1055 }
1056 
1057 template < class T >
1059 {
1060  _header.setProperty("ecat_scan_max", scanMax);
1061 }
1062 
1063 template < class T >
1065 {
1066  //cout << "cloning" << endl ;
1067  //cout << "scanner config" << &getScannerConf() << endl ;
1068  this->getInternalMode() ;
1069  //cout << "1" << endl ;
1070 
1071  //cout << "2" << endl ;
1072  aims::Sinogram<T> copyOf(getScannerConf(), getInternalMode() ) ;
1073 
1074  //std::cout << "copy sino created " << std::endl ;
1075 
1076 /* std::cout << "setting header in clone" << std::endl ; */
1077  copyOf.setHeader( _header ) ;
1078 /* std::cout << "header set in clone" << std::endl ; */
1079  //std::cout << "header set" << std::endl ;
1080  AimsData< AimsData<AimsData<T> > > copyBin = copyOf.start() ;
1081  copyBin = AimsData< AimsData<AimsData<T> > >(_bin.dimX()) ;
1082  for( int seg = 0 ; seg < _bin.dimX() ; ++seg ){
1083  //std::cout << "seg = " << seg << std::endl ;
1084  copyBin(seg) = AimsData<AimsData<T> >(_bin(seg).dimX()) ;
1085  for( int thetaOrZ = 0 ; thetaOrZ < _bin(seg).dimX() ; ++thetaOrZ ){
1086  copyBin(seg)(thetaOrZ) = AimsData<T>(_bin(seg)(thetaOrZ).dimX(), _bin(seg)(thetaOrZ).dimY()) ;
1087  for( int zOrTheta = 0 ; zOrTheta < _bin(seg)(thetaOrZ).dimY() ; ++zOrTheta )
1088  for( int x = 0 ; x < _bin(seg)(thetaOrZ).dimX() ; ++x )
1089  copyOf(seg, thetaOrZ, zOrTheta, x ) = _bin(seg)(thetaOrZ)( x, zOrTheta ) ;
1090  }
1091  }
1092  return copyOf ;
1093 }
1094 
1095 template < class T >
1097 {
1098 /*std:: cout << "File Type : " << getFileType() << endl
1099  << "Ecat File Type : " << getEcatFileType() << endl
1100  << "System Type : " << getSystemType() << endl
1101  << "Scan Start Time : " << getScanStartTime() << endl
1102  << "Radio Pharmaceutical : " << getRadioPharmaceutical() << endl
1103  << "Isotope Name : " << getIsotopeName() << endl
1104  << "Isotope HalfLife : " << getIsotopeHalfLife() << endl
1105  << "Distance Scanned : " << getDistanceScanned() << endl
1106  << "Transaxial FOV : " << getTransaxialFOV() << endl
1107  << "Angular Compression : " << getAngularCompression() << endl
1108  << "Study Type : " << getStudyType() << endl
1109  << "Patient Orientation : " << getPatientOrientation() << endl
1110  << "Plane Separation : " << getPlaneSeparation() << endl
1111  << "Total Num Planes : " << getTotalNumPlanes() << endl
1112  << "Multi File Type : " << getMultiFileType() << endl
1113  << "Init Bed Position : " << getInitBedPosition() << endl
1114  << "Lower True Threshold : " << getLowerTrueThreshold() << endl
1115  << "Upper True Threshold : " << getUpperTrueThreshold() << endl
1116  << "Aquisition Mode : " << getAcquisitionMode() << endl
1117  << "Aquisition Type : " << getAcquisitionType() << endl
1118  << "Bin Size : " << getBinSize() << endl
1119  << "Branching Fraction : " << getBranchingFraction() << endl
1120  << "Dose Start Time : " << getDoseStartTime() << endl
1121  << "Prompts : " << getPrompts() << endl
1122  << "First Uncorrected Singles : " << getUncorrectedSingles()[0] << endl
1123  << "Fourth Uncorrected Singles : " << getUncorrectedSingles()[3] << endl
1124  << "Delayed : " << getDelayed() << endl
1125  << "Multiples : " << getMultiples() << endl
1126  << "Trues : " << getTrues() << endl
1127  << "Total Average Corrected : " << getTotalAverageCorrected() << endl
1128  << "Total Average Uncorrected : " << getTotalAverageUncorrected() << endl
1129  << "Total Coin Rate : " << getTotalCoinRate() << endl
1130  << "Dead Time Correction Factor : " << getDeadTimeCorrectionFactor() << endl
1131  << "Start Time : " << getStartTime() << endl
1132  << "Duration Time : " << getDurationTime() << endl
1133  << "Bed Elevation : " << getBedElevation()<< endl
1134  << "Coin Sample Mode : " << getCoinSampleMode()<< endl
1135  << "Axial Sample Mode : " << getAxialSampleMode()<< endl
1136  << "Calibration Factor : " << getCalibrationFactor()<< endl
1137  << "Bed Offset : " << getBedOffset()[0]<< endl
1138  << "Lower Scatter Threshold : " << getLowerScatterThreshold()<< endl
1139  << "Dosage : " << getDosage()<< endl
1140  << "Well Counter Factor : " << getWellCounterFactor()<< endl
1141  << "X Resolution : " << getXResolution()<< endl
1142  << "V Resolution : " << getVResolution()<< endl
1143  << "Z Resolution : " << getZResolution()<< endl
1144  << "W Resolution : " << getWResolution()<< endl
1145  << "Scan Min : " << getScanMin()<< endl
1146  << "Scan Max : " << getScanMax()<< endl ;
1147 */ }
1148 
1149 #endif
1150 
#define ForEach1d(thing, x)
void setSizeXYZT(float sizex=1.0f, float sizey=1.0f, float sizez=1.0f, float sizet=1.0f)
An attempt to efficiently manage view/sinogram acquisition PET data.
Definition: sino.h:49
float _zResolution
Definition: sino.h:77
float _binResolution
Definition: sino.h:78
int getNumAngles() const
Definition: sino.h:61
int getZ(int segment) const
Definition: sino.h:60
int getMaxSeg() const
Definition: sino.h:59
int getNumBins() const
Definition: sino.h:62
short getAcquisitionType() const
Definition: sino_d.h:590
void setEcatFileType(const std::string &fileType)
Definition: sino_d.h:770
void setSeptaState(short)
Definition: sino_d.h:1022
void setIsotopeHalfLife(float isotopeHalfLife)
Definition: sino_d.h:872
void setWellCounterFactor(float)
Definition: sino_d.h:1016
AimsData< T > extractSino(int, int)
Definition: sino_d.h:237
unsigned int getScanStartTime() const
Definition: sino_d.h:338
float getTotalAverageUncorrected() const
Definition: sino_d.h:396
short getCoinSampleMode() const
Definition: sino_d.h:635
unsigned int getGateDuration() const
Definition: sino_d.h:445
float getIsotopeHalfLife() const
Definition: sino_d.h:473
void setAcquisitionMode(short AquisitionMode)
Definition: sino_d.h:944
void setIsotopeName(const std::string &isotopeName)
Definition: sino_d.h:866
void setAngularCompression(short AngularCompression)
Definition: sino_d.h:890
void setTransaxialFOV(float TransaxialFOV)
Definition: sino_d.h:884
void setScanMin(short scanMin)
Definition: sino_d.h:1052
float getVResolution() const
Definition: sino_d.h:716
void setStudyType(const std::string &StudyType)
Definition: sino_d.h:896
unsigned int getDurationTime() const
Definition: sino_d.h:435
void setZResolution(float)
Definition: sino_d.h:1040
int getNumSeg() const
Definition: sino_d.h:308
int getNumBins() const
Definition: sino_d.h:302
short getAxialSampleMode() const
Definition: sino_d.h:644
void setLowerTrueThreshold(short LowerTrueThreshold)
Definition: sino_d.h:932
short getLowerTrueThreshold() const
Definition: sino_d.h:563
float getDeadTimeCorrectionFactor() const
Definition: sino_d.h:414
float getWellCounterFactor() const
Definition: sino_d.h:689
void setBranchingFraction(float BranchingFraction)
Definition: sino_d.h:962
void setStartTime(unsigned int)
Definition: sino_d.h:842
AimsData< T > & getSino(int, int)
Definition: sino_d.h:263
void setMultiples(int multiples)
Definition: sino_d.h:806
float getDistanceScanned() const
Definition: sino_d.h:482
void setScanStartTime(unsigned int scanStartTime)
Definition: sino_d.h:782
short getAngularCompression() const
Definition: sino_d.h:500
int transCodeSegment(int s) const
Definition: sino_d.h:43
AimsData< T > extractView(int, int)
Definition: sino_d.h:191
AimsData< T > getPlaneInDisplayMode(int, int)
Definition: sino_d.h:165
void setPrompts(int prompts)
Definition: sino_d.h:788
AimsData< T > & getView(int, int)
Definition: sino_d.h:217
void setTotalAverageUncorrected(float)
Definition: sino_d.h:824
std::string getStudyType() const
Definition: sino_d.h:509
void setDelayed(int delayed)
Definition: sino_d.h:800
short getScanMax() const
Definition: sino_d.h:752
AimsData< T > & getPlaneInInternalMode(int, int)
Definition: sino_d.h:158
float getXResolution() const
Definition: sino_d.h:707
std::string getIsotopeName() const
Definition: sino_d.h:464
void setCoinSampleMode(short)
Definition: sino_d.h:980
void setDosage(float)
Definition: sino_d.h:1010
void setTotalNumPlanes(short NumPlanes)
Definition: sino_d.h:914
void setXResolution(float)
Definition: sino_d.h:1028
float getTotalAverageCorrected() const
Definition: sino_d.h:387
void setFileType(const std::string &fileType)
Definition: sino_d.h:764
int getMultiples() const
Definition: sino_d.h:370
short getScanMin() const
Definition: sino_d.h:743
float getDosage() const
Definition: sino_d.h:680
void setVResolution(float)
Definition: sino_d.h:1034
void setCalibrationFactor(float)
Definition: sino_d.h:992
void setSystemType(short systemType)
Definition: sino_d.h:776
float getBedElevation() const
Definition: sino_d.h:626
Sinogram(const ScannerConf &conf=ecatHRPlusUsual)
Definition: sino.h:90
void setAxialSampleMode(short)
Definition: sino_d.h:986
void setTotalCoinRate(int)
Definition: sino_d.h:830
float getBranchingFraction() const
Definition: sino_d.h:608
void setDistanceScanned(float DistanceScanned)
Definition: sino_d.h:878
int getPrompts() const
Definition: sino_d.h:346
int getNumAngles() const
Definition: sino_d.h:284
unsigned int getStartTime() const
Definition: sino_d.h:424
short getSeptaState() const
Definition: sino_d.h:698
short getSystemType() const
Definition: sino_d.h:330
void setGateDuration(unsigned int)
Definition: sino_d.h:854
void setTrues(int trues)
Definition: sino_d.h:812
void setInitBedPosition(float InitBedPosition)
Definition: sino_d.h:926
short getTotalNumPlanes() const
Definition: sino_d.h:536
void setScanMax(short scanMax)
Definition: sino_d.h:1058
float getCalibrationFactor() const
Definition: sino_d.h:653
void setHeader(const PythonHeader &hdr)
Definition: sino.h:149
short getUpperTrueThreshold() const
Definition: sino_d.h:572
void setDoseStartTime(unsigned int DoseStartTime)
Definition: sino_d.h:968
void setBedOffset(const std::vector< float > &)
Definition: sino_d.h:998
void setLowerScatterThreshold(short)
Definition: sino_d.h:1004
float getBinSize() const
Definition: sino_d.h:599
AimsData< AimsData< AimsData< T > > > & start()
Definition: sino.h:116
int getTrues() const
Definition: sino_d.h:378
int getTotalCoinRate() const
Definition: sino_d.h:405
void setUncorrectedSingles(const std::vector< float > &uncorrSingles)
Definition: sino_d.h:794
short getLowerScatterThreshold() const
Definition: sino_d.h:671
float getZResolution() const
Definition: sino_d.h:725
Sinogram< T > clone() const
Definition: sino_d.h:1064
void setDurationTime(unsigned int)
Definition: sino_d.h:848
void setRadioPharmaceutical(const std::string &radiopharmaceutical)
Definition: sino_d.h:860
void allocate(int, int)
Definition: sino_d.h:99
std::vector< float > getUncorrectedSingles() const
Definition: sino_d.h:354
void setAcquisitionType(short AquisitionType)
Definition: sino_d.h:950
float getTransaxialFOV() const
Definition: sino_d.h:491
float getPlaneSeparation() const
Definition: sino_d.h:527
void printHeader() const
Definition: sino_d.h:1096
float getWResolution() const
Definition: sino_d.h:734
int getMultiFileType() const
Definition: sino_d.h:545
void setPatientOrientation(short PatientOrientation)
Definition: sino_d.h:902
int getDelayed() const
Definition: sino_d.h:362
void setBinSize(float BinSize)
Definition: sino_d.h:956
std::vector< float > getBedOffset() const
Definition: sino_d.h:662
void setTotalAverageCorrected(float)
Definition: sino_d.h:818
std::string getEcatFileType() const
Definition: sino_d.h:322
float getInitBedPosition() const
Definition: sino_d.h:554
void setWResolution(float)
Definition: sino_d.h:1046
short getAcquisitionMode() const
Definition: sino_d.h:581
int getNumPlanes(int seg) const
Definition: sino_d.h:293
void setUpperTrueThreshold(short UpperTrueThreshold)
Definition: sino_d.h:938
std::string getRadioPharmaceutical() const
Definition: sino_d.h:455
Sinogram< T > & operator=(const Sinogram< T > &other)
Definition: sino_d.h:138
void setMultiFileType(int MultiFileType)
Definition: sino_d.h:920
std::string getFileType() const
Definition: sino_d.h:314
short getPatientOrientation() const
Definition: sino_d.h:518
void setDeadTimeCorrectionFactor(float)
Definition: sino_d.h:836
void setBedElevation(float)
Definition: sino_d.h:974
unsigned int getDoseStartTime() const
Definition: sino_d.h:617
void setPlaneSeparation(float planeSep)
Definition: sino_d.h:908