Main Page | File List | Related Pages

gdcmHeader.h

00001 // gdcmHeader.h
00002 //-----------------------------------------------------------------------------
00003 #ifndef GDCMHEADER_H
00004 #define GDCMHEADER_H
00005 
00006 #include "gdcmCommon.h"
00007 #include "gdcmParser.h"
00008 
00009 //-----------------------------------------------------------------------------
00010 /*
00011  * \defgroup gdcmHeader
00012  * \brief
00013  * The purpose of an instance of gdcmHeader is to act as a container of
00014  * all the DICOM elements and their corresponding values (and
00015  * additionaly the corresponding DICOM dictionary entry) of the header
00016  * of a DICOM file.
00017  *
00018  * The typical usage of instances of class gdcmHeader is to classify a set of
00019  * dicom files according to header information e.g. to create a file hierarchy
00020  * reflecting the Patient/Study/Serie informations, or extracting a given
00021  * SerieId. Accessing the content (image[s] or volume[s]) is beyond the
00022  * functionality of this class and belongs to gdmcFile.
00023  * \note  The various entries of the explicit value representation (VR) shall
00024  *        be managed within a dictionary which is shared by all gdcmHeader
00025  *        instances.
00026  * \note  The gdcmHeader::Set*Tag* family members cannot be defined as
00027  *        protected due to Swig limitations for as Has_a dependency between
00028  *        gdcmFile and gdcmHeader.
00029  */
00030 class GDCM_EXPORT gdcmHeader : public gdcmParser
00031 {
00032 public:
00033    gdcmHeader(bool exception_on_error = false);
00034    gdcmHeader(const char *filename, 
00035               bool  exception_on_error = false, 
00036               bool  enable_sequences   = false,
00037               bool  skip_shadow        = false);
00038               
00039    virtual ~gdcmHeader();
00040 
00041 // Standard values and informations contained in the header
00042    virtual bool IsReadable(void);
00043    bool IsJPEGBaseLineProcess1TransferSyntax(void);
00044    bool IsJPEGExtendedProcess2_4TransferSyntax(void); 
00045    bool IsJPEGExtendedProcess3_5TransferSyntax(void);
00046    bool IsJPEGSpectralSelectionProcess6_8TransferSyntax(void); 
00047    bool IsRLELossLessTransferSyntax(void); 
00048    bool IsJPEGLossless(void); 
00049    bool IsJPEG2000(void); 
00050    bool IsDicomV3(void); 
00051 
00052    // Some heuristic based accessors, end user intended 
00053    // (to be move to gdcmHeaderHelper?) 
00054    int GetXSize(void);
00055    int GetYSize(void);
00056    int GetZSize(void);
00057    int GetBitsStored(void);
00058    int GetBitsAllocated(void);
00059    int GetSamplesPerPixel(void);   
00060    int GetPlanarConfiguration(void);
00061 
00062    int GetPixelSize(void);   
00063    std::string GetPixelType(void);  
00064    size_t GetPixelOffset(void);
00065    size_t GetPixelAreaLength(void);
00066 
00067    bool   HasLUT(void);
00068    int    GetLUTNbits(void);
00069    unsigned char * GetLUTRGBA(void);
00070 
00071    std::string GetTransfertSyntaxName(void);
00072 
00073    // When some proprietary shadow groups are disclosed, we can set up
00074    // an additional specific dictionary to access extra information.
00075    
00076    // OK : we still have *ONE* HeaderEntrySet, 
00077    // with both Public and Shadow Elements
00078    // parsed against THE Public Dictionary and A (single) Shadow Dictionary
00079    
00080    // TODO Swig int SetShaDict(std::string filename);
00081    // TODO Swig int SetPubDict(std::string filename);
00082 
00083 // Entry
00084 
00085    inline virtual std::string GetEntryByNumber  (guint16 group, guint16 element)
00086       { return(gdcmParser::GetEntryByNumber(group,element)); }
00087    inline virtual std::string GetEntryVRByNumber(guint16 group, guint16 element)
00088       { return(gdcmParser::GetEntryVRByNumber(group,element)); }
00089       
00090    inline virtual std::string GetEntryByName    (std::string tagName) 
00091       { return(gdcmParser::GetEntryByName(tagName)); }
00092    inline virtual std::string GetEntryVRByName  (std::string tagName)
00093       { return(gdcmParser::GetEntryVRByName(tagName)); }
00094       
00095    inline virtual bool SetEntryByNumber(std::string content,guint16 group, guint16 element)
00096       { return(gdcmParser::SetEntryByNumber(content,group,element)); }
00097    inline virtual bool SetEntryByName(std::string content,std::string tagName)
00098       { return(gdcmParser::SetEntryByName(content,tagName)); }
00099 
00100   inline virtual bool SetEntryLengthByNumber(guint32 l,guint16 group, guint16 element)
00101       { return(gdcmParser::SetEntryLengthByNumber(l,group,element)); }
00102 
00103    inline virtual void UpdateShaEntries(void)
00104       { gdcmParser::UpdateShaEntries(); }
00105 
00106 // Read (used in gdcmFile)
00107    void SetImageDataSize(size_t ExpectedSize);
00108 
00109    bool operator<(gdcmHeader &header);
00110 
00111 protected:
00112    int write(std::ostream&);   
00113    int anonymize(std::ostream&);  // FIXME : anonymize should be a friend ?
00114    bool anonymizeHeader(void);
00115 private:
00116 
00117 };
00118 
00119 //-----------------------------------------------------------------------------
00120 #endif

Generated on Mon Feb 14 16:13:44 2005 for gdcm by doxygen 1.3.6