X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmHeader.h;h=3ccf8cf47efde914ce5a3ad82fe89bd68f0e0d5a;hb=66553b88cd6daaac48ac62a910199cb2fff276f6;hp=a7d2241f24910756636b3add714a71f59833a615;hpb=a92be72817889f80324ce6f29ad69c0412d31024;p=gdcm.git diff --git a/src/gdcmHeader.h b/src/gdcmHeader.h index a7d2241f..3ccf8cf4 100644 --- a/src/gdcmHeader.h +++ b/src/gdcmHeader.h @@ -1,10 +1,11 @@ -// gdcmHeader.h +// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.h,v 1.22 2003/05/06 15:52:13 jpr Exp $ #ifndef GDCMHEADER_H #define GDCMHEADER_H #include #include "gdcmCommon.h" +#include "gdcmUtil.h" #include "gdcmException.h" #include "gdcmDictSet.h" #include "gdcmElValue.h" @@ -36,10 +37,9 @@ class GDCM_EXPORT gdcmHeader { private: /// Pointer to the Value Representation Hash Table which contains all /// the VR of the DICOM version3 public dictionary. - static VRHT *dicom_vr; - - /// Global dictionary container - gdcmDictSet* Dicts; + gdcmVR *dicom_vr; // Not a class member for thread-safety reasons + /// Pointer to global dictionary container + gdcmDictSet* Dicts; // Not a class member for thread-safety reasons /// Public dictionary used to parse this header gdcmDict* RefPubDict; /// Optional "shadow dictionary" (private elements) used to parse this @@ -47,12 +47,11 @@ private: gdcmDict* RefShaDict; /// ELement VALueS parsed with the PUBlic dictionary. - gdcmElValSet PubElVals; + gdcmElValSet PubElValSet; /// ELement VALueS parsed with the SHAdow dictionary. - gdcmElValSet ShaElVals; + gdcmElValSet ShaElValSet; /// Refering underlying filename. string filename; - FILE * fp; // FIXME sw should be an enum e.g. //enum EndianType { @@ -72,24 +71,22 @@ private: guint16 ReadInt16(void); guint32 ReadInt32(void); - guint16 SwapShort(guint16); - guint32 SwapLong(guint32); guint32 FindLengthOB(void); void Initialise(void); void CheckSwap(void); - void InitVRDict(void); void SwitchSwapToBigEndian(void); + // CLEAN ME: NewManualElValToPubDict is NOT called any more. gdcmElValue* NewManualElValToPubDict(string NewTagName, string VR); - void AddAndDefaultElements(void); void SetMaxSizeLoadElementValue(long); - gdcmDictEntry * GetDictEntryByKey(guint16, guint16); + gdcmDictEntry * GetDictEntryByNumber(guint16, guint16); gdcmDictEntry * GetDictEntryByName(string name); // ElValue related utilities gdcmElValue * ReadNextElement(void); - gdcmElValue * NewElValueByKey(guint16 group, guint16 element); + gdcmElValue * NewElValueByNumber(guint16 group, guint16 element); gdcmElValue * NewElValueByName(string name); + void FindLength(gdcmElValue *); void FindVR(gdcmElValue *); void LoadElementValue(gdcmElValue *); @@ -99,6 +96,21 @@ private: bool IsAnInteger(gdcmElValue *); void LoadElements(void); +protected: + FILE * fp; + FileType filetype; + + gdcmElValue * GetElValueByNumber(guint16 group, guint16 element); + + guint16 SwapShort(guint16); // needed by gdcmFile + guint32 SwapLong(guint32); // for JPEG Files :-( + 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); @@ -107,31 +119,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: - bool IsReadable(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); @@ -144,9 +140,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); @@ -164,9 +160,14 @@ public: int SetShaElValByName(string content, string ShadowTagName); int SetShaElValByNumber(string content, guint16 group, guint16 element); - int SetPubElValLengthByNumber(guint32 lgr, guint16 group, guint16 element); - - gdcmElValSet 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