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