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