2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------
29 // C++ Implementation: brukerdataset
34 // Author: <Denis Grenier>, (C) 2008
36 // Copyright: See COPYING file that comes with this distribution
43 #include "brukerdataset.h"
45 BrukerDataSet::BrukerDataSet(){}
48 BrukerDataSet::~BrukerDataSet(){}
51 bool BrukerDataSet::LoadFile(std::string fileToRead)
55 //"------------- BrukerDataSet::LoadFile() Open : [" << fileToRead << "]" << std::endl;
58 FID.open(fileToRead.c_str(), std::ios::binary);
59 if (FID.rdstate()==std::ios::failbit) {
60 //std::cout << "BrukerDataSet::LoadFile() Cannot open : [" << fileToRead << "]" << std::endl;
64 FID.seekg (0, std::ios::end);
65 int length = FID.tellg();
66 FID.seekg (0, std::ios::beg);
68 buffer = new char [length];
69 FID.read (buffer,length);
71 BrukerDataSet::WholeHeader=buffer;
78 std::string BrukerDataSet::SearchBufferForText(std::string& file, const boost::regex& RegExp)
81 if (regex_search(file.c_str(), what, RegExp))
93 bool BrukerDataSet::BoolMatchBufferForText(std::string& file, const boost::regex& RegExp)
96 if (regex_match(file.c_str(), what, RegExp))
101 std::string BrukerDataSet::RemoveNewlines(std::string file)
103 boost::regex regexNewline;
104 const char* pre_expression = "[[:cntrl:]]";
105 regexNewline.assign(pre_expression);
107 const char* pre_format = "";
108 std::ostringstream t(std::ios::out | std::ios::binary);
109 std::ostream_iterator<char, char> oi(t);
110 boost::regex_replace(oi, file.begin(), file.end(),
111 regexNewline, pre_format, boost::match_default | boost::format_all);
112 std::string s(t.str());
116 std::string BrukerDataSet::RemoveSpaces(std::string file)
118 boost::regex regexSpace;
119 const char* pre_expression = "[[:space:]]";
120 regexSpace.assign(pre_expression);
122 const char* pre_format = "";
123 std::ostringstream t(std::ios::out | std::ios::binary);
124 std::ostream_iterator<char, char> oi(t);
125 boost::regex_replace(oi, file.begin(), file.end(),
126 regexSpace, pre_format, boost::match_default | boost::format_all);
127 std::string s(t.str());
134 std::string BrukerDataSet::MatchBufferForText(std::string& file,const boost::regex& RegExp)
137 if (regex_match(file.c_str(), what, RegExp))
144 std::string BrukerDataSet::GetKeyword(std::string& file)
146 return MatchBufferForText( file,KeyWord);
151 int BrukerDataSet::GetDimensionnality(std::string& file)
154 std::string DimensionnalityBuffer=SearchBufferForText(file,Dimensionnality);
155 if (DimensionnalityBuffer=="")
157 boost::match_results<std::string::const_iterator> what;
158 boost::match_flag_type flags= boost::match_default;
159 std::string::const_iterator start,end;
160 start=DimensionnalityBuffer.begin();
161 end=DimensionnalityBuffer.end();
163 while (regex_search(start, end, what, UnsignedInteger))
166 start=what[0].second;
167 flags |= boost::match_prev_avail;
168 flags |= boost::match_not_bob;
175 int BrukerDataSet::GetIntValueOfDimN(std::string& file, int N)
178 std::string DimensionnalityBuffer=SearchBufferForText(file,Dimensionnality);
179 if (N < 1 || DimensionnalityBuffer=="")
181 //std::cout << DimensionnalityBuffer << std::endl;
182 boost::match_results<std::string::const_iterator> what;
183 boost::match_flag_type flags= boost::match_default;
184 std::string::const_iterator start,end;
185 start=DimensionnalityBuffer.begin();
186 end=DimensionnalityBuffer.end();
188 for (int i=1;i<=N;i++)
190 regex_search(start,end, what, UnsignedInteger);
192 start=what[0].second;
193 flags |= boost::match_prev_avail;
194 flags |= boost::match_not_bob;
196 return atoi(std::string(what[1].first,what[1].second).c_str());
201 std::string BrukerDataSet::GetValuesPart(std::string& file)
204 Result=MatchBufferForText(file,BufferNValues);
206 return RemoveNewlines(Result);
207 return MatchBufferForText(file,Buffer1Value);
211 std::string BrukerDataSet::GetContentType(std::string& file)
213 std::string ValuesPart;
214 boost::match_flag_type flags = boost::match_default;
215 std::string::const_iterator start, end;
216 ValuesPart=GetValuesPart(file);
217 start=ValuesPart.begin();
218 end=ValuesPart.end();
219 // boost regexp_match can not handle well what we want
220 // so instead of looking for a match we will seek proof of a non int serie
221 // i.e. check if we can find something else than than -0-9
222 boost::regex isNotIntSerie("[^ \\-0-9]");
223 boost::match_results<std::string::const_iterator> whatInt;
224 if (!regex_search(start,end, whatInt, isNotIntSerie,flags))
227 // if not int serie check if it's not a floats serie !!!
229 boost::regex isNotFloatSerie("[^ \\-\\+\\.eE0-9]");
230 boost::match_results<std::string::const_iterator> whatFloat;
231 if (!regex_search(start,end, whatFloat, isNotFloatSerie,flags))
234 // if not a float serie neither, it's a string !!!
240 int BrukerDataSet::GetIntValueN(std::string& file,int N)
242 std::string ValuesPart=GetValuesPart(file);
244 if (N < 1 || ValuesPart=="")
247 boost::match_results<std::string::const_iterator> what;
248 boost::match_flag_type flags= boost::match_default;
249 std::string::const_iterator start,end;
250 start=ValuesPart.begin();
251 end=ValuesPart.end();
253 while (iterator != N)
255 regex_search(start,end, what, SignedInteger);
257 start=what[0].second;
258 flags |= boost::match_prev_avail;
259 flags |= boost::match_not_bob;
261 return (atoi((std::string(what[1].first,what[1].second)).c_str()));
266 double BrukerDataSet::GetDoubleValueN(std::string& file, int N)
268 std::string ValuesPart=GetValuesPart(file);
270 if (N < 1 || ValuesPart=="")
272 boost::match_results<std::string::const_iterator> what;
273 boost::match_flag_type flags= boost::match_default;
274 std::string::const_iterator start,end;
275 start=ValuesPart.begin();
276 end=ValuesPart.end();
278 while (iterator != N)
280 regex_search(start,end, what, IntOrFloat);
282 start=what[0].second;
283 flags |= boost::match_prev_avail;
284 flags |= boost::match_not_bob;
286 return (atof((std::string(what[1].first,what[1].second)).c_str()));
291 std::string BrukerDataSet::GetTextValueN(std::string& file, int N)
293 return GetValuesPart(file);
298 int BrukerDataSet::GetKeywordNumberOfElements(std::string& file)
300 int NumberOfElements=1;
301 for (int i=1;i<=GetDimensionnality(file);i++)
302 NumberOfElements*=GetIntValueOfDimN(file, i);
303 return NumberOfElements;
310 @fn bool BrukerDataSet::FillMap()
311 @brief This method fills the Bruker headermap with everything contained in the acqp file
313 The map is made of BrukerFieldData containing the keywords:
314 Datatype (string, int, double)
315 DimensionNumber: The number of Dimensions of the keyword-> 0 scalar, 1-> 1D-vector, 2-> 2D-Matrix, 3->3D-Matrix, ...
316 DimensionNumberValue: Gives the size of each dimension
317 DoubleValue: return a vector of values if they are of type double
318 IntValue: return a vector of values if they are of type int
319 StringValue: return a string if the values where not identified as a serie of numbers
320 NumberOfElements: Number of elements corresponding to the keyword given
323 bool BrukerDataSet::FillMap()
326 std::string ValuesBuffer, Keyword,TempString, Substring;
329 int PositionDebut=WholeHeader.find("##");
330 int PositionFin=PositionDebut+2;
332 BrukerFieldData data;
333 if (PositionFin>=WholeHeader.length())
336 while(PositionDebut!=std::string::npos)
338 PositionFin=WholeHeader.find("##",PositionDebut+2);
339 if (-1 == PositionFin) break ;
340 Substring=WholeHeader.substr (PositionDebut,PositionFin-PositionDebut-1);
341 PosRel=Substring.find("$$",0);
342 if (-1 != PosRel) Substring=Substring.substr (0,PosRel-1);
345 if (DEBUG) std::cout<<"Substring=[" << Substring << "]" <<std::endl;
347 PositionDebut=PositionFin;
348 Keyword=GetKeyword(Substring);
349 if (DEBUG) std::cout<<"Keyword="<< Keyword <<std::endl;
350 data.DimensionNumber=GetDimensionnality(Substring);
351 if (DEBUG) std::cout<<"data.DimensionNumber="<< data.DimensionNumber <<std::endl;
353 data.DataType=GetContentType(Substring);
354 if (DEBUG) std::cout<<"data.DataType="<< data.DataType <<std::endl;
355 data.NumberOfElements=GetKeywordNumberOfElements(Substring);
356 if(data.DataType=="string")
357 data.DimensionNumber=0;
358 if(data.DataType=="string")
359 data.NumberOfElements=1;
360 if (DEBUG) std::cout<<"data.NumberOfElements="<< data.NumberOfElements <<std::endl;
363 while (i<=data.DimensionNumber)
365 data.DimensionNumberValue.push_back(GetIntValueOfDimN(Substring,i));
366 if (DEBUG) std::cout<<"data.DimensionNumberValue["<<i<<"]="<< data.DimensionNumberValue[i] <<std::endl;
370 if (DEBUG) std::cout<< "data= ";
372 for(i =1;i<=data.NumberOfElements;i++)
375 if (data.DataType=="int")
377 data.IntValue.push_back(GetIntValueN(Substring,i));
378 data.DoubleValue.push_back((double) GetIntValueN(Substring,i));
379 if (DEBUG) std::cout<< data.IntValue[i-1]<<" ";
382 if (data.DataType=="float")
384 data.DoubleValue.push_back(GetDoubleValueN(Substring,i));
385 if (DEBUG) std::cout<< data.DoubleValue[i-1]<<" ";
389 if (data.DataType=="string")
391 data.StringValue.push_back(GetTextValueN(Substring,0));
392 if (DEBUG) std::cout<< "[" << data.StringValue[0]<<"] ";
395 if (DEBUG) std::cout<< std::endl << "---- " <<std::endl;
397 BrukerDataSet::BrukerHeaderMap[ Keyword ] = data;
398 data.DimensionNumberValue.clear();
399 data.IntValue.clear();
400 data.DoubleValue.clear();
401 data.StringValue.clear();
402 data.DataType.clear();
404 //std::cout<<std::endl;
410 void BrukerDataSet::PrintKey(std::string & KeyWord)
413 if(!BrukerDataSet::CheckExistKeyword(KeyWord))
415 std::cout<< "KeyWord = "<<KeyWord <<" doesn't exist !"<<std::endl;
419 std::cout<< "KeyWord = "<<KeyWord <<std::endl;
420 BrukerDataSet::BrukerHeaderMap[ KeyWord ].PrintSelf();
427 void BrukerDataSet::PrintSelf()
429 BrukMapType::iterator it;
430 for (it= BrukerHeaderMap.begin();
431 it != BrukerHeaderMap.end();
434 std::cout << std::endl << "-----------------[" <<(*it).first << "]" << std::endl;
435 std::string a = (*it).first;
441 bool BrukerDataSet::CheckExistKeyword(std::string &KeyWord)
443 BrukMapType::iterator element;
444 element = BrukerHeaderMap.find(KeyWord);
445 if (element != BrukerHeaderMap.end() )
450 bool BrukerDataSet::CheckExistKeyword(const char *KeyWord)
452 std::string temp(KeyWord);
453 BrukerDataSet::CheckExistKeyword(temp);
458 const BrukerFieldData& BrukerDataSet::GetFieldData(std::string & kw)
460 return BrukerHeaderMap[kw];
463 const BrukerFieldData& BrukerDataSet::GetFieldData(const char *kw)
465 std::string str_kw(kw);
466 return BrukerHeaderMap[str_kw];
470 bool BrukerDataSet::Getkspace(std::string &FileToRead)
472 std::string GO_raw_data_format("GO_raw_data_format");
473 if (!CheckExistKeyword(GO_raw_data_format))
477 FID.open(FileToRead.c_str(), std::ios::binary);
478 if (FID.rdstate()==std::ios::failbit)
480 FID.seekg (0, std::ios::end);
481 long length = FID.tellg();
482 FID.seekg (0, std::ios::beg);
486 if (GetTextValueN(GO_raw_data_format,1)=="GO_32BIT_SGN_INT")
487 NumberOfValues=length/4;
488 if (GetTextValueN(GO_raw_data_format,1)=="GO_16BIT_SGN_INT")
489 NumberOfValues=length/2;
490 if (GetTextValueN(GO_raw_data_format,1)=="GO_32BIT_FLOAT")
491 NumberOfValues=length/4;
494 buffer = new char[length];
496 FID.read (buffer,length);
498 //for (long i=0;i<NumberOfValues;i++) BrukerDataSet::WholeKspace.pushback(buffer[i]);
504 std::vector< int > BrukerDataSet::GetLoopStructure() const
506 return LoopStructure;
510 @fn bool BrukerDataSet::SetLoopStructure (const std::vector<int> & theValue )
511 * @brief this methods provide a way to inject a userdefined loop structure, be very aware that this method is not foolproof
515 bool BrukerDataSet::SetLoopStructure ( const std::vector<int> & theValue )
517 LoopStructure = theValue;
523 @fn bool BrukerDataSet::SetLoopStructureOld ( )
524 * @brief method to set the default Bruker loopstructure (not yet able to deal with EPI, SPIRAL or spectroscopic experiments
526 * @todo implement multicoil version
528 bool BrukerDataSet::SetLoopStructureOld ()
530 LoopStructure.clear();
532 \file brukerdataset.cpp
533 \fn bool BrukerDataSet::setGenericLoopStructure ( )
534 \brief sets the loop structure of a standard Bruker experiment
536 NR (Nbre de repetitions)
537 NILoop (Boucle eventuelle extra (Diffusion par exemple) si NI<>(NSLICES x NECHOES) cette boucle est a� NI/(NSLICES x NECHOES)
538 (Attention NILoop peut masquer plusieurs boucles imbriquees !!!!!)
539 ACQ_size[1..M] (Codage suivant les autres dimensions)
540 NSLICES (Nombre de tranches)
541 ACQ_phase_factor (Facteur turbo de la sequence)
542 ACQ_ns_list_size (Nombre d'echos)
543 ACQ_size[0] (Ligne acq reelle)
548 std::string NRStr("NR");
549 std::string NIStr("NI");
550 std::string ACQ_sizeStr("ACQ_size");
551 std::string ACQ_phase_factorStr("ACQ_phase_factor");
552 std::string ACQ_ns_listStr("ACQ_ns_list");
553 std::string ACQ_ns_list_sizeStr("ACQ_ns_list_size");
554 std::string NSLICESStr("NSLICES");
557 std::vector<int> TempIntVect;
560 if (! CheckExistKeyword(NRStr)) return false;
561 if (! CheckExistKeyword(NIStr)) return false;
562 if (! CheckExistKeyword(ACQ_sizeStr)) return false;
563 if (! CheckExistKeyword(ACQ_phase_factorStr))return false;
564 if (! CheckExistKeyword(ACQ_ns_list_sizeStr))return false;
565 if (! CheckExistKeyword(NSLICESStr)) return false;
567 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].IntValue[0]);
568 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[(std::string) "ACQ_ns_list_size"].IntValue[0]);
569 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[(std::string) "ACQ_phase_factor"].IntValue[0]);
570 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[(std::string) "NSLICES"].IntValue[0]);
571 if (1<=BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].DimensionNumber ){
572 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].IntValue[1]/BrukerDataSet::BrukerHeaderMap[(std::string) "ACQ_phase_factor"].IntValue[0]);
573 if (2<=BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].DimensionNumber )
575 for(i=2;i<=BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].DimensionNumber;i++)
577 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].IntValue[i]);
581 // Ici, boucles additionnelles si elles existent regroupees en une seule
582 //temp=GetIntValueN(NIStr,1)/(GetIntValueN(NSLICESStr,1)*GetIntValueN(NECHOESStr,1));
583 temp=BrukerDataSet::BrukerHeaderMap[ (std::string) "NI" ].IntValue[0]/(BrukerDataSet::BrukerHeaderMap[ (std::string) "NSLICES" ].IntValue[0]*BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_ns_list_size" ].IntValue[0]);
585 TempIntVect.push_back(temp);
586 // fin des boucles cachees
588 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[ (std::string) "NR" ].IntValue[0]);
590 LoopStructure=TempIntVect;
596 @fn bool BrukerDataSet::SetLoopStructure ( )
597 * @brief method to set the default Bruker loopstructure (not yet able to deal with EPI, SPIRAL or spectroscopic experiments
599 @todo implement multicoil version
601 bool BrukerDataSet::SetLoopStructure (int dimension)
603 if (! SetInnerObjectLoopStructure(dimension)) return false;
604 if (! SetOuterObjectLoopStructure(dimension)) return false;
605 std::vector<int> Inner=GetInnerObjectLoopStructure();
606 std::vector<int> Outer=GetOuterObjectLoopStructure();
607 std::vector<int> TmpVect;
609 TmpVect.insert(TmpVect.end(),Outer.begin(),Outer.end());
610 LoopStructure=TmpVect;
614 std::vector< std :: vector < int > > BrukerDataSet::GetBrukerObjectsLineList() const
616 return BrukerObjectsLineList;
620 bool BrukerDataSet::SetBrukerObjectsLineList ()
623 std::vector<int> Loop =GetLoopStructure();
624 int NumberOfLines, i,j;
628 while (i<Loop.size())
630 NumberOfLines=NumberOfLines*Loop[i];
634 std::vector<int> TempVect (Loop.size()-1,0);
635 std::vector<int> k (Loop.size()-1,0);
636 std::vector<std::vector<int> > TempLineList (NumberOfLines,TempVect);
638 for (i=0;i<NumberOfLines;i++){
639 for (j=1;j<=Loop.size()-1;j++) {
640 if (k[j-1] >= Loop[j]) {
645 for (j=1;j<=Loop.size()-1;j++)
646 TempLineList[i][j-1]=k[j-1];
649 BrukerObjectsLineList=TempLineList;
654 std::vector< std::vector < int > > BrukerDataSet::GetBrukerImageList() const
656 return BrukerImageList;
660 bool BrukerDataSet::SetBrukerImageList ()
662 if (LoopStructure.size()==0)
663 SetImageLoopStructure();
665 std::vector<int> Loop =GetImageLoopStructure();
666 int NumberOfLines, i,j;
670 while (i<Loop.size())
672 NumberOfLines=NumberOfLines*Loop[i];
676 std::vector<int> TempVect (Loop.size()-1,0);
677 std::vector<int> k (Loop.size()-1,0);
678 std::vector<std::vector<int> > TempLineList (NumberOfLines,TempVect);
680 for (i=0;i<NumberOfLines;i++){
681 for (j=1;j<=Loop.size()-1;j++) {
682 if (k[j-1] >= Loop[j]) {
687 for (j=1;j<=Loop.size()-1;j++)
688 TempLineList[i][j-1]=k[j-1];
691 BrukerImageList=TempLineList;
697 std::map<std::string, BrukerFieldData> BrukerDataSet::GetBrukerHeaderMap() const
699 return BrukerHeaderMap;
705 //std::map<std::string, BrukerFieldData> BrukerDataSet::GetBrukerHeaderMap() const
707 // return BrukerHeaderMap;
711 bool BrukerDataSet::SetInnerObjectLoopStructure(int dimension)
716 * ACQ_size[1..M] (Codage suivant les autres dimensions)
717 NSLICES (Nombre de tranches)
718 ACQ_phase_factor (Facteur turbo de la sequence)
719 ACQ_ns_list_size (Nombre d'echos)
720 ACQ_size[0] (Ligne acq reelle)
725 std::vector<int> TempIntVect;
729 if (! CheckExistKeyword("ACQ_size")) return false;
730 if (! CheckExistKeyword("ACQ_phase_factor"))return false;
731 if (! CheckExistKeyword("ACQ_ns_list_size"))return false;
732 if (! CheckExistKeyword("NSLICES")) return false;
735 //std::cout<< "BrukerDataSet::BrukerHeaderMap[ (std::string) ACQ_size ].IntValue[0]" <<BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].IntValue[0] << std::endl;
736 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].IntValue[0]);
737 //std::cout<< "BrukerDataSet::BrukerHeaderMap[ (std::string) ACQ_size ].IntValue[0]" <<BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].IntValue[0] << std::endl;
738 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[(std::string) "ACQ_ns_list_size"].IntValue[0]);
739 //std::cout<<"BrukerDataSet::BrukerHeaderMap[(std::string) ACQ_ns_list_size].IntValue[0]" << BrukerDataSet::BrukerHeaderMap[(std::string) "ACQ_ns_list_size"].IntValue[0] << std::endl;
740 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[(std::string) "ACQ_phase_factor"].IntValue[0]);
741 //std::cout<<"BrukerDataSet::BrukerHeaderMap[(std::string) ACQ_phase_factor].IntValue[0]" << BrukerDataSet::BrukerHeaderMap[(std::string) "ACQ_phase_factor"].IntValue[0]<< std::endl;
743 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[(std::string) "NSLICES"].IntValue[0]);
744 //std::cout << "BrukerDataSet::BrukerHeaderMap[(std::string) NSLICES].IntValue[0]" << BrukerDataSet::BrukerHeaderMap[(std::string) "NSLICES"].IntValue[0] << std::endl;
745 if (1<=BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].DimensionNumber )
748 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].IntValue[0]/BrukerDataSet::BrukerHeaderMap[(std::string) "ACQ_phase_factor"].IntValue[0]);
750 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].IntValue[1]/BrukerDataSet::BrukerHeaderMap[(std::string) "ACQ_phase_factor"].IntValue[0]);
751 //std::cout << "BrukerDataSet::BrukerHeaderMap[ (std::string) ACQ_size ].IntValue[1]/BrukerDataSet::BrukerHeaderMap[(std::string) ACQ_phase_factor].IntValue[0]" << BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size"
752 //].IntValue[1]/BrukerDataSet::BrukerHeaderMap[(std::string) "ACQ_phase_factor"].IntValue[0] << std::endl;
753 if (2<=BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].DimensionNumber )
755 for(i=2;i<=BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].DimensionNumber;i++)
757 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].IntValue[i]);
762 InnerObjectLoopStructure=TempIntVect;
767 std::vector< int > BrukerDataSet::GetInnerObjectLoopStructure() const
769 return InnerObjectLoopStructure;
772 std::vector< int > BrukerDataSet::GetOuterObjectLoopStructure() const
774 return OuterObjectLoopStructure;
778 bool BrukerDataSet::SetOuterObjectLoopStructure (int dimension)
780 OuterObjectLoopStructure.clear();
782 NR (Nbre de repetitions)
783 NILoop (Boucle eventuelle extra (Diffusion par exemple) si NI<>(NSLICES x NECHOES) cette boucle est a� NI/(NSLICES x NECHOES)
784 (Attention NILoop peut masquer plusieurs boucles imbriquees !!!!!)
787 std::vector<int> TempIntVect;
789 if (! CheckExistKeyword("NR")) return false;
790 if (! CheckExistKeyword("NI")) return false;
791 // Ici, boucles additionnelles si elles existent regroupees en une seule
792 //temp=GetIntValueN(NIStr,1)/(GetIntValueN(NSLICESStr,1)*GetIntValueN(NECHOESStr,1));
794 temp=BrukerDataSet::BrukerHeaderMap[ (std::string) "NI" ].IntValue[0]/(BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_ns_list_size" ].IntValue[0]);
796 temp=BrukerDataSet::BrukerHeaderMap[ (std::string) "NI" ].IntValue[0]/(BrukerDataSet::BrukerHeaderMap[ (std::string) "NSLICES" ].IntValue[0]*BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_ns_list_size" ].IntValue[0]);
798 TempIntVect.push_back(temp);
799 // fin des boucles cachees
800 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[ (std::string) "NR" ].IntValue[0]);
801 OuterObjectLoopStructure=TempIntVect;
806 std::vector< int > BrukerDataSet::GetImageLoopStructure() const
808 return ImageLoopStructure;
812 bool BrukerDataSet::SetImageLoopStructure ( )
814 ImageLoopStructure.clear();
815 std::vector<int> TempIntVect1=GetInnerObjectLoopStructure();
816 std::vector<int> TempIntVect2=GetOuterObjectLoopStructure();
817 std::vector<int> TempIntVect3(TempIntVect1.size(),1);
818 std::vector<int> TempIntVect4;
819 TempIntVect3[1]=TempIntVect1[1];
820 TempIntVect3[3]=TempIntVect1[3];
821 TempIntVect4=TempIntVect3;
822 TempIntVect4.insert(TempIntVect4.end(),TempIntVect2.begin(),TempIntVect2.end());
823 ImageLoopStructure = TempIntVect4;