Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

gdcmDataEntry.h

Go to the documentation of this file.
00001 /*=========================================================================
00002                                                                                 
00003   Program:   gdcm
00004   Module:    $RCSfile: gdcmDataEntry.h,v $
00005   Language:  C++
00006   Date:      $Date: 2005/11/29 12:48:45 $
00007   Version:   $Revision: 1.11 $
00008                                                                                 
00009   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
00010   l'Image). All rights reserved. See Doc/License.txt or
00011   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
00012                                                                                 
00013      This software is distributed WITHOUT ANY WARRANTY; without even
00014      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00015      PURPOSE.  See the above copyright notices for more information.
00016                                                                                 
00017 =========================================================================*/
00018 
00019 #ifndef GDCMDATAENTRY_H
00020 #define GDCMDATAENTRY_H
00021 
00022 #include "gdcmDocEntry.h"
00023 
00024 #include <iostream>
00025 
00026 namespace gdcm 
00027 {
00028 //-----------------------------------------------------------------------------
00036 class GDCM_EXPORT DataEntry  : public DocEntry
00037 {
00038    gdcmTypeMacro(DataEntry);
00039 
00040 public:
00042    static DataEntry *New(DictEntry *e) {return new DataEntry(e);}
00044    static DataEntry *New(DocEntry *d)  {return new DataEntry(d);}
00045 
00046 // Print
00047    void Print(std::ostream &os = std::cout, std::string const &indent = "");
00048 
00049 // Write
00050    virtual void WriteContent(std::ofstream *fp, FileType filetype);
00051    uint32_t ComputeFullLength();
00052    
00053 // Set/Get data
00054    // Sets the value (string) of the current Dicom entry
00055    //virtual void SetValue(std::string const &val);
00056 
00059    uint8_t *GetBinArea()  { return BinArea; }
00060    void SetBinArea( uint8_t *area, bool self = true );
00061    void CopyBinArea( uint8_t *area, uint32_t length );
00062 
00063    void SetValue(const uint32_t &id,const double &val);
00064    double GetValue(const uint32_t &id) const;
00065    uint32_t GetValueCount(void) const;
00066    bool IsValueCountValid() const;
00067 
00068    void SetString(std::string const &value);
00069    std::string const &GetString() const;
00070 
00072    void SetSelfArea(bool area) { SelfArea = area; }
00074    bool IsSelfArea() { return SelfArea; }
00075 
00077    enum TValueState
00078    {
00079       STATE_LOADED    = 0x00,
00080       STATE_NOTLOADED = 0x01,
00081       STATE_UNFOUND   = 0x02,
00082       STATE_UNREAD    = 0x03
00083    };
00084    
00086    enum TValueFlag
00087    {
00088       FLAG_NONE       = 0x00,
00089       FLAG_PIXELDATA  = 0x01
00090    };
00091 
00092    // State
00094    void SetState(const TValueState &state) { State = state; }
00096       const TValueState &GetState() const { return State; }
00098    bool IsNotLoaded() { return State == STATE_NOTLOADED; }
00100    bool IsUnfound()   { return State == STATE_UNFOUND; }
00102    bool IsUnread()    { return State == STATE_UNREAD; }
00104    bool IsGoodValue() { return State == STATE_LOADED; }
00105 
00106    // Flags
00108    void SetFlag(const TValueFlag &flag) { Flag = flag; }
00110    const TValueFlag &GetFlag() const { return Flag; }
00112    bool IsPixelData() { return (Flag &FLAG_PIXELDATA) != 0; }
00113 
00114    virtual void Copy(DocEntry *doc);
00115 
00118    static const uint32_t &GetMaxSizePrintEntry() { return MaxSizePrintEntry; }
00120    static void SetMaxSizePrintEntry(const uint32_t &size) 
00121                                                  { MaxSizePrintEntry = size; }
00122 
00123 protected:
00124    DataEntry(DictEntry *e);
00125    DataEntry(DocEntry *d); 
00126    ~DataEntry();
00127 
00128 // Methods :
00129    void NewBinArea(void);
00130    void DeleteBinArea(void);
00131 
00132 // Members :
00135    uint8_t *BinArea;
00137    bool SelfArea;
00140    mutable std::string StrArea;
00141 
00142 private:
00144    TValueFlag Flag;
00146    TValueState State;
00147 
00149    static uint32_t MaxSizePrintEntry;   
00150 };
00151 
00152 } // end namespace gdcm
00153 
00154 //-----------------------------------------------------------------------------
00155 #endif
00156 

Generated on Fri Jan 20 10:14:24 2006 for gdcm by  doxygen 1.4.4