gdcmDocEntry.h

Go to the documentation of this file.
00001 /*=========================================================================
00002                                                                                 
00003   Program:   gdcm
00004   Module:    $RCSfile: gdcmDocEntry.h,v $
00005   Language:  C++
00006   Date:      $Date: 2007/08/22 16:14:04 $
00007   Version:   $Revision: 1.69 $
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 _GDCMDOCENTRY_H_
00020 #define _GDCMDOCENTRY_H_
00021 
00022 #include "gdcmRefCounter.h"
00023 #include "gdcmDictEntry.h"
00024 
00025 #include <iostream>
00026 #include <fstream>
00027 
00028 namespace GDCM_NAME_SPACE 
00029 {
00030 class File;
00031 class SeqEntry;
00032 
00033 //-----------------------------------------------------------------------------
00038 class GDCM_EXPORT DocEntry : public RefCounter
00039 {
00040    gdcmTypeMacro(DocEntry);
00041 
00042 public:
00043    virtual void Print (std::ostream &os = std::cout, std::string const &indent = ""); 
00044    virtual void WriteContent(std::ofstream *fp, FileType filetype, 
00045                              bool insideMetaElements);
00046 
00049    DictEntry * GetDictEntry() { return DicomDict; } 
00050 
00052    uint16_t const &GetGroup() const   { return Key[0];  }
00053    //const uint16_t &GetGroup() const   { return DicomDict->GetGroup();  }
00054 
00056    uint16_t const &GetElement() const { return Key[1];}   
00057    //const uint16_t &GetElement() const { return DicomDict->GetElement();}
00058 
00060    TagKey const &GetKey() const { return Key; }   
00061    //TagKey GetKey() const { return DicomDict->GetKey(); }
00062 
00065    std::string const &GetName();
00066 
00070    VRKey const &GetVR() const { return VR; }   
00071    //VRKey const &GetVR() const { return DicomDict->GetVR(); }
00072 
00076    std::string const &GetVM();
00077 
00079    //void SetVM( TagName const &v) { DicomDict->SetVM(v); } 
00080    void SetVM( TagName &) { std::cout << "-----------------FIXME : SetVM "; }
00081     
00085    const size_t &GetOffset() const { return Offset; }
00086 
00089    void SetReadLength(uint32_t l) { ReadLength = l; }
00094    const uint32_t &GetReadLength() const { return ReadLength; }
00095 
00098    virtual void SetLength(uint32_t l) { Length = l; }
00102    const uint32_t &GetLength() const { return Length; }
00103 
00104    uint32_t GetFullLength();
00105    virtual uint32_t ComputeFullLength() = 0;
00106 
00107 // The following members, for internal use only !
00108 
00112    void SetOffset(size_t of) { Offset = of; }
00113 
00115    void SetImplicitVR() { ImplicitVR = true; }
00116  
00119    void SetVR( VRKey const &vr) { VR = vr; } 
00120 
00123    void SetTag( TagKey const &key) { Key = key; } 
00124   
00125 // -----------end of members to be used with caution
00126    
00129    bool IsImplicitVR() const { return ImplicitVR; }
00130 
00133 //   bool IsVRUnknown() const { return DicomDict->IsVRUnknown(); }
00134      bool IsVRUnknown() const { return VR == GDCM_VRUNKNOWN; }
00135 
00138 //   bool IsVMUnknown() const { return DicomDict->IsVMUnknown(); }
00139    bool IsVMUnknown() { return GetVM() == GDCM_UNKNOWN; }
00140 
00143    bool IsItemDelimitor() 
00144                       {return (GetGroup() == 0xfffe && GetElement() == 0xe00d);}
00147    bool IsItemStarter(){ if (GetGroup() != 0xfffe) return false;
00148                          return (GetElement() == 0xe000); }
00151    bool IsSequenceDelimitor() { return (GetGroup() == 0xfffe && GetElement() == 0xe0dd);}  
00152 
00153    virtual void Copy(DocEntry *doc);
00154 
00155 protected:
00156   // DocEntry(DictEntry*);
00157    DocEntry(uint16_t group, uint16_t elem, VRKey const &vr);
00158    virtual ~DocEntry();
00159 
00161    DictEntry *DicomDict;
00162       
00165    uint32_t Length; 
00166   
00168    uint32_t ReadLength;
00169 
00173    bool ImplicitVR;
00174 
00176    size_t Offset; 
00177 
00179    VRKey VR; // JPRx
00180       
00183    TagKey Key; // JPRx
00184 private:
00185 
00186 };
00187 } // end namespace gdcm
00188 //-----------------------------------------------------------------------------
00189 #endif

Generated on Fri Aug 24 12:53:14 2007 for gdcm by  doxygen 1.4.6