// // C++ Interface: brukerdataset // // Description: // // // Author: , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef BRUKERDATASET_H #define BRUKERDATASET_H /*! \file brukerdataset.h */ #include #include #include #include #include #include #include #include #include #include "boost/regex.hpp" #include "brukerSystem.h" #include "brukerFieldData.h" #include "brukerobjectvaryingproperties.h" const boost::regex KeyWord("^##\\$?([^[:cntrl:]]+)=.*"); const boost::regex UnsignedInteger("([0-9]+)"); const boost::regex SignedInteger("(\\-?[0-9]+)"); const boost::regex Float("([\\-\\+eE0-9\\.]+)"); const boost::regex IntOrFloat("([\\-\\+eE0-9\\.]+)"); const boost::regex Dimensionnality("=\\( ([^[:cntrl:]]+) \\)"); const boost::regex BufferNValues("^##\\$?[^[:cntrl:]]+=\\( [^[:cntrl:]]+ \\)[[:space:]]*[[:cntrl:]]*([^[.dollar-sign.]]+).*"); const boost::regex Buffer1Value("^##\\$?[^[:cntrl:]]+=(.*)"); const boost::regex IntSeries("([\\-0-9]*[[:space:]]*[[:cntrl:]]*)+"); const boost::regex FloatSeries("([\\-\\+eE0-9\\.]+[[:space:]]*[[:cntrl:]]*)+"); /*! \class BrukerDataSet \brief This class purpose is to extract information from a bruker experiment and setup the extracted information for an easy use */ class creaBruker_EXPORT BrukerDataSet{ friend class BrukerKspaceObject; typedef std::map BrukMapType; //typedef BrukMapType::iterator iterator; //typedef BrukMapType::const_iterator const_iterator; public: BrukerDataSet(); ~BrukerDataSet(); bool LoadFile(std::string FileToRead); bool FillMap(); void PrintKey(std::string &); void PrintSelf(); bool Getkspace (std::string &); const BrukerFieldData& GetFieldData(std::string &); const BrukerFieldData& GetFieldData(const char *); bool SetLoopStructure ( ); bool SetLoopStructureOld ( ); bool SetLoopStructure (const std::vector& theValue); std::vector GetLoopStructure ( ) const; bool SetBrukerObjectsLineList( ); bool SetBrukerImageList ( ); std::vector > GetBrukerObjectsLineList() const; std::vector > GetBrukerImageList() const; std::map GetBrukerHeaderMap() const; bool SetInnerObjectLoopStructure (); std::vector GetInnerObjectLoopStructure() const; bool SetOuterObjectLoopStructure (); std::vector GetOuterObjectLoopStructure() const; bool SetImageLoopStructure (); std::vector GetImageLoopStructure() const; BrukerObjectVaryingProperties ObjectVaryingProperties; private: std::string GetKeyword (std::string &kw); std::string SearchBufferForText (std::string &kw, const boost::regex& RegExp); bool BoolMatchBufferForText (std::string &kw, const boost::regex& RegExp); std::string MatchBufferForText (std::string &kw, const boost::regex& RegExp); int GetDimensionnality (std::string &kw); int GetIntValueOfDimN (std::string &kw, int n); int GetIntValueN (std::string &kw, int n); std::string GetContentType (std::string &kw); std::string GetValuesPart (std::string &kw); double GetDoubleValueN (std::string &kw, int n); int GetKeywordNumberOfElements(std::string &kw); std::string GetTextValueN (std::string &kw, int n); bool CheckExistKeyword (std::string &kw); bool CheckExistKeyword (const char *kw); std::string RemoveNewlines(std::string); std::string RemoveSpaces(std::string); //BrukMapType std::map BrukerHeaderMap; std::string WholeHeader; std::vector WholeKspace; std::vector LoopStructure; std::vector InnerObjectLoopStructure; std::vector OuterObjectLoopStructure; std::vector ImageLoopStructure; std::vector > BrukerObjectsLineList; std::vector > BrukerImageList; protected: }; #endif