X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=src%2FgdcmDataEntry.h;h=37d6d3e0644dbe2b64b1573063f0dbbfdfbc2066;hb=6c5eca9df49cc2ecbb9b343ec286a91df3998cbf;hp=24073836c8d62d5f23f4b5a25c0c04373d4581b2;hpb=bc69950a406d06c50f0fb75a96572784965cb534;p=gdcm.git diff --git a/src/gdcmDataEntry.h b/src/gdcmDataEntry.h index 24073836..37d6d3e0 100644 --- a/src/gdcmDataEntry.h +++ b/src/gdcmDataEntry.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDataEntry.h,v $ Language: C++ - Date: $Date: 2005/10/18 08:35:51 $ - Version: $Revision: 1.1 $ + Date: $Date: 2005/11/07 09:46:36 $ + Version: $Revision: 1.7 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -27,7 +27,7 @@ namespace gdcm { //----------------------------------------------------------------------------- /** - * \brief Any Dicom Document (File or DicomDir) contains + * \brief Any Dicom Document (File or DicomDir, or ...) contains * a set of DocEntry - Dicom entries - * (when successfuly parsed against a given Dicom dictionary) * DataEntry is an elementary DocEntry (as opposed to SeqEntry). @@ -35,18 +35,20 @@ namespace gdcm */ class GDCM_EXPORT DataEntry : public DocEntry { + gdcmTypeMacro(DataEntry); + public: - DataEntry(DictEntry *e); - DataEntry(DocEntry *d); - ~DataEntry(); + static DataEntry *New(DictEntry *e) {return new DataEntry(e);} + static DataEntry *New(DocEntry *d) {return new DataEntry(d);} // Print void Print(std::ostream &os = std::cout, std::string const &indent = ""); // Write virtual void WriteContent(std::ofstream *fp, FileType filetype); - -// Set/Get datas + uint32_t ComputeFullLength(); + +// Set/Get data /// Sets the value (string) of the current Dicom entry //virtual void SetValue(std::string const &val); /// \brief Returns the 'Value' (e.g. "Dupond^Marcel") converted @@ -63,26 +65,50 @@ public: void SetValue(const uint32_t &id,const double &val); double GetValue(const uint32_t &id) const; uint32_t GetValueCount(void) const; + bool IsValueCountValid() const; void SetString(std::string const &value); std::string const &GetString() const; /// \brief Sets SelfArea void SetSelfArea(bool area) { SelfArea = area; } - /// \brief Returns SelfArea + /// \brief True if Entry owns its BinArea bool IsSelfArea() { return SelfArea; } + ///\brief values for current state of a DataEntry (internal use only) + typedef enum + { + STATE_LOADED = 0x00, + STATE_NOTLOADED = 0x01, + STATE_UNFOUND = 0x02, + STATE_UNREAD = 0x03 + } TValueState; + + ///\brief values for current pixel status of a DataEntry (internal use only) + typedef enum + { + FLAG_NONE = 0x00, + FLAG_PIXELDATA = 0x01 + } TValueFlag; + // State - void SetState(const char &state) { State = state; } - const char &GetState() const { return State; } + void SetState(const TValueState &state) { State = state; } + const TValueState &GetState() const { return State; } + /// \brief true when value Entry not loaded bool IsNotLoaded() { return State == STATE_NOTLOADED; } + /// \brief true if Entry not found bool IsUnfound() { return State == STATE_UNFOUND; } + /// \brief true if Entry not read bool IsUnread() { return State == STATE_UNREAD; } + /// \brief true if Entry value properly loaded bool IsGoodValue() { return State == 0; } // Flags - void SetFlag(const char &flag) { Flag = flag; } - const char &GetFlag() const { return Flag; } + /// \brief sets the 'pixel data flag' + void SetFlag(const TValueFlag &flag) { Flag = flag; } + /// \brief returns the 'pixel data flag' + const TValueFlag &GetFlag() const { return Flag; } + /// \brief true id Entry is a Pixel Data entry bool IsPixelData() { return (Flag & FLAG_PIXELDATA) != 0; } void Copy(DocEntry *doc); @@ -93,21 +119,11 @@ public: /// \brief Header Elements too long will not be printed static void SetMaxSizePrintEntry(const uint32_t &size) { MaxSizePrintEntry = size; } - typedef enum - { - STATE_LOADED = 0x00, - STATE_NOTLOADED = 0x01, - STATE_UNFOUND = 0x02, - STATE_UNREAD = 0x03, - } TValueState; - - typedef enum - { - FLAG_NONE = 0x00, - FLAG_PIXELDATA = 0x01, - } TValueFlag; - protected: + DataEntry(DictEntry *e); + DataEntry(DocEntry *d); + ~DataEntry(); + // Methods : void NewBinArea(void); void DeleteBinArea(void); @@ -118,12 +134,15 @@ protected: uint8_t *BinArea; /// \brief Whether DataEntry has its own BinArea or not bool SelfArea; - + /// \brief std::string representable value of the Entry. + /// Parts of a multivaluated data are separated by back-slash mutable std::string StrArea; private: - char Flag; - char State; + /// \brief 0 for straight entries, FLAG_PIXELDATA for Pixel Data entries + TValueFlag Flag; + /// \brief Entry status : STATE_NOTLOADED,STATE_UNFOUND, STATE_UNREAD, 0 + TValueState State; /// \brief Size threshold above which an element val /// By default, this upper bound is fixed to 64 bytes.