1 /*=========================================================================
4 Module: $RCSfile: gdcmDataEntry.h,v $
6 Date: $Date: 2005/10/23 15:32:30 $
7 Version: $Revision: 1.4 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
19 #ifndef GDCMDATAENTRY_H
20 #define GDCMDATAENTRY_H
22 #include "gdcmDocEntry.h"
28 //-----------------------------------------------------------------------------
30 * \brief Any Dicom Document (File or DicomDir, or ...) contains
31 * a set of DocEntry - Dicom entries -
32 * (when successfuly parsed against a given Dicom dictionary)
33 * DataEntry is an elementary DocEntry (as opposed to SeqEntry).
34 * Depending on the type of its content,
36 class GDCM_EXPORT DataEntry : public DocEntry
39 DataEntry(DictEntry *e);
40 DataEntry(DocEntry *d);
44 void Print(std::ostream &os = std::cout, std::string const &indent = "");
47 virtual void WriteContent(std::ofstream *fp, FileType filetype);
50 /// Sets the value (string) of the current Dicom entry
51 //virtual void SetValue(std::string const &val);
52 /// \brief Returns the 'Value' (e.g. "Dupond^Marcel") converted
53 /// into a 'string', event if it's physically stored on disk as an integer
54 /// (e.g. : 0x000c returned as "12")
55 //virtual std::string const &GetValue() const { return Value; }
57 /// \brief Returns the area value of the current Dicom Entry
58 /// when it's not string-translatable (e.g : LUT table, overlay, icon)
59 uint8_t *GetBinArea() { return BinArea; }
60 void SetBinArea( uint8_t *area, bool self = true );
61 void CopyBinArea( uint8_t *area, uint32_t length );
63 void SetValue(const uint32_t &id,const double &val);
64 double GetValue(const uint32_t &id) const;
65 uint32_t GetValueCount(void) const;
66 bool IsValueCountValid() const;
68 void SetString(std::string const &value);
69 std::string const &GetString() const;
71 /// \brief Sets SelfArea
72 void SetSelfArea(bool area) { SelfArea = area; }
73 /// \brief True if Entry owns its BinArea
74 bool IsSelfArea() { return SelfArea; }
77 void SetState(const char &state) { State = state; }
78 const char &GetState() const { return State; }
79 /// \brief true when value Entry not loaded
80 bool IsNotLoaded() { return State == STATE_NOTLOADED; }
81 /// \brief true if Entry not found
82 bool IsUnfound() { return State == STATE_UNFOUND; }
83 /// \brief true if Entry not read
84 bool IsUnread() { return State == STATE_UNREAD; }
85 /// \brief true if Entry value properly loaded
86 bool IsGoodValue() { return State == 0; }
89 /// \brief sets the 'pixel data flag'
90 void SetFlag(const char &flag) { Flag = flag; }
91 /// \brief returns the 'pixel data flag'
92 const char &GetFlag() const { return Flag; }
93 /// \brief true id Entry is a Pixel Data entry
94 bool IsPixelData() { return (Flag & FLAG_PIXELDATA) != 0; }
96 void Copy(DocEntry *doc);
98 /// \brief returns the size threshold above which an element value
99 /// will NOT be *printed* in order no to polute the screen output
100 static const uint32_t &GetMaxSizePrintEntry() { return MaxSizePrintEntry; }
101 /// \brief Header Elements too long will not be printed
102 static void SetMaxSizePrintEntry(const uint32_t &size) { MaxSizePrintEntry = size; }
104 ///\brief values for current state of a DataEntry (internal use only)
108 STATE_NOTLOADED = 0x01,
109 STATE_UNFOUND = 0x02,
113 ///\brief values for current pixel status of a DataEntry (internal use only)
117 FLAG_PIXELDATA = 0x01
122 void NewBinArea(void);
123 void DeleteBinArea(void);
126 /// \brief memory area to hold 'non std::string' representable values
127 /// (ie : Lookup Tables, overlays, icons)
129 /// \brief Whether DataEntry has its own BinArea or not
131 /// \brief std::string representable value of the Entry.
132 /// Parts of a multivaluated data are separated by back-slash
133 mutable std::string StrArea;
136 /// \brief 0 for straight entries, FLAG_PIXELDATA for Pixel Data entries
138 /// \brief Entry status : STATE_NOTLOADED,STATE_UNFOUND, STATE_UNREAD, 0
141 /// \brief Size threshold above which an element val
142 /// By default, this upper bound is fixed to 64 bytes.
143 static uint32_t MaxSizePrintEntry;
146 } // end namespace gdcm
148 //-----------------------------------------------------------------------------