- guint16 ReadInt16(void);
- guint32 ReadInt32(void);
- guint16 SwapShort(guint16);
- guint32 SwapLong(guint32);
- void Initialise(void);
- void CheckSwap(void);
- void FindLength(ElValue *);
- void FindVR(ElValue *);
- void LoadElementValue(ElValue *);
- void LoadElementValueSafe(ElValue *);
- void SkipElementValue(ElValue *);
- void InitVRDict(void);
- void SwitchSwapToBigEndian(void);
- void FixFoundLength(ElValue*, guint32);
- bool IsAnInteger(ElValue *);
- bool IsBigEndianTransferSyntax(void);
- void SetMaxSizeLoadElementValue(long);
- ElValue * ReadNextElement(void);
- gdcmDictEntry * IsInDicts(guint32, guint32);
- size_t GetPixelOffset(void);
-protected:
- enum FileType {
- Unknown = 0,
- TrueDicom,
- ExplicitVR,
- ImplicitVR,
- ACR,
- ACR_LIBIDO};
- FileType filetype;
-///// QUESTION: Maybe Print is a better name than write !?
- int write(ostream&);
-///// QUESTION: Maybe anonymize should be a friend function !?!?
-///// See below for an example of how anonymize might be implemented.
- int anonymize(ostream&);
-public:
- void LoadElements(void);
- virtual void ParseHeader(void);
- gdcmHeader(const char* filename);
- virtual ~gdcmHeader();
-
- // TODO Swig int SetPubDict(string filename);
- // When some proprietary shadow groups are disclosed, whe can set
- // up an additional specific dictionary to access extra information.
- // TODO Swig int SetShaDict(string filename);
-
- // Retrieve all potentially available tag [tag = (group, element)] names
- // from the standard (or public) dictionary (hence static). Typical usage:
- // enable the user of a GUI based interface to select his favorite fields
- // for sorting or selection.
- // TODO Swig string* GetPubTagNames();
- // Get the element values themselves:
- string GetPubElValByName(string TagName);
- string GetPubElValByNumber(guint16 group, guint16 element);
- // Get the element value representation: (VR) might be needed by caller
- // to convert the string typed content to caller's native type (think
- // of C/C++ vs Python).
- // TODO Swig string GetPubElValRepByName(string TagName);
- // TODO Swig string GetPubElValRepByNumber(guint16 group, guint16 element);
- TagElValueHT & GetPubElVal(void) { return PubElVals.GetTagHt(); };
- void PrintPubElVal(ostream & os = cout);
- void PrintPubDict(ostream &);
-
- // Same thing with the shadow :
- // TODO Swig string* GetShaTagNames();
- // TODO Swig string GetShaElValByName(string TagName);
- // TODO Swig string GetShaElValByNumber(guint16 group, guint16 element);
- // TODO Swig string GetShaElValRepByName(string TagName);
- // TODO Swig string GetShaElValRepByNumber(guint16 group, guint16 element);
-
- // Wrappers of the above (both public and shadow) to avoid bugging the
- // caller with knowing if ElVal is from the public or shadow dictionary.
- // TODO Swig string GetElValByName(string TagName);
- // TODO Swig string GetElValByNumber(guint16 group, guint16 element);
- // TODO Swig string GetElValRepByName(string TagName);
- // TODO Swig string GetElValRepByNumber(guint16 group, guint16 element);
-
- // TODO Swig int SetPubElValByName(string content, string TagName);
- // TODO Swig int SetPubElValByNumber(string content, guint16 group, guint16 element);
- // TODO Swig int SetShaElValByName(string content, string ShadowTagName);
- // TODO Swig int SetShaElValByNumber(string content, guint16 group, guint16 element);
-
- // TODO Swig int GetSwapCode();
-};
-
-// In addition to Dicom header exploration, this class is designed
-// for accessing the image/volume content. One can also use it to
-// write Dicom files.
-////// QUESTION: this looks still like an open question wether the
-////// relationship between a gdcmFile and gdcmHeader is of
-////// type IS_A or HAS_A !
-class GDCM_EXPORT gdcmFile: gdcmHeader
-{
-private:
- void* Data;
- int Parsed; // weather allready parsed
- string OrigFileName; // To avoid file overwrite
-public:
- // Constructor dedicated to writing a new DICOMV3 part10 compliant
- // file (see SetFileName, SetDcmTag and Write)
- // TODO Swig gdcmFile();
- // Opens (in read only and when possible) an existing file and checks
- // for DICOM compliance. Returns NULL on failure.
- // Note: the in-memory representation of all available tags found in
- // the DICOM header is post-poned to first header information access.
- // This avoid a double parsing of public part of the header when
- // one sets an a posteriori shadow dictionary (efficiency can be
- // seen a a side effect).
- gdcmFile(string & filename);
- // For promotion (performs a deepcopy of pointed header object)
- // TODO Swig gdcmFile(gdcmHeader* header);
- // TODO Swig ~gdcmFile();
-
- // On writing purposes. When instance was created through
- // gdcmFile(string filename) then the filename argument MUST be different
- // from the constructor's one (no overwriting aloud).
- // TODO Swig int SetFileName(string filename);
-
- // Allocates necessary memory, copies the data (image[s]/volume[s]) to
- // newly allocated zone and return a pointer to it:
- // TODO Swig void * GetImageData();
- // Returns size (in bytes) of required memory to contain data
- // represented in this file.
- // TODO Swig size_t GetImageDataSize();
- // Copies (at most MaxSize bytes) of data to caller's memory space.
- // Returns an error code on failure (if MaxSize is not big enough)
- // TODO Swig int PutImageDataHere(void* destination, size_t MaxSize );
- // Allocates ExpectedSize bytes of memory at this->Data and copies the
- // pointed data to it.
- // TODO Swig int SetImageData(void * Data, size_t ExpectedSize);
- // Push to disk.
- // TODO Swig int Write();
-};
-
-//class gdcmSerie : gdcmFile;
-//class gdcmMultiFrame : gdcmFile;
-
-//
-//Examples:
-// * gdcmFile WriteDicom;
-// WriteDicom.SetFileName("MyDicomFile.dcm");
-// string * AllTags = gdcmHeader.GetDcmTagNames();
-// WriteDicom.SetDcmTag(AllTags[5], "253");
-// WriteDicom.SetDcmTag("Patient Name", "bozo");
-// WriteDicom.SetDcmTag("Patient Name", "bozo");
-// WriteDicom.SetImageData(Image);
-// WriteDicom.Write();
-//
-//
-// Anonymize(ostream& output) {
-// a = gdcmFile("toto1");
-// a.SetPubValueByName("Patient Name", "");
-// a.SetPubValueByName("Date", "");
-// a.SetPubValueByName("Study Date", "");
-// a.write(output);
-// }