00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef G_DCMDATAENTRY_H_
00020 #define _GDCMDATAENTRY_H_
00021
00022 #include "gdcmDocEntry.h"
00023
00024 #include <vector>
00025 #include <iostream>
00026
00027 namespace GDCM_NAME_SPACE
00028 {
00029
00037 class GDCM_EXPORT DataEntry : public DocEntry
00038 {
00039 gdcmTypeMacro(DataEntry);
00040
00041 public:
00043
00045 static DataEntry *New(DocEntry *d) {return new DataEntry(d);}
00047 static DataEntry *New(uint16_t group,uint16_t elem, VRKey const &vr)
00048 {return new DataEntry(group,elem,vr);}
00049
00050
00051 void Print(std::ostream &os = std::cout, std::string const &indent = "");
00052
00053
00054 virtual void WriteContent(std::ofstream *fp, FileType filetype,
00055 bool insideMetaElements );
00056 uint32_t ComputeFullLength();
00057
00058
00059
00060
00061
00064 uint8_t *GetBinArea() { return BinArea; }
00065 void SetBinArea( uint8_t *area, bool self = true );
00066 void CopyBinArea( uint8_t *area, uint32_t length );
00067
00068 void SetValue(const uint32_t &id,const double &val);
00069 double GetValue(const uint32_t &id) const;
00070 uint32_t GetValueCount() const;
00071 bool IsValueCountValid() ;
00072
00073 void SetString(std::string const &value);
00074 std::string const &GetString() const;
00075
00077 void SetSelfArea(bool area) { SelfArea = area; }
00079 bool IsSelfArea() { return SelfArea; }
00080
00082 enum TValueState
00083 {
00084 STATE_LOADED = 0x00,
00085 STATE_NOTLOADED = 0x01,
00086 STATE_UNFOUND = 0x02,
00087 STATE_UNREAD = 0x03
00088 };
00089
00091 enum TValueFlag
00092 {
00093 FLAG_NONE = 0x00,
00094 FLAG_PIXELDATA = 0x01
00095 };
00096
00097
00099 void SetState(const TValueState &state) { State = state; }
00101 const TValueState &GetState() const { return State; }
00103 bool IsNotLoaded() { return State == STATE_NOTLOADED; }
00105 bool IsUnfound() { return State == STATE_UNFOUND; }
00107 bool IsUnread() { return State == STATE_UNREAD; }
00109 bool IsGoodValue() { return State == STATE_LOADED; }
00110
00111
00113 void SetFlag(const TValueFlag &flag) { Flag = flag; }
00115 const TValueFlag &GetFlag() const { return Flag; }
00117 bool IsPixelData() { return (Flag &FLAG_PIXELDATA) != 0; }
00118
00119 virtual void Copy(DocEntry *doc);
00120
00123 static const uint32_t &GetMaxSizePrintEntry() { return MaxSizePrintEntry; }
00125 static void SetMaxSizePrintEntry(const uint32_t &size)
00126 { MaxSizePrintEntry = size; }
00127
00128 bool GetDSValue(std::vector <double> &valueVector);
00129
00130 protected:
00131
00132 DataEntry(DocEntry *d);
00133 DataEntry(uint16_t group,uint16_t elem,VRKey const &vr);
00134 ~DataEntry();
00135
00136
00137 void NewBinArea( );
00138 void DeleteBinArea( );
00139
00140
00143 uint8_t *BinArea;
00145 bool SelfArea;
00148
00149 mutable std::string *StrArea;
00150
00151 private:
00153 TValueFlag Flag;
00155 TValueState State;
00156
00158 static uint32_t MaxSizePrintEntry;
00159 };
00160
00161 }
00162
00163
00164 #endif
00165