]> Creatis software - gdcm.git/blobdiff - src/gdcmHeader.h
Clean up with JPR. Frog
[gdcm.git] / src / gdcmHeader.h
index f46a12c64961f49b7575ebffdc394e4acac864e6..b082bd8336f0a3a3a4368e0930a58515cbe8eceb 100644 (file)
@@ -14,10 +14,10 @@ typedef string VRKey;
 typedef string VRAtr;
 typedef map<VRKey, VRAtr> VRHT;    // Value Representation Hash Table
 
-/// \brief The purpous of an instance of gdcmHeader is to act as a container of
-///        all the DICOM elements and their corresponding values (and
-///        additionaly the corresponding DICOM dictionary entry) of the header
-///        of a DICOM file.
+/// The purpose of an instance of gdcmHeader is to act as a container of
+/// all the DICOM elements and their corresponding values (and
+/// additionaly the corresponding DICOM dictionary entry) of the header
+/// of a DICOM file.
 ///
 /// The typical usage of instances of class gdcmHeader is to classify a set of
 /// dicom files according to header information e.g. to create a file hierarchy
@@ -42,16 +42,16 @@ private:
    gdcmDictSet* Dicts;
    /// Public dictionary used to parse this header
    gdcmDict* RefPubDict;
-   /// Optional "shadow dictionary" (private elements) used to parse this header
+   /// Optional "shadow dictionary" (private elements) used to parse this
+   /// header
    gdcmDict* RefShaDict;
 
    /// ELement VALueS parsed with the PUBlic dictionary.
-   ElValSet PubElVals;
+   gdcmElValSet PubElValSet;
    /// ELement VALueS parsed with the SHAdow dictionary.
-   ElValSet ShaElVals;
+   gdcmElValSet ShaElValSet;
    /// Refering underlying filename.
    string filename; 
-   FILE * fp;
    
    // FIXME sw should be an enum e.g.
    //enum EndianType {
@@ -78,24 +78,36 @@ private:
    void CheckSwap(void);
    void InitVRDict(void);
    void SwitchSwapToBigEndian(void);
-   void AddAndDefaultElements(void);
+   // CLEAN ME: NewManualElValToPubDict is NOT called any more.
+   gdcmElValue*  NewManualElValToPubDict(string NewTagName, string VR);
    void SetMaxSizeLoadElementValue(long);
 
-   gdcmDictEntry * GetDictEntryByKey(guint16, guint16);
+   gdcmDictEntry * GetDictEntryByNumber(guint16, guint16);
    gdcmDictEntry * GetDictEntryByName(string name);
 
    // ElValue related utilities
-   ElValue * ReadNextElement(void);
-   ElValue * NewElValueByKey(guint16 group, guint16 element);
-   ElValue * NewElValueByName(string name);
-   void FindLength(ElValue *);
-   void FindVR(ElValue *);
-   void LoadElementValue(ElValue *);
-   void LoadElementValueSafe(ElValue *);
-   void SkipElementValue(ElValue *);
-   void FixFoundLength(ElValue*, guint32);
-   bool IsAnInteger(ElValue *);
+   gdcmElValue * ReadNextElement(void);
+   gdcmElValue * NewElValueByNumber(guint16 group, guint16 element);
+   gdcmElValue * NewElValueByName(string name);
+   void FindLength(gdcmElValue *);
+   void FindVR(gdcmElValue *);
+   void LoadElementValue(gdcmElValue *);
+   void LoadElementValueSafe(gdcmElValue *);
+   void SkipElementValue(gdcmElValue *);
+   void FixFoundLength(gdcmElValue*, guint32);
+   bool IsAnInteger(gdcmElValue *);
+   void LoadElements(void);
    
+protected:
+   FILE * fp;
+   FileType filetype;
+   bool OpenFile(bool exception_on_error = false)
+     throw(gdcmFileError);
+   bool CloseFile(void);
+   int write(ostream&);   
+   int anonymize(ostream&);  // FIXME : anonymize should be a friend ?
+public:
+   bool IsReadable(void);
    bool IsImplicitVRLittleEndianTransferSyntax(void);
    bool IsExplicitVRLittleEndianTransferSyntax(void);
    bool IsDeflatedExplicitVRLittleEndianTransferSyntax(void);
@@ -104,29 +116,15 @@ private:
    bool IsJPEGExtendedProcess2_4TransferSyntax(void); 
    bool IsJPEGExtendedProcess3_5TransferSyntax(void);
    bool IsJPEGSpectralSelectionProcess6_8TransferSyntax(void); 
+   bool IsJPEGLossless(void); 
+   bool IsDicomV3(void); 
       
-protected:
-   // FIXME: is this enum still necessary ??
-   enum FileType {
-      Unknown = 0,
-      TrueDicom,
-      ExplicitVR,
-      ImplicitVR,
-      ACR,
-      ACR_LIBIDO};  // CLEANME
-   FileType filetype;
-   int write(ostream&);   
-   int anonymize(ostream&);  // FIXME : anonymize should be a friend ?
-public:
-   void LoadElements(void);
    virtual void ParseHeader(bool exception_on_error = false)
      throw(gdcmFormatError);
-   gdcmHeader(const char *filename, bool exception_on_error = false)
-     throw(gdcmFileError);
+   gdcmHeader(const char *filename, bool exception_on_error = false);
    virtual ~gdcmHeader();
    
    size_t GetPixelOffset(void);
-   void   GetPixels(size_t, void *);
    int    GetSwapCode(void) { return sw; }
 
    // TODO Swig int SetPubDict(string filename);
@@ -139,9 +137,9 @@ public:
    string GetPubElValRepByName(string TagName);
    string GetPubElValRepByNumber(guint16 group, guint16 element);
 
-   TagElValueHT & GetPubElVal(void) { return PubElVals.GetTagHt(); };
+   TagElValueHT & GetPubElVal(void) { return PubElValSet.GetTagHt(); };
    void   PrintPubElVal(ostream & os = cout);
-   void   PrintPubDict(ostream & os = cout);
+   void   PrintPubDict (ostream & os = cout);
      
    // TODO Swig string* GetShaTagNames(); 
    string GetShaElValByName(string TagName);
@@ -158,8 +156,15 @@ public:
    int SetPubElValByNumber(string content, guint16 group, guint16 element);
    int SetShaElValByName(string content, string ShadowTagName);
    int SetShaElValByNumber(string content, guint16 group, guint16 element);
-
-   ElValSet GetPubElVals() { return(PubElVals); }
+   
+   int SetPubElValLengthByNumber(guint32 lgr, guint16 group, guint16 element);                                   
+   int ReplaceOrCreateByNumber(string Value, guint16 Group, guint16 Elem);                                
+   int GetXSize(void);  
+   int GetYSize(void);
+   int GetZSize(void);       
+   string GetPixelType(void);  
+   int Write(FILE *, FileType);
+   
 };
 
 #endif