2 // C++ Implementation: brukerdataset
7 // Author: <Denis Grenier>, (C) 2008
9 // Copyright: See COPYING file that comes with this distribution
16 #include "brukerdataset.h"
18 BrukerDataSet::BrukerDataSet(){}
21 BrukerDataSet::~BrukerDataSet(){}
24 bool BrukerDataSet::LoadFile(std::string fileToRead)
28 //"------------- BrukerDataSet::LoadFile() Open : [" << fileToRead << "]" << std::endl;
31 FID.open(fileToRead.c_str(), std::ios::binary);
32 if (FID.rdstate()==std::ios::failbit) {
33 //std::cout << "BrukerDataSet::LoadFile() Cannot open : [" << fileToRead << "]" << std::endl;
37 FID.seekg (0, std::ios::end);
38 int length = FID.tellg();
39 FID.seekg (0, std::ios::beg);
41 buffer = new char [length];
42 FID.read (buffer,length);
44 BrukerDataSet::WholeHeader=buffer;
51 std::string BrukerDataSet::SearchBufferForText(std::string& file, const boost::regex& RegExp)
54 if (regex_search(file.c_str(), what, RegExp))
66 bool BrukerDataSet::BoolMatchBufferForText(std::string& file, const boost::regex& RegExp)
69 if (regex_match(file.c_str(), what, RegExp))
74 std::string BrukerDataSet::RemoveNewlines(std::string file)
76 boost::regex regexNewline;
77 const char* pre_expression = "[[:cntrl:]]";
78 regexNewline.assign(pre_expression);
80 const char* pre_format = "";
81 std::ostringstream t(std::ios::out | std::ios::binary);
82 std::ostream_iterator<char, char> oi(t);
83 boost::regex_replace(oi, file.begin(), file.end(),
84 regexNewline, pre_format, boost::match_default | boost::format_all);
85 std::string s(t.str());
89 std::string BrukerDataSet::RemoveSpaces(std::string file)
91 boost::regex regexSpace;
92 const char* pre_expression = "[[:space:]]";
93 regexSpace.assign(pre_expression);
95 const char* pre_format = "";
96 std::ostringstream t(std::ios::out | std::ios::binary);
97 std::ostream_iterator<char, char> oi(t);
98 boost::regex_replace(oi, file.begin(), file.end(),
99 regexSpace, pre_format, boost::match_default | boost::format_all);
100 std::string s(t.str());
107 std::string BrukerDataSet::MatchBufferForText(std::string& file,const boost::regex& RegExp)
110 if (regex_match(file.c_str(), what, RegExp))
117 std::string BrukerDataSet::GetKeyword(std::string& file)
119 return MatchBufferForText( file,KeyWord);
124 int BrukerDataSet::GetDimensionnality(std::string& file)
127 std::string DimensionnalityBuffer=SearchBufferForText(file,Dimensionnality);
128 if (DimensionnalityBuffer=="")
130 boost::match_results<std::string::const_iterator> what;
131 boost::match_flag_type flags= boost::match_default;
132 std::string::const_iterator start,end;
133 start=DimensionnalityBuffer.begin();
134 end=DimensionnalityBuffer.end();
136 while (regex_search(start, end, what, UnsignedInteger))
139 start=what[0].second;
140 flags |= boost::match_prev_avail;
141 flags |= boost::match_not_bob;
148 int BrukerDataSet::GetIntValueOfDimN(std::string& file, int N)
151 std::string DimensionnalityBuffer=SearchBufferForText(file,Dimensionnality);
152 if (N < 1 || DimensionnalityBuffer=="")
154 //std::cout << DimensionnalityBuffer << std::endl;
155 boost::match_results<std::string::const_iterator> what;
156 boost::match_flag_type flags= boost::match_default;
157 std::string::const_iterator start,end;
158 start=DimensionnalityBuffer.begin();
159 end=DimensionnalityBuffer.end();
161 for (int i=1;i<=N;i++)
163 regex_search(start,end, what, UnsignedInteger);
165 start=what[0].second;
166 flags |= boost::match_prev_avail;
167 flags |= boost::match_not_bob;
169 return atoi(std::string(what[1].first,what[1].second).c_str());
174 std::string BrukerDataSet::GetValuesPart(std::string& file)
177 Result=MatchBufferForText(file,BufferNValues);
179 return RemoveNewlines(Result);
180 return MatchBufferForText(file,Buffer1Value);
184 std::string BrukerDataSet::GetContentType(std::string& file)
186 std::string ValuesPart;
187 boost::match_flag_type flags = boost::match_default;
188 std::string::const_iterator start, end;
189 ValuesPart=GetValuesPart(file);
190 start=ValuesPart.begin();
191 end=ValuesPart.end();
192 // boost regexp_match can not handle well what we want
193 // so instead of looking for a match we will seek proof of a non int serie
194 // i.e. check if we can find something else than than -0-9
195 boost::regex isNotIntSerie("[^ \\-0-9]");
196 boost::match_results<std::string::const_iterator> whatInt;
197 if (!regex_search(start,end, whatInt, isNotIntSerie,flags))
200 // if not int serie check if it's not a floats serie !!!
202 boost::regex isNotFloatSerie("[^ \\-\\+\\.eE0-9]");
203 boost::match_results<std::string::const_iterator> whatFloat;
204 if (!regex_search(start,end, whatFloat, isNotFloatSerie,flags))
207 // if not a float serie neither, it's a string !!!
213 int BrukerDataSet::GetIntValueN(std::string& file,int N)
215 std::string ValuesPart=GetValuesPart(file);
217 if (N < 1 || ValuesPart=="")
220 boost::match_results<std::string::const_iterator> what;
221 boost::match_flag_type flags= boost::match_default;
222 std::string::const_iterator start,end;
223 start=ValuesPart.begin();
224 end=ValuesPart.end();
226 while (iterator != N)
228 regex_search(start,end, what, SignedInteger);
230 start=what[0].second;
231 flags |= boost::match_prev_avail;
232 flags |= boost::match_not_bob;
234 return (atoi((std::string(what[1].first,what[1].second)).c_str()));
239 double BrukerDataSet::GetDoubleValueN(std::string& file, int N)
241 std::string ValuesPart=GetValuesPart(file);
243 if (N < 1 || ValuesPart=="")
245 boost::match_results<std::string::const_iterator> what;
246 boost::match_flag_type flags= boost::match_default;
247 std::string::const_iterator start,end;
248 start=ValuesPart.begin();
249 end=ValuesPart.end();
251 while (iterator != N)
253 regex_search(start,end, what, IntOrFloat);
255 start=what[0].second;
256 flags |= boost::match_prev_avail;
257 flags |= boost::match_not_bob;
259 return (atof((std::string(what[1].first,what[1].second)).c_str()));
264 std::string BrukerDataSet::GetTextValueN(std::string& file, int N)
266 return GetValuesPart(file);
271 int BrukerDataSet::GetKeywordNumberOfElements(std::string& file)
273 int NumberOfElements=1;
274 for (int i=1;i<=GetDimensionnality(file);i++)
275 NumberOfElements*=GetIntValueOfDimN(file, i);
276 return NumberOfElements;
283 @fn bool BrukerDataSet::FillMap()
284 @brief This method fills the Bruker headermap with everything contained in the acqp file
286 The map is made of BrukerFieldData containing the keywords:
287 Datatype (string, int, double)
288 DimensionNumber: The number of Dimensions of the keyword-> 0 scalar, 1-> 1D-vector, 2-> 2D-Matrix, 3->3D-Matrix, ...
289 DimensionNumberValue: Gives the size of each dimension
290 DoubleValue: return a vector of values if they are of type double
291 IntValue: return a vector of values if they are of type int
292 StringValue: return a string if the values where not identified as a serie of numbers
293 NumberOfElements: Number of elements corresponding to the keyword given
296 bool BrukerDataSet::FillMap()
299 std::string ValuesBuffer, Keyword,TempString, Substring;
302 int PositionDebut=WholeHeader.find("##");
303 int PositionFin=PositionDebut+2;
305 BrukerFieldData data;
306 if (PositionFin>=WholeHeader.length())
309 while(PositionDebut!=std::string::npos)
311 PositionFin=WholeHeader.find("##",PositionDebut+2);
312 if (-1 == PositionFin) break ;
313 Substring=WholeHeader.substr (PositionDebut,PositionFin-PositionDebut-1);
314 PosRel=Substring.find("$$",0);
315 if (-1 != PosRel) Substring=Substring.substr (0,PosRel-1);
318 if (DEBUG) std::cout<<"Substring=[" << Substring << "]" <<std::endl;
320 PositionDebut=PositionFin;
321 Keyword=GetKeyword(Substring);
322 if (DEBUG) std::cout<<"Keyword="<< Keyword <<std::endl;
323 data.DimensionNumber=GetDimensionnality(Substring);
324 if (DEBUG) std::cout<<"data.DimensionNumber="<< data.DimensionNumber <<std::endl;
326 data.DataType=GetContentType(Substring);
327 if (DEBUG) std::cout<<"data.DataType="<< data.DataType <<std::endl;
328 data.NumberOfElements=GetKeywordNumberOfElements(Substring);
329 if(data.DataType=="string")
330 data.DimensionNumber=0;
331 if(data.DataType=="string")
332 data.NumberOfElements=1;
333 if (DEBUG) std::cout<<"data.NumberOfElements="<< data.NumberOfElements <<std::endl;
336 while (i<=data.DimensionNumber)
338 data.DimensionNumberValue.push_back(GetIntValueOfDimN(Substring,i));
339 if (DEBUG) std::cout<<"data.DimensionNumberValue["<<i<<"]="<< data.DimensionNumberValue[i] <<std::endl;
343 if (DEBUG) std::cout<< "data= ";
345 for(i =1;i<=data.NumberOfElements;i++)
348 if (data.DataType=="int")
350 data.IntValue.push_back(GetIntValueN(Substring,i));
351 data.DoubleValue.push_back((double) GetIntValueN(Substring,i));
352 if (DEBUG) std::cout<< data.IntValue[i-1]<<" ";
355 if (data.DataType=="float")
357 data.DoubleValue.push_back(GetDoubleValueN(Substring,i));
358 if (DEBUG) std::cout<< data.DoubleValue[i-1]<<" ";
362 if (data.DataType=="string")
364 data.StringValue.push_back(GetTextValueN(Substring,0));
365 if (DEBUG) std::cout<< "[" << data.StringValue[0]<<"] ";
368 if (DEBUG) std::cout<< std::endl << "---- " <<std::endl;
370 BrukerDataSet::BrukerHeaderMap[ Keyword ] = data;
371 data.DimensionNumberValue.clear();
372 data.IntValue.clear();
373 data.DoubleValue.clear();
374 data.StringValue.clear();
375 data.DataType.clear();
377 //std::cout<<std::endl;
383 void BrukerDataSet::PrintKey(std::string & KeyWord)
386 if(!BrukerDataSet::CheckExistKeyword(KeyWord))
388 std::cout<< "KeyWord = "<<KeyWord <<" doesn't exist !"<<std::endl;
392 std::cout<< "KeyWord = "<<KeyWord <<std::endl;
393 BrukerDataSet::BrukerHeaderMap[ KeyWord ].PrintSelf();
400 void BrukerDataSet::PrintSelf()
402 BrukMapType::iterator it;
403 for (it= BrukerHeaderMap.begin();
404 it != BrukerHeaderMap.end();
407 std::cout << std::endl << "-----------------[" <<(*it).first << "]" << std::endl;
408 std::string a = (*it).first;
414 bool BrukerDataSet::CheckExistKeyword(std::string &KeyWord)
416 BrukMapType::iterator element;
417 element = BrukerHeaderMap.find(KeyWord);
418 if (element != BrukerHeaderMap.end() )
423 bool BrukerDataSet::CheckExistKeyword(const char *KeyWord)
425 std::string temp(KeyWord);
426 BrukerDataSet::CheckExistKeyword(temp);
431 const BrukerFieldData& BrukerDataSet::GetFieldData(std::string & kw)
433 return BrukerHeaderMap[kw];
436 const BrukerFieldData& BrukerDataSet::GetFieldData(const char *kw)
438 std::string str_kw(kw);
439 return BrukerHeaderMap[str_kw];
443 bool BrukerDataSet::Getkspace(std::string &FileToRead)
445 std::string GO_raw_data_format("GO_raw_data_format");
446 if (!CheckExistKeyword(GO_raw_data_format))
450 FID.open(FileToRead.c_str(), std::ios::binary);
451 if (FID.rdstate()==std::ios::failbit)
453 FID.seekg (0, std::ios::end);
454 long length = FID.tellg();
455 FID.seekg (0, std::ios::beg);
459 if (GetTextValueN(GO_raw_data_format,1)=="GO_32BIT_SGN_INT")
460 NumberOfValues=length/4;
461 if (GetTextValueN(GO_raw_data_format,1)=="GO_16BIT_SGN_INT")
462 NumberOfValues=length/2;
463 if (GetTextValueN(GO_raw_data_format,1)=="GO_32BIT_FLOAT")
464 NumberOfValues=length/4;
467 buffer = new char[length];
469 FID.read (buffer,length);
471 //for (long i=0;i<NumberOfValues;i++) BrukerDataSet::WholeKspace.pushback(buffer[i]);
477 std::vector< int > BrukerDataSet::GetLoopStructure() const
479 return LoopStructure;
483 @fn bool BrukerDataSet::SetLoopStructure (const std::vector<int> & theValue )
484 * @brief this methods provide a way to inject a userdefined loop structure, be very aware that this method is not foolproof
488 bool BrukerDataSet::SetLoopStructure ( const std::vector<int> & theValue )
490 LoopStructure = theValue;
496 @fn bool BrukerDataSet::SetLoopStructureOld ( )
497 * @brief method to set the default Bruker loopstructure (not yet able to deal with EPI, SPIRAL or spectroscopic experiments
499 * @todo implement multicoil version
501 bool BrukerDataSet::SetLoopStructureOld ()
503 LoopStructure.clear();
505 \file brukerdataset.cpp
506 \fn bool BrukerDataSet::setGenericLoopStructure ( )
507 \brief sets the loop structure of a standard Bruker experiment
509 NR (Nbre de repetitions)
510 NILoop (Boucle eventuelle extra (Diffusion par exemple) si NI<>(NSLICES x NECHOES) cette boucle est a� NI/(NSLICES x NECHOES)
511 (Attention NILoop peut masquer plusieurs boucles imbriquees !!!!!)
512 ACQ_size[1..M] (Codage suivant les autres dimensions)
513 NSLICES (Nombre de tranches)
514 ACQ_phase_factor (Facteur turbo de la sequence)
515 ACQ_ns_list_size (Nombre d'echos)
516 ACQ_size[0] (Ligne acq reelle)
521 std::string NRStr("NR");
522 std::string NIStr("NI");
523 std::string ACQ_sizeStr("ACQ_size");
524 std::string ACQ_phase_factorStr("ACQ_phase_factor");
525 std::string ACQ_ns_listStr("ACQ_ns_list");
526 std::string ACQ_ns_list_sizeStr("ACQ_ns_list_size");
527 std::string NSLICESStr("NSLICES");
530 std::vector<int> TempIntVect;
533 if (! CheckExistKeyword(NRStr)) return false;
534 if (! CheckExistKeyword(NIStr)) return false;
535 if (! CheckExistKeyword(ACQ_sizeStr)) return false;
536 if (! CheckExistKeyword(ACQ_phase_factorStr))return false;
537 if (! CheckExistKeyword(ACQ_ns_list_sizeStr))return false;
538 if (! CheckExistKeyword(NSLICESStr)) return false;
540 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].IntValue[0]);
541 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[(std::string) "ACQ_ns_list_size"].IntValue[0]);
542 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[(std::string) "ACQ_phase_factor"].IntValue[0]);
543 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[(std::string) "NSLICES"].IntValue[0]);
544 if (1<=BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].DimensionNumber ){
545 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].IntValue[1]/BrukerDataSet::BrukerHeaderMap[(std::string) "ACQ_phase_factor"].IntValue[0]);
546 if (2<=BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].DimensionNumber )
548 for(i=2;i<=BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].DimensionNumber;i++)
550 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].IntValue[i]);
554 // Ici, boucles additionnelles si elles existent regroupees en une seule
555 //temp=GetIntValueN(NIStr,1)/(GetIntValueN(NSLICESStr,1)*GetIntValueN(NECHOESStr,1));
556 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]);
558 TempIntVect.push_back(temp);
559 // fin des boucles cachees
561 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[ (std::string) "NR" ].IntValue[0]);
563 LoopStructure=TempIntVect;
569 @fn bool BrukerDataSet::SetLoopStructure ( )
570 * @brief method to set the default Bruker loopstructure (not yet able to deal with EPI, SPIRAL or spectroscopic experiments
572 @todo implement multicoil version
574 bool BrukerDataSet::SetLoopStructure ()
576 if (! SetInnerObjectLoopStructure()) return false;
577 if (! SetOuterObjectLoopStructure()) return false;
578 std::vector<int> Inner=GetInnerObjectLoopStructure();
579 std::vector<int> Outer=GetOuterObjectLoopStructure();
580 std::vector<int> TmpVect;
582 TmpVect.insert(TmpVect.end(),Outer.begin(),Outer.end());
583 LoopStructure=TmpVect;
587 std::vector< std :: vector < int > > BrukerDataSet::GetBrukerObjectsLineList() const
589 return BrukerObjectsLineList;
593 bool BrukerDataSet::SetBrukerObjectsLineList ()
596 std::vector<int> Loop =GetLoopStructure();
597 int NumberOfLines, i,j;
601 while (i<Loop.size())
603 NumberOfLines=NumberOfLines*Loop[i];
607 std::vector<int> TempVect (Loop.size()-1,0);
608 std::vector<int> k (Loop.size()-1,0);
609 std::vector<std::vector<int> > TempLineList (NumberOfLines,TempVect);
611 for (i=0;i<NumberOfLines;i++){
612 for (j=1;j<=Loop.size()-1;j++) {
613 if (k[j-1] >= Loop[j]) {
618 for (j=1;j<=Loop.size()-1;j++)
619 TempLineList[i][j-1]=k[j-1];
622 BrukerObjectsLineList=TempLineList;
627 std::vector< std::vector < int > > BrukerDataSet::GetBrukerImageList() const
629 return BrukerImageList;
633 bool BrukerDataSet::SetBrukerImageList ()
635 if (LoopStructure.size()==0)
636 SetImageLoopStructure();
638 std::vector<int> Loop =GetImageLoopStructure();
639 int NumberOfLines, i,j;
643 while (i<Loop.size())
645 NumberOfLines=NumberOfLines*Loop[i];
649 std::vector<int> TempVect (Loop.size()-1,0);
650 std::vector<int> k (Loop.size()-1,0);
651 std::vector<std::vector<int> > TempLineList (NumberOfLines,TempVect);
653 for (i=0;i<NumberOfLines;i++){
654 for (j=1;j<=Loop.size()-1;j++) {
655 if (k[j-1] >= Loop[j]) {
660 for (j=1;j<=Loop.size()-1;j++)
661 TempLineList[i][j-1]=k[j-1];
664 BrukerImageList=TempLineList;
670 std::map<std::string, BrukerFieldData> BrukerDataSet::GetBrukerHeaderMap() const
672 return BrukerHeaderMap;
678 //std::map<std::string, BrukerFieldData> BrukerDataSet::GetBrukerHeaderMap() const
680 // return BrukerHeaderMap;
684 bool BrukerDataSet::SetInnerObjectLoopStructure()
689 * ACQ_size[1..M] (Codage suivant les autres dimensions)
690 NSLICES (Nombre de tranches)
691 ACQ_phase_factor (Facteur turbo de la sequence)
692 ACQ_ns_list_size (Nombre d'echos)
693 ACQ_size[0] (Ligne acq reelle)
698 std::vector<int> TempIntVect;
702 if (! CheckExistKeyword("ACQ_size")) return false;
703 if (! CheckExistKeyword("ACQ_phase_factor"))return false;
704 if (! CheckExistKeyword("ACQ_ns_list_size"))return false;
705 if (! CheckExistKeyword("NSLICES")) return false;
708 //std::cout<< "BrukerDataSet::BrukerHeaderMap[ (std::string) ACQ_size ].IntValue[0]" <<BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].IntValue[0] << std::endl;
709 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].IntValue[0]);
710 //std::cout<< "BrukerDataSet::BrukerHeaderMap[ (std::string) ACQ_size ].IntValue[0]" <<BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].IntValue[0] << std::endl;
711 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[(std::string) "ACQ_ns_list_size"].IntValue[0]);
712 //std::cout<<"BrukerDataSet::BrukerHeaderMap[(std::string) ACQ_ns_list_size].IntValue[0]" << BrukerDataSet::BrukerHeaderMap[(std::string) "ACQ_ns_list_size"].IntValue[0] << std::endl;
713 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[(std::string) "ACQ_phase_factor"].IntValue[0]);
714 //std::cout<<"BrukerDataSet::BrukerHeaderMap[(std::string) ACQ_phase_factor].IntValue[0]" << BrukerDataSet::BrukerHeaderMap[(std::string) "ACQ_phase_factor"].IntValue[0]<< std::endl;
715 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[(std::string) "NSLICES"].IntValue[0]);
716 //std::cout << "BrukerDataSet::BrukerHeaderMap[(std::string) NSLICES].IntValue[0]" << BrukerDataSet::BrukerHeaderMap[(std::string) "NSLICES"].IntValue[0] << std::endl;
717 if (1<=BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].DimensionNumber )
719 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].IntValue[1]/BrukerDataSet::BrukerHeaderMap[(std::string) "ACQ_phase_factor"].IntValue[0]);
720 //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"
721 //].IntValue[1]/BrukerDataSet::BrukerHeaderMap[(std::string) "ACQ_phase_factor"].IntValue[0] << std::endl;
722 if (2<=BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].DimensionNumber )
724 for(i=2;i<=BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].DimensionNumber;i++)
726 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[ (std::string) "ACQ_size" ].IntValue[i]);
731 InnerObjectLoopStructure=TempIntVect;
736 std::vector< int > BrukerDataSet::GetInnerObjectLoopStructure() const
738 return InnerObjectLoopStructure;
741 std::vector< int > BrukerDataSet::GetOuterObjectLoopStructure() const
743 return OuterObjectLoopStructure;
747 bool BrukerDataSet::SetOuterObjectLoopStructure ()
749 OuterObjectLoopStructure.clear();
751 NR (Nbre de repetitions)
752 NILoop (Boucle eventuelle extra (Diffusion par exemple) si NI<>(NSLICES x NECHOES) cette boucle est a� NI/(NSLICES x NECHOES)
753 (Attention NILoop peut masquer plusieurs boucles imbriquees !!!!!)
756 std::vector<int> TempIntVect;
758 if (! CheckExistKeyword("NR")) return false;
759 if (! CheckExistKeyword("NI")) return false;
760 // Ici, boucles additionnelles si elles existent regroupees en une seule
761 //temp=GetIntValueN(NIStr,1)/(GetIntValueN(NSLICESStr,1)*GetIntValueN(NECHOESStr,1));
762 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]);
764 TempIntVect.push_back(temp);
765 // fin des boucles cachees
766 TempIntVect.push_back(BrukerDataSet::BrukerHeaderMap[ (std::string) "NR" ].IntValue[0]);
767 OuterObjectLoopStructure=TempIntVect;
772 std::vector< int > BrukerDataSet::GetImageLoopStructure() const
774 return ImageLoopStructure;
778 bool BrukerDataSet::SetImageLoopStructure ( )
780 ImageLoopStructure.clear();
781 std::vector<int> TempIntVect1=GetInnerObjectLoopStructure();
782 std::vector<int> TempIntVect2=GetOuterObjectLoopStructure();
783 std::vector<int> TempIntVect3(TempIntVect1.size(),1);
784 std::vector<int> TempIntVect4;
785 TempIntVect3[1]=TempIntVect1[1];
786 TempIntVect3[3]=TempIntVect1[3];
787 TempIntVect4=TempIntVect3;
788 TempIntVect4.insert(TempIntVect4.end(),TempIntVect2.begin(),TempIntVect2.end());
789 ImageLoopStructure = TempIntVect4;