]> Creatis software - creaBruker.git/blob - lib/src1/brukerkspaceobject.cpp
Added CMake configuration to enable CDash tests.
[creaBruker.git] / lib / src1 / brukerkspaceobject.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: brukerobject
29 //
30 // Description: 
31 //
32 //
33 // Author:  <Denis Grenier>, (C) 2008
34 //
35 // Copyright: See COPYING file that comes with this distribution
36 //
37 //
38 #include "brukerkspaceobject.h"
39
40
41
42 bool BrukerKspaceObject::FillWithObject(BrukerDataSet DataSet, int ObjectNumber)
43 {
44
45   std::string TempString;
46   std::vector< int > TempVectInt;
47   std::vector<double> TempVectDouble;
48
49   TempString="ACQ_abs_time";
50   if (DataSet.CheckExistKeyword(TempString)) {
51     setAbsoluteTimePosition ( DataSet.BrukerHeaderMap[TempString].GetIntValue()[0]  );
52   }
53   else return false;
54
55   TempString="ACQ_phase_factor";
56   if (DataSet.CheckExistKeyword(TempString)) {
57     setACQ_phase_factor(DataSet.BrukerHeaderMap[TempString].GetIntValue()[0]);
58   }
59   else return false;
60
61   TempString="ACQ_dim";
62   if (DataSet.CheckExistKeyword(TempString)) {
63     setDimension(DataSet.BrukerHeaderMap[TempString].GetIntValue()[0]);
64   }
65   else return false;
66
67   TempString="ACQ_size";
68   if (DataSet.CheckExistKeyword(TempString)){
69     for (int i=0;i<getDimension();i++) 
70       TempVectInt.push_back(DataSet.BrukerHeaderMap[TempString].GetIntValue()[i]);
71     setDimensionSizes(TempVectInt);
72     TempVectInt.clear();
73   }
74   else return false;
75
76   TempString="ACQ_flip_angle";
77   if (DataSet.CheckExistKeyword(TempString)){ 
78     setFlipAngle(DataSet.BrukerHeaderMap[TempString].GetIntValue()[0]);
79   }
80   else return false;
81
82   TempString="ACQ_fov";
83   if (DataSet.CheckExistKeyword(TempString)) {
84     if ( 1!=DataSet.BrukerHeaderMap[TempString].GetDimensionNumber()) 
85       return false;
86     for (int i=0;i<DataSet.BrukerHeaderMap[TempString].GetNumberOfElements();i++){ 
87       TempVectDouble.push_back(DataSet.BrukerHeaderMap[TempString].GetDoubleValue()[i]);
88     }
89     setFOV(TempVectDouble);
90     TempVectDouble.clear();
91   }
92   else return false;
93
94   TempString="NA";
95   if (DataSet.CheckExistKeyword(TempString)){ 
96   setNA(DataSet.BrukerHeaderMap[TempString].GetIntValue()[0]);
97   }
98   else return false;
99
100   TempString="NR";
101   if (DataSet.CheckExistKeyword(TempString)){ 
102   setNA(DataSet.BrukerHeaderMap[TempString].GetIntValue()[0]);
103   }
104   else return false;
105
106   TempString="NSLICES";
107   if (DataSet.CheckExistKeyword(TempString)){ 
108   setNA(DataSet.BrukerHeaderMap[TempString].GetIntValue()[0]);
109   }
110   else return false;
111
112   TempString="NI";
113   if (DataSet.CheckExistKeyword(TempString)){ 
114     setNI(DataSet.BrukerHeaderMap[TempString].GetIntValue()[0]);
115   }
116   else return false;
117
118   TempString="NAE";
119   if (DataSet.CheckExistKeyword(TempString)){ 
120     setNAE(DataSet.BrukerHeaderMap[TempString].GetIntValue()[0]);
121   }
122   else return false;
123
124   TempString="DS";
125   if (DataSet.CheckExistKeyword(TempString)){ 
126     setDS(DataSet.BrukerHeaderMap[TempString].GetIntValue()[0]);
127   }
128   else return false;
129
130
131   TempString="ACQ_ns_list";
132   if (DataSet.CheckExistKeyword(TempString)) {
133   for (int i=0;i<DataSet.BrukerHeaderMap[TempString].GetNumberOfElements();i++){ 
134     TempVectInt.push_back(DataSet.BrukerHeaderMap[TempString].GetIntValue()[i]);
135   }
136   setACQ_ns_list(TempVectInt);
137   TempVectInt.clear();
138   }
139   else return false;
140
141   TempString="ACQ_obj_order";
142   if (DataSet.CheckExistKeyword(TempString)) {
143   for (int i=0;i<DataSet.BrukerHeaderMap[TempString].GetNumberOfElements();i++){ 
144     TempVectInt.push_back(DataSet.BrukerHeaderMap[TempString].GetIntValue()[i]);
145   }
146   setACQ_obj_order(TempVectInt);
147   TempVectInt.clear();
148   }
149   else return false;
150
151   TempString="ACQ_echo_time";
152   if (DataSet.CheckExistKeyword(TempString)) {
153   for (int i=0;i<DataSet.BrukerHeaderMap[TempString].GetNumberOfElements();i++){ 
154     TempVectInt.push_back(DataSet.BrukerHeaderMap[TempString].GetIntValue()[i]);
155   }
156   setACQ_echo_time(TempVectInt);
157   TempVectInt.clear();
158   }
159   else return false;
160
161   return true;
162 }
163