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 # ------------------------------------------------------------------------
28 // C++ Interface: brukerdataset
33 // Author: <Denis Grenier>, (C) 2008
35 // Copyright: See COPYING file that comes with this distribution
38 #ifndef BRUKERDATASET_H
39 #define BRUKERDATASET_H
41 /*! \file brukerdataset.h
52 #include "boost/regex.hpp"
54 #include "brukerSystem.h"
55 #include "brukerFieldData.h"
56 #include "brukerobjectvaryingproperties.h"
58 const boost::regex KeyWord("^##\\$?([^[:cntrl:]]+)=.*");
59 const boost::regex UnsignedInteger("([0-9]+)");
60 const boost::regex SignedInteger("(\\-?[0-9]+)");
61 const boost::regex Float("([\\-\\+eE0-9\\.]+)");
62 const boost::regex IntOrFloat("([\\-\\+eE0-9\\.]+)");
63 const boost::regex Dimensionnality("=\\( ([^[:cntrl:]]+) \\)");
64 const boost::regex BufferNValues("^##\\$?[^[:cntrl:]]+=\\( [^[:cntrl:]]+ \\)[[:space:]]*[[:cntrl:]]*([^[.dollar-sign.]]+).*");
65 const boost::regex Buffer1Value("^##\\$?[^[:cntrl:]]+=(.*)");
66 const boost::regex IntSeries("([\\-0-9]*[[:space:]]*[[:cntrl:]]*)+");
67 const boost::regex FloatSeries("([\\-\\+eE0-9\\.]+[[:space:]]*[[:cntrl:]]*)+");
70 /*! \class BrukerDataSet
71 \brief This class purpose is to extract information from a bruker experiment and setup the extracted information for an easy use
74 class creaBruker_EXPORT BrukerDataSet{
75 friend class BrukerKspaceObject;
76 typedef std::map<std::string, BrukerFieldData> BrukMapType;
77 //typedef BrukMapType::iterator iterator;
78 //typedef BrukMapType::const_iterator const_iterator;
82 bool LoadFile(std::string FileToRead);
84 void PrintKey(std::string &);
86 bool Getkspace (std::string &);
87 const BrukerFieldData& GetFieldData(std::string &);
88 const BrukerFieldData& GetFieldData(const char *);
89 bool SetLoopStructure ( int dimension);
90 bool SetLoopStructureOld ( );
91 bool SetLoopStructure (const std::vector<int >& theValue);
92 std::vector<int > GetLoopStructure ( ) const;
93 bool SetBrukerObjectsLineList( );
94 bool SetBrukerImageList ( );
96 std::vector<std::vector <int > > GetBrukerObjectsLineList() const;
97 std::vector<std::vector <int > > GetBrukerImageList() const;
98 std::map<std::string, BrukerFieldData > GetBrukerHeaderMap() const;
100 bool SetInnerObjectLoopStructure (int dimension);
101 std::vector<int > GetInnerObjectLoopStructure() const;
102 bool SetOuterObjectLoopStructure (int dimension);
103 std::vector<int > GetOuterObjectLoopStructure() const;
104 bool SetImageLoopStructure ();
105 std::vector<int > GetImageLoopStructure() const;
107 BrukerObjectVaryingProperties ObjectVaryingProperties;
110 std::string GetKeyword (std::string &kw);
111 std::string SearchBufferForText (std::string &kw, const boost::regex& RegExp);
112 bool BoolMatchBufferForText (std::string &kw, const boost::regex& RegExp);
113 std::string MatchBufferForText (std::string &kw, const boost::regex& RegExp);
114 int GetDimensionnality (std::string &kw);
115 int GetIntValueOfDimN (std::string &kw, int n);
116 int GetIntValueN (std::string &kw, int n);
117 std::string GetContentType (std::string &kw);
118 std::string GetValuesPart (std::string &kw);
119 double GetDoubleValueN (std::string &kw, int n);
120 int GetKeywordNumberOfElements(std::string &kw);
121 std::string GetTextValueN (std::string &kw, int n);
122 bool CheckExistKeyword (std::string &kw);
123 bool CheckExistKeyword (const char *kw);
124 std::string RemoveNewlines(std::string);
125 std::string RemoveSpaces(std::string);
129 std::map<std::string, BrukerFieldData> BrukerHeaderMap;
130 std::string WholeHeader;
131 std::vector<double> WholeKspace;
132 std::vector<int> LoopStructure;
133 std::vector<int> InnerObjectLoopStructure;
134 std::vector<int> OuterObjectLoopStructure;
135 std::vector<int> ImageLoopStructure;
136 std::vector <std::vector<int> > BrukerObjectsLineList;
137 std::vector <std::vector<int> > BrukerImageList;