2 // C++ Interface: brukerdataset
7 // Author: <Denis Grenier>, (C) 2008
9 // Copyright: See COPYING file that comes with this distribution
12 #ifndef BRUKERDATASET_H
13 #define BRUKERDATASET_H
15 /*! \file brukerdataset.h
26 #include "boost/regex.hpp"
28 #include "brukerSystem.h"
29 #include "brukerFieldData.h"
30 #include "brukerobjectvaryingproperties.h"
32 const boost::regex KeyWord("^##\\$?([^[:cntrl:]]+)=.*");
33 const boost::regex UnsignedInteger("([0-9]+)");
34 const boost::regex SignedInteger("(\\-?[0-9]+)");
35 const boost::regex Float("([\\-\\+eE0-9\\.]+)");
36 const boost::regex IntOrFloat("([\\-\\+eE0-9\\.]+)");
37 const boost::regex Dimensionnality("=\\( ([^[:cntrl:]]+) \\)");
38 const boost::regex BufferNValues("^##\\$?[^[:cntrl:]]+=\\( [^[:cntrl:]]+ \\)[[:space:]]*[[:cntrl:]]*([^[.dollar-sign.]]+).*");
39 const boost::regex Buffer1Value("^##\\$?[^[:cntrl:]]+=(.*)");
40 const boost::regex IntSeries("([\\-0-9]*[[:space:]]*[[:cntrl:]]*)+");
41 const boost::regex FloatSeries("([\\-\\+eE0-9\\.]+[[:space:]]*[[:cntrl:]]*)+");
44 /*! \class BrukerDataSet
45 \brief This class purpose is to extract information from a bruker experiment and setup the extracted information for an easy use
48 class creaBruker_EXPORT BrukerDataSet{
49 friend class BrukerKspaceObject;
50 typedef std::map<std::string, BrukerFieldData> BrukMapType;
51 //typedef BrukMapType::iterator iterator;
52 //typedef BrukMapType::const_iterator const_iterator;
56 bool LoadFile(std::string& FileToRead);
58 void PrintKey(std::string &);
60 bool Getkspace (std::string &);
61 const BrukerFieldData& GetFieldData(std::string &);
62 const BrukerFieldData& GetFieldData(const char *);
63 bool SetLoopStructure ( );
64 bool SetLoopStructureOld ( );
65 bool SetLoopStructure (const std::vector<int >& theValue);
66 std::vector<int > GetLoopStructure ( ) const;
67 bool SetBrukerObjectsLineList( );
68 bool SetBrukerImageList ( );
70 std::vector<std::vector <int > > GetBrukerObjectsLineList() const;
71 std::vector<std::vector <int > > GetBrukerImageList() const;
72 std::map<std::string, BrukerFieldData > GetBrukerHeaderMap() const;
74 bool SetInnerObjectLoopStructure ();
75 std::vector<int > GetInnerObjectLoopStructure() const;
76 bool SetOuterObjectLoopStructure ();
77 std::vector<int > GetOuterObjectLoopStructure() const;
78 bool SetImageLoopStructure ();
79 std::vector<int > GetImageLoopStructure() const;
81 BrukerObjectVaryingProperties ObjectVaryingProperties;
84 std::string GetKeyword (std::string &kw);
85 std::string SearchBufferForText (std::string &kw, const boost::regex& RegExp);
86 bool BoolMatchBufferForText (std::string &kw, const boost::regex& RegExp);
87 std::string MatchBufferForText (std::string &kw, const boost::regex& RegExp);
88 int GetDimensionnality (std::string &kw);
89 int GetIntValueOfDimN (std::string &kw, int n);
90 int GetIntValueN (std::string &kw, int n);
91 std::string GetContentType (std::string &kw);
92 std::string GetValuesPart (std::string &kw);
93 double GetDoubleValueN (std::string &kw, int n);
94 int GetKeywordNumberOfElements(std::string &kw);
95 std::string GetTextValueN (std::string &kw, int n);
96 bool CheckExistKeyword (std::string &kw);
97 bool CheckExistKeyword (const char *kw);
98 std::string RemoveNewlines(std::string);
99 std::string RemoveSpaces(std::string);
103 std::map<std::string, BrukerFieldData> BrukerHeaderMap;
104 std::string WholeHeader;
105 std::vector<double> WholeKspace;
106 std::vector<int> LoopStructure;
107 std::vector<int> InnerObjectLoopStructure;
108 std::vector<int> OuterObjectLoopStructure;
109 std::vector<int> ImageLoopStructure;
110 std::vector <std::vector<int> > BrukerObjectsLineList;
111 std::vector <std::vector<int> > BrukerImageList;