]> Creatis software - creaBruker.git/blob - lib/src1/brukerimage.cpp
indent
[creaBruker.git] / lib / src1 / brukerimage.cpp
1 //
2 // C++ Implementation: brukerimage
3 //
4 // Description: 
5 //
6 //
7 // Author:  Denis Grenier, (C) 2009
8 //
9 // Copyright: See COPYING file that comes with this distribution
10 //
11 //
12 /**
13 @file brukerimage.cpp
14 */
15
16 #include "brukerimage.h"
17
18 /**
19  * @brief This method takes care of the initialization of the main parameters usually needed to deal with an MRI experiment 
20  * @fn bool BrukerImage::Init(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
21  * @param TheOrigAcqp 
22  * @param TheOrigReco 
23  * @param TheValue 
24  * @return bool
25  */
26 bool BrukerImage::Init(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
27 {
28
29 // on devrait plutot les nommer 'computeXXX' (setXXX est d'habitude réservé aux accesseurs 'publics')
30
31    setAbsoluteTimePosition     (TheOrigAcqp,TheOrigReco,TheValue);
32    setRelativeTimePosition     (TheOrigAcqp,TheOrigReco,TheValue);
33    setFOVpixels                (TheOrigAcqp,TheOrigReco,TheValue);
34    setFOVcm                    (TheOrigAcqp,TheOrigReco,TheValue);
35    setSliceThickness           (TheOrigAcqp,TheOrigReco,TheValue);
36    setTE                       (TheOrigAcqp,TheOrigReco,TheValue);
37    setTR                       (TheOrigAcqp,TheOrigReco,TheValue);
38    setTI                       (TheOrigAcqp,TheOrigReco,TheValue);
39    setFlipAngle                (TheOrigAcqp,TheOrigReco,TheValue);
40    setLoopStamp                (TheOrigAcqp,TheOrigReco,TheValue);
41    setNA                       (TheOrigAcqp,TheOrigReco,TheValue);
42    setNR                       (TheOrigAcqp,TheOrigReco,TheValue);
43    setNAE                      (TheOrigAcqp,TheOrigReco,TheValue);
44    setDS                       (TheOrigAcqp,TheOrigReco,TheValue);
45    setACQ_phase_factor         (TheOrigAcqp,TheOrigReco,TheValue);
46    setRotationMatrixRPS2XYZ    (TheOrigAcqp,TheOrigReco,TheValue);
47    setTranslationVectorRPS2XYZ (TheOrigAcqp,TheOrigReco,TheValue);
48    setWordType                 (TheOrigAcqp,TheOrigReco,TheValue);
49    setImageType                (TheOrigAcqp,TheOrigReco,TheValue);
50    setDataEndianness           (TheOrigAcqp,TheOrigReco,TheValue);
51    setImageByteSize            (TheOrigAcqp,TheOrigReco,TheValue);
52    setBeginingOfImageInBytes   (TheOrigAcqp,TheOrigReco,TheValue);
53
54    return true;
55 }
56
57 /**
58  * @brief the constructor uses the BrukerDataSet's of the acqp and reco file
59  * @fn BrukerImage::BrukerImage(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco)
60  * @param TheOrigAcqp 
61  * @param TheOrigReco 
62  */
63 BrukerImage::BrukerImage(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco)
64 {
65 }
66
67 BrukerImage::~BrukerImage()
68 {
69 }
70
71 /**
72 * @fn int BrukerImage::getAbsoluteTimePosition() const
73  * @brief AbsoluteTimePosition is an integer number giving the time of the begining of the acquisition of the dataset
74  * @return AbsoluteTimePosition int
75  */
76 int BrukerImage::getAbsoluteTimePosition() const
77 {
78    return AbsoluteTimePosition;
79 }
80
81 /**
82  * @fn bool BrukerImage::setAbsoluteTimePosition (BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue )
83  * @brief AbsoluteTimePosition is an integer number giving the time of the begining of the acquisition of the dataset
84  * @param TheOrigAcqp
85  * @param TheOrigReco
86  * @param TheValue
87  * @return bool
88  */
89 bool BrukerImage::setAbsoluteTimePosition (BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue )
90 {
91    AbsoluteTimePosition = TheOrigAcqp.GetBrukerHeaderMap()[(std::string) "ACQ_abs_time"].GetIntValue()[0];
92    return true;
93 }
94
95 /**
96  * @brief RelativeTimePosition is the estimated time position of the time the k-space center was acquired
97  * This notion is very relative when dealing with long experiments and a line or object averaging (NA or NAE <> 1)
98  * @fn double BrukerImage::getRelativeTimePosition() const
99  * @return double
100  */
101 double BrukerImage::getRelativeTimePosition() const
102 {
103    return RelativeTimePosition;
104 }
105
106 /**
107  * @brief RelativeTimePosition is the estimated instant when the k-space center of each image was acquired
108
109      This notion is very relative when dealing with long experiments and a line or object averaging (NA or NAE <> 1)
110  * @fn bool BrukerImage::setRelativeTimePosition (BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco,  int TheValue )
111  * @param TheOrigAcqp 
112  * @param TheOrigReco 
113  * @param TheValue 
114  * @return  bool
115  */
116 bool BrukerImage::setRelativeTimePosition (BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco,  int TheValue )
117 {
118    long lTEMP = TheOrigAcqp.GetBrukerImageList()[TheValue].back();
119    RelativeTimePosition = TheOrigAcqp.ObjectVaryingProperties.getPositionTimePerNR(lTEMP);
120    return true;
121 }
122
123 /**
124  * @brief FOVpixels is a 1x2 integer vector. it's one of the view value we need to pick in the reco headermap
125  * @fn bool BrukerImage::setFOVpixels(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
126  * @param TheOrigAcqp 
127  * @param TheOrigReco 
128  * @param TheValue 
129  * @return bool
130  */
131 bool BrukerImage::setFOVpixels(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
132 {
133    FOVpixels = TheOrigReco.GetBrukerHeaderMap()[(std::string) "RECO_size"].GetIntValue();
134    return true;
135 }
136
137 /**
138  * @brief FOVpixels is a 1x2 integer vector. it's one of the view value we need to pick in the reco headermap
139  * @fn std::vector <int > BrukerImage::getFOVpixels() const
140  * @return std::vector <int >
141  */
142 const std::vector<int > &BrukerImage::getFOVpixels() const
143 {
144    return FOVpixels;
145 }
146
147 /**
148  * @brief FOVcm is also picked in reco headermap
149  * @fn bool BrukerImage::setFOVcm(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
150  * @param TheOrigAcqp 
151  * @param TheOrigReco 
152  * @param TheValue 
153  * @return bool
154  */
155 bool BrukerImage::setFOVcm(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
156 {
157    FOVcm = TheOrigReco.GetBrukerHeaderMap()[(std::string) "RECO_fov"].GetDoubleValue();
158    return true;
159 }
160
161 /**
162  * @brief FOVcm is also picked in reco headermap
163  * @fn std::vector <double > BrukerImage::getFOVcm() const
164  * @return std::vector <double >
165  */
166 const std::vector <double > &BrukerImage::getFOVcm() const
167 {
168    return FOVcm;
169 }
170
171 /**
172  * @brief SliceThickness is in milimeter
173  * @fn bool BrukerImage::setSliceThickness( BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco,int TheValue)
174  * @param TheOrigAcqp 
175  * @param TheOrigReco 
176  * @param TheValue 
177  * @return bool
178  */
179 bool BrukerImage::setSliceThickness( BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco,int TheValue)
180 {
181    SliceThickness = TheOrigAcqp.GetBrukerHeaderMap()[(std::string) "ACQ_slice_thick"].GetDoubleValue()[0];
182    return true;
183 }
184
185 /**
186  * @brief SliceThickness is in milimeter
187  * @fn double  BrukerImage::getSliceThickness() const
188  * @return double
189  */
190 double  BrukerImage::getSliceThickness() const
191 {
192    return SliceThickness;
193 }
194
195 /**
196  * @brief picks the echo time of the image number TheValue
197  * @fn bool BrukerImage::setTE( BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco,int TheValue)
198  * @param TheOrigAcqp 
199  * @param TheOrigReco 
200  * @param TheValue 
201  * @return bool
202  */
203 bool BrukerImage::setTE( BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco,int TheValue)
204 {
205    TE = TheOrigAcqp.ObjectVaryingProperties.getTE(TheOrigAcqp.GetBrukerImageList()[TheValue][0]);
206    return true;
207 }
208
209 /**
210  * @fn double BrukerImage::getTE() const
211  * @brief picks the echo time of the image number TheValue
212  * @return TE
213  */
214 double BrukerImage::getTE() const
215 {
216    return TE;
217 }
218
219 /**
220  * @brief picks the repetition time of the image number TheValue
221  * @fn bool BrukerImage::setTR( BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco,int TheValue)
222  * @param TheOrigAcqp 
223  * @param TheOrigReco 
224  * @param TheValue 
225  * @return bool
226  */
227 bool BrukerImage::setTR(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
228 {
229    TR=TheOrigAcqp.GetBrukerHeaderMap()[(std::string) "ACQ_repetition_time"].GetDoubleValue()[0];
230    return true;
231 }
232
233  /**
234   * @fn double BrukerImage::getTR() const
235   * @brief picks the echo time of the image number TheValue
236   * @return TR
237   */
238 double BrukerImage::getTR() const
239 {
240    return TR;
241 }
242
243 /**
244  * @brief picks the invertion time of the image number TheValue
245  * @fn bool BrukerImage::setTI( BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco,int TheValue)
246  * @param TheOrigAcqp 
247  * @param TheOrigReco 
248  * @param TheValue 
249  * @return bool
250  */
251 bool BrukerImage::setTI(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
252 {
253    TI = TheOrigAcqp.GetBrukerHeaderMap()[(std::string) "ACQ_inversion_time"].GetDoubleValue()[0];
254    return true;
255 }
256
257  /**
258   * @fn double BrukerImage::getTI() const
259   * @brief picks the invertion time of the image number TheValue
260   * @return TI
261   */
262 double BrukerImage::getTI() const
263 {
264    return TI;
265 }
266
267 /**
268  * @brief picks the flip angle of the image number TheValue
269  * @fn bool BrukerImage::setFlipAngle( BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco,int TheValue)
270  * @param TheOrigAcqp 
271  * @param TheOrigReco 
272  * @param TheValue 
273  * @return bool
274  */
275 bool BrukerImage::setFlipAngle(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
276 {
277    FlipAngle = TheOrigAcqp.GetBrukerHeaderMap()[(std::string) "ACQ_flip_angle"].GetIntValue()[0];
278    return true;
279 }
280
281 /**
282  * @fn double BrukerImage::getFlipAngle() const
283  * @brief picks the flip angle of the image number TheValue
284  * @return FlipAngle
285 */
286 double BrukerImage::getFlipAngle() const
287 {
288    return FlipAngle;
289 }
290
291
292 /**
293  * @brief LoopStamp is a vector, copy of the values of all the loop for the image number TheValue
294
295  * The purpose of this "loopstamp" is to provide additionnal information if the methods provided by this class are not sufficient to singularize each image 
296  * @fn bool BrukerImage::setLoopStamp(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
297  * @param TheOrigAcqp 
298  * @param TheOrigReco 
299  * @param TheValue 
300  * @return bool
301  */
302 bool BrukerImage::setLoopStamp(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
303 {
304    LoopStamp = TheOrigAcqp.GetBrukerImageList()[TheValue];
305    return true;
306 }
307
308 /** 
309  * @brief LoopStamp is a vector, copy of the values of all the loop for the image number TheValue
310  * The purpose of this "loopstamp" is to provide additionnal information if the methods provided by this class are not sufficient to singularize each image 
311  * @fn std::vector<int> BrukerImage::getLoopStamp() const
312  * @return LoopStamp
313  */
314 const std::vector<int> &BrukerImage::getLoopStamp() const
315 {
316    return LoopStamp;
317 }
318
319 /**
320  * @brief NA number of accumulation is useful to track image quality
321  * @fn bool BrukerImage::setNA(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
322  * @param TheOrigAcqp 
323  * @param TheOrigReco 
324  * @param TheValue 
325  * @return 
326  */
327 bool BrukerImage::setNA(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
328 {
329    NA=TheOrigAcqp.GetBrukerHeaderMap()[(std::string) "NA"].GetIntValue()[0];
330    return true;
331 }
332
333 /**
334  * @brief NA number of accumulation is useful to track image quality
335  * @fn int BrukerImage::getNA() const
336  * 
337  * @return NA
338  */
339 int BrukerImage::getNA() const
340 {
341    return NA;
342 }
343
344 /**
345  * @brief NAE number of object exterior accumulation is useful to track image quality and rather used than NA to average movement artefacts
346  * @fn bool BrukerImage::setNAE(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
347  * @param TheOrigAcqp 
348  * @param TheOrigReco 
349  * @param TheValue 
350  * @return bool
351  */
352 bool BrukerImage::setNAE(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
353 {
354    NAE=TheOrigAcqp.GetBrukerHeaderMap()[(std::string) "NAE"].GetIntValue()[0];
355    return true;
356 }
357
358 /**
359  * @brief NAE number of object exterior accumulation is useful to track image quality and rather used than NA to average movement artefacts
360  * @fn int BrukerImage::getNAE() const
361  * @return NAE
362  */
363
364 int BrukerImage::getNAE() const
365 {
366    return NAE;
367 }
368
369 /**
370  * @brief DS (dummy scan) is useful to establish a dynamic equilibrium or to know if one was used
371  * @fn bool BrukerImage::setDS(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
372  * @param TheOrigAcqp 
373  * @param TheOrigReco 
374  * @param TheValue 
375  * @return bool
376  */
377
378 bool BrukerImage::setDS(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
379 {
380    DS=TheOrigAcqp.GetBrukerHeaderMap()[(std::string) "DS"].GetIntValue()[0];
381    return true;
382 }
383
384 /**
385  @brief  DS (dummy scan) is useful to establish a dynamic equilibrium or to know if one was used
386  @fn int BrukerImage::get() const
387  @return DS
388 */
389 int BrukerImage::getDS() const
390 {
391    return DS;
392 }
393
394 /**
395  * @brief Phase factor is the number of kspace line acquired in a single shot
396  * @fn bool BrukerImage::setACQ_phase_factor(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
397  * @param TheOrigAcqp 
398  * @param TheOrigReco 
399  * @param TheValue 
400  * @return bool
401  */
402 bool BrukerImage::setACQ_phase_factor(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
403 {
404    ACQ_phase_factor=TheOrigAcqp.GetBrukerHeaderMap()[(std::string) "ACQ_phase_factor"].GetIntValue()[0];
405    return true;
406 }
407
408 /**
409  * @brief Phase factor is the number of kspace line acquired in a single shot
410  * @fn int BrukerImage::getACQ_phase_factor() const
411  * @return 
412  */
413 int BrukerImage::getACQ_phase_factor() const
414 {
415    return ACQ_phase_factor;
416 }
417
418
419 /**
420  * @brief The number of repetition NR is used to repeat a full objects acquisition NR times with a given delay
421  * This method returns at which repetition belongs the image TheValue 
422  * @fn bool BrukerImage::NR(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
423  * @param TheOrigAcqp 
424  * @param TheOrigReco 
425  * @param TheValue 
426  * @return bool
427  */
428 bool BrukerImage::setNR(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
429 {
430    NR= TheOrigAcqp.GetBrukerImageList()[TheValue].back();
431    return true;
432 }
433
434        /**
435          * @brief  The number of repetition NR is used to repeat a full objects acquisition NR times with a given delay
436          * This method returns at which repetition belongs the image TheValue 
437          * @fn int BrukerImage::getNR() const
438          * @return NR
439          */
440 int BrukerImage::getNR() const
441 {
442    return NR;
443 }
444
445 /**
446  * @brief  RotationMatrixRPS2XYZ is a 3x3 rotation matrix  giving the orientation of the TheValue image
447  * @fn bool BrukerImage::setRotationMatrixRPS2XYZ(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
448  * @param TheOrigAcqp 
449  * @param TheOrigReco 
450  * @param TheValue 
451  * @return bool
452  */
453 bool BrukerImage::setRotationMatrixRPS2XYZ(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
454 {
455    RotationMatrixRPS2XYZ = TheOrigAcqp.ObjectVaryingProperties.getOrientation(TheOrigAcqp.GetBrukerImageList()[TheValue][2]);
456    return true;
457 }
458
459        /**
460          @brief   RotationMatrixRPS2XYZ is a 3x3 rotation matrix  giving the orientation of the TheValue image
461          @fn std::vector<std::vector<double> > BrukerImage::getRotationMatrixRPS2XYZ() const
462          @return RotationMatrixRPS2XYZ
463          */
464 const std::vector<std::vector<double> > &BrukerImage::getRotationMatrixRPS2XYZ() const
465 {
466    return RotationMatrixRPS2XYZ;
467 }
468
469 /**
470  * @brief TranslationVectorRPS2XYZ is a 1x3 vector of the TheValue image position to the magnet center (in mm)
471  * @fn bool BrukerImage::setTranslationVectorRPS2XYZ(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
472  * @param TheOrigAcqp 
473  * @param TheOrigReco 
474  * @param TheValue 
475  * @return bool
476  */
477 bool BrukerImage::setTranslationVectorRPS2XYZ(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
478 {
479    TranslationVectorRPS2XYZ.clear();
480    TranslationVectorRPS2XYZ.push_back(TheOrigAcqp.ObjectVaryingProperties.getPositionR(TheOrigAcqp.GetBrukerImageList()[TheValue][2]));
481    TranslationVectorRPS2XYZ.push_back(TheOrigAcqp.ObjectVaryingProperties.getPositionP(TheOrigAcqp.GetBrukerImageList()[TheValue][2]));
482    TranslationVectorRPS2XYZ.push_back(TheOrigAcqp.ObjectVaryingProperties.getPositionS(TheOrigAcqp.GetBrukerImageList()[TheValue][2]));
483    return true;
484 }
485
486 /**
487  @brief  TranslationVectorRPS2XYZ is a 1x3 vector of the TheValue image position to the magnet center (in mm)
488  @fn std::vector<double> BrukerImage::getTranslationVectorRPS2XYZ() const
489  @return TranslationVectorRPS2XYZ
490 */
491 const std::vector<double>  &BrukerImage::getTranslationVectorRPS2XYZ() const
492 {
493    return TranslationVectorRPS2XYZ;
494 }
495
496 /**
497  * @brief WordType returns the type of data to read int32_t, int16_t, uint8_t or float32_t
498  * @fn bool BrukerImage::setWordType(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
499  * @param TheOrigAcqp 
500  * @param TheOrigReco 
501  * @param TheValue 
502  * @return bool
503  */
504 bool BrukerImage::setWordType(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
505 {
506    WordType=TheOrigReco.GetBrukerHeaderMap()[(std::string) "RECO_wordtype"].GetStringValue()[0];
507    return true;
508 }
509
510        /**
511          @brief WordType returns the type of data to read int32_t, int16_t, uint8_t or float32_t
512          @fn std::string BrukerImage::getWordType() const
513          @return int32_t, int16_t, uint8_t or float32_t or UNKNOWN
514          */
515 std::string BrukerImage::getWordType() const
516
517    if(WordType == ((std::string) "_32BIT_SGN_INT"))  return ((std::string)"int32_t");
518    if(WordType == ((std::string) "_16BIT_SGN_INT"))  return ((std::string)"int16_t");
519    if(WordType == ((std::string) "_8BIT_UNSGN_INT")) return ((std::string)"uint8_t");
520    if(WordType == ((std::string) "_32BIT_FLOAT"))    return ((std::string)"float32_t");
521    return ((std::string)"UNKNOWN");
522 }
523
524 /**
525  * @brief ImageType returns the type of image : values real for amplitude, real imaginary or phase images  and complex for complex images
526  * @fn bool BrukerImage::setImageType(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
527  * @param TheOrigAcqp 
528  * @param TheOrigReco 
529  * @param TheValue 
530  * @return bool
531  */
532 bool BrukerImage::setImageType(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
533 {
534    ImageType=TheOrigReco.GetBrukerHeaderMap()[(std::string) "RECO_image_type"].GetStringValue()[0];
535    return true;
536 }
537
538         /**
539          @brief  ImageType returns the type of image : values real for amplitude, real imaginary or phase images  and complex for complex images
540          @fn std::string BrukerImage::getImageType() const
541          @return complex or real
542          */
543 std::string BrukerImage::getImageType() const
544 {
545    if(ImageType == ((std::string) "COMPLEXE_IMAGE")) return ((std::string)"complex");
546    return ((std::string)"real");
547 }
548
549 /**
550  * @brief DataEndianness gives information on how to swap or no the binary data to read
551  * @fn bool BrukerImage::setDataEndianness(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
552  * @param TheOrigAcqp 
553  * @param TheOrigReco 
554  * @param TheValue 
555  * @return bool
556  */
557 bool BrukerImage::setDataEndianness(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
558 {
559    DataEndianness=TheOrigReco.GetBrukerHeaderMap()[(std::string) "RECO_byte_order"].GetStringValue()[0];
560    return true;
561 }
562
563 /**
564  * @brief  DataEndianness gives information on how to swap or no the binary data to read
565  * @fn std::string BrukerImage::getDataEndianness() const
566  * @return DataEndianness
567  */
568 const std::string &BrukerImage::getDataEndianness() const
569 {
570    return DataEndianness;
571 }
572
573 /**
574  * @brief Information on the image size in byte, useful for offsets calculation
575  * @fn bool BrukerImage::setImageByteSize(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
576  * @param TheOrigAcqp 
577  * @param TheOrigReco 
578  * @param TheValue 
579  * @return bool
580  */
581 bool BrukerImage::setImageByteSize(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
582 {
583    int Dimension, WordSize;
584    if      (getImageType()==((std::string)"complex")) Dimension=2;
585    else if (getImageType()==((std::string)"real"))    Dimension=1;
586    else return false;
587    
588    if (getWordType()==((std::string)"int32_t")||getWordType()==((std::string)"float32_t")) WordSize=4;
589    else if (getWordType()==((std::string)"int16_t")) WordSize=2;
590    else if (getWordType()==((std::string)"uint8_t")) WordSize=1;
591    else /*if (getWordType()==((std::string)"UNKNOWN"))*/ return false;
592
593    ImageByteSize = Dimension*WordSize*getFOVpixels()[0]*getFOVpixels()[1];
594    return true;
595 }
596
597 /**
598  * @brief  Information on the image size in byte, useful for offsets calculation
599  * @fn size_t BrukerImage::getImageByteSize() const
600  * @return ImageByteSize
601  */
602 size_t BrukerImage::getImageByteSize() const
603 {
604    return ImageByteSize;
605 }
606
607 /**
608  * @brief BeginingOfImageInBytes is the offset of the image number TheValue to the begining of 2dseq file
609  * @fn size_t BrukerImage::getBeginingOfImageInBytes() const
610  * @return BeginingOfImageInBytes
611  */
612 size_t BrukerImage::getBeginingOfImageInBytes() const
613 {
614    return BeginingOfImageInBytes;
615 }
616
617 /**
618  * @brief BeginingOfImageInBytes is the offset of the image number TheValue to the begining of 2dseq file
619  * @fn bool BrukerImage::setBeginingOfImageInBytes(BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
620  * @param TheOrigAcqp 
621  * @param TheOrigReco 
622  * @param TheValue 
623  * @return bool
624  */
625 bool BrukerImage::setBeginingOfImageInBytes (BrukerDataSet &TheOrigAcqp, BrukerDataSet &TheOrigReco, int TheValue)
626 {
627    BeginingOfImageInBytes = TheValue*getImageByteSize();
628    return true;
629 }