From fae5f95ae8cf044c024b1793b94032c9368f0f4b Mon Sep 17 00:00:00 2001 From: regrain Date: Wed, 4 Feb 2004 11:25:06 +0000 Subject: [PATCH] * FIX : Set the elements to create the DicomDir in a dictionary file -- BeNours --- Dicts/DicomDir.dic | 80 +++++++++++ gdcmPython/gdcm.i | 7 +- gdcmPython/win32/_vtkGdcm.dsp | 4 + gdcmPython/win32/gdcmpyembedded.dsp | 4 + src/Makefile.am | 4 +- src/gdcmDicomDir.cxx | 206 ++-------------------------- src/gdcmDicomDir.h | 1 + src/gdcmDicomDirElement.cxx | 136 ++++++++++++++++++ src/gdcmDicomDirElement.h | 53 +++++++ src/gdcmHeaderEntry.cxx | 1 + src/gdcmParser.cxx | 2 +- src/gdcmUtil.cxx | 17 ++- src/gdcmUtil.h | 7 +- src/win32/gdcmdll.dsp | 12 +- vtk/win32/vtkgdcm.dsp | 4 + 15 files changed, 330 insertions(+), 208 deletions(-) create mode 100644 Dicts/DicomDir.dic create mode 100644 src/gdcmDicomDirElement.cxx create mode 100644 src/gdcmDicomDirElement.h diff --git a/Dicts/DicomDir.dic b/Dicts/DicomDir.dic new file mode 100644 index 00000000..7edfc978 --- /dev/null +++ b/Dicts/DicomDir.dic @@ -0,0 +1,80 @@ +metaElem 0x0002 0x0000 "12345" // Meta Group Length : to be computed later +metaElem 0x0002 0x0001 "\2\0\0\0" // File Meta Information Version +metaElem 0x0002 0x0002 "1.2.840.10008.1.3.10" // Media Stored SOP Class UID i.e. : 'Media Storage Directory Storage' +metaElem 0x0002 0x0003 "" // Media Stored SOP Instance UID : may be forged later +metaElem 0x0002 0x0010 "1.2.840.10008.1.2.1" // Transfer Syntax UID i.e. : Explicit VR - Little Endian +metaElem 0x0002 0x0012 "" // Implementation Class UID : may be forged later +metaElem 0x0002 0x0013 "gdcmLib" // Implementation Version Name +metaElem 0x0004 0x1130 "" // File-set ID +metaElem 0x0004 0x1200 "0" // Offset of the first dir of root dir entity : to be computed later +metaElem 0x0004 0x1202 "0" // Offset of the last dir of root dir entity : to be computed later +metaElem 0x0004 0x1212 "0" // File-set consistency flag +metaElem 0x0004 0x1220 "0" // Directory record sequence : *length* to be set later + +patientElem 0xfffe 0xe000 "0" +patientElem 0x0004 0x1400 "0" // Offset of next directory record : to be computed later +patientElem 0x0004 0x1410 "65535" // Record in use flag : 65535 ? +patientElem 0x0004 0x1420 "0" // Offset of referenced lower-level dir entity : to be computed later +patientElem 0x0004 0x1430 "PATIENT " // Directory Record Type don't remove trailing space ! +patientElem 0x0008 0x0005 "ISO_IR 100" // Specific Character Set +patientElem 0x0010 0x0010 "" // Patient's Name +patientElem 0x0010 0x0020 "" // Patient ID +patientElem 0x0010 0x0030 "" // Patient's Birthdate +patientElem 0x0010 0x0040 "" // Patient's Sex + +studyElem 0xfffe 0xe000 "0" +studyElem 0x0004 0x1400 "0" // Offset of next directory record : to be computed later +studyElem 0x0004 0x1410 "65535" // Record in use flag : 65535 ? +studyElem 0x0004 0x1420 "0" // Offset of referenced lower-level dir entity : to be computed later +studyElem 0x0004 0x1430 "STUDY " // Directory Record Type don't remove trailing space ! +studyElem 0x0008 0x0005 "ISO_IR 100" // Specific Character Set +studyElem 0x0008 0x0020 "" // Study Date +studyElem 0x0008 0x0030 "" // Study Time +studyElem 0x0008 0x0050 "" // Accession Number +studyElem 0x0008 0x1030 "" // Study Description +studyElem 0x0020 0x000d "" // Study Instance UID : may be forged later +studyElem 0x0020 0x0010 "" // Study ID : may be forged later + +serieElem 0xfffe 0xe000 "0" +serieElem 0x0004 0x1400 "0" // Offset of next directory record : to be computed later +serieElem 0x0004 0x1410 "65535" // Record in use flag : 65535 ? +serieElem 0x0004 0x1420 "0" // Offset of referenced lower-level dir entity : to be computed later +serieElem 0x0004 0x1430 "SERIES" // Directory Record Type don't add trailing space ! +serieElem 0x0008 0x0005 "ISO_IR 100" // Specific Character Set +serieElem 0x0008 0x0021 "" // Series Date +serieElem 0x0008 0x0031 "" // Series Time +serieElem 0x0008 0x0060 "" // Modality +serieElem 0x0008 0x0080 "" // Institution Name : may be forged later +serieElem 0x0008 0x0081 "" // Institution Address : may be forged later +serieElem 0x0008 0x103e "" // Series Description : may be forged later +serieElem 0x0020 0x000e "" // Series Instance UID : may be forged later +serieElem 0x0020 0x0011 "0" // Series Number : may be forged later + +imageElem 0xfffe 0xe000 "0" +imageElem 0x0004 0x1400 "0" // Offset of next directory record : to be computed later +imageElem 0x0004 0x1410 "65535" // Record in use flag : 65535 ? +imageElem 0x0004 0x1420 "0" // Offset of referenced lower-level dir entity : to be computed later +imageElem 0x0004 0x1430 "IMAGE " // Directory Record Type don't remove trailing space ! +imageElem 0x0004 0x1500 "" // Referenced File ID : to be set later relative File Name +imageElem 0x0004 0x1510 "" // Referenced SOP Class UID in File : may be forged later +imageElem 0x0004 0x1511 "" // Referenced SOP Class UID in File : may be forged later +imageElem 0x0004 0x1512 "" // Referenced Transfer Syntax in File +imageElem 0x0008 0x0005 "ISO_IR 100" // Specific Character Set +imageElem 0x0008 0x0008 "" // Image Type +imageElem 0x0008 0x0016 "" // SOP Class UID : to be set/forged later +imageElem 0x0008 0x0018 "" // SOP Instance UID : to be set/forged later +imageElem 0x0008 0x0023 "" // Content Date +imageElem 0x0008 0x0033 "" // Content Time +imageElem 0x0008 0x1040 "" // Referenced Image Sequence : to be set/forged later +imageElem 0xfffe 0xe000 "0" +imageElem 0x0008 0x1150 "" // Referenced SOP Class UID : to be set/forged later +imageElem 0x0008 0x1155 "" // Referenced SOP Instance UID : to be set/forged later +imageElem 0x0020 0x0013 "0" // Image Number +imageElem 0x0020 0x0032 "0" // Image Position Patient +imageElem 0x0020 0x0037 "0" // Image Orientation Patient +imageElem 0x0020 0x0052 "0" // Frame of Reference UID +imageElem 0x0028 0x0010 "0" // Rows +imageElem 0x0028 0x0011 "0" // Columns +imageElem 0x0028 0x0030 "0" // Pixel Spacing +imageElem 0x0050 0x0004 "0" // Calibration Image + diff --git a/gdcmPython/gdcm.i b/gdcmPython/gdcm.i index 1a1bc44f..acdc9481 100644 --- a/gdcmPython/gdcm.i +++ b/gdcmPython/gdcm.i @@ -12,11 +12,12 @@ #include "gdcmUtil.h" #include "gdcmObject.h" #include "gdcmDicomDir.h" +#include "gdcmDicomDirElement.h" #include "gdcmPatient.h" #include "gdcmStudy.h" #include "gdcmSerie.h" #include "gdcmImage.h" - +#include "gdcmDirList.h" using namespace std; @@ -127,7 +128,9 @@ extern gdcmGlobal gdcmGlob; %include "gdcmUtil.h" %include "gdcmObject.h" %include "gdcmDicomDir.h" -%#include "gdcmPatient.h" +%include "gdcmDicomDirElement.h" +%include "gdcmPatient.h" %include "gdcmStudy.h" %include "gdcmSerie.h" %include "gdcmImage.h" +%include "gdcmDirList.h" diff --git a/gdcmPython/win32/_vtkGdcm.dsp b/gdcmPython/win32/_vtkGdcm.dsp index b09c016c..5b670333 100644 --- a/gdcmPython/win32/_vtkGdcm.dsp +++ b/gdcmPython/win32/_vtkGdcm.dsp @@ -62,6 +62,10 @@ SOURCE=..\..\src\gdcmDicomDir.cxx # End Source File # Begin Source File +SOURCE=..\..\src\gdcmDicomDirElement.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\gdcmDict.cxx # End Source File # Begin Source File diff --git a/gdcmPython/win32/gdcmpyembedded.dsp b/gdcmPython/win32/gdcmpyembedded.dsp index 51f6b8da..5895fb2c 100644 --- a/gdcmPython/win32/gdcmpyembedded.dsp +++ b/gdcmPython/win32/gdcmpyembedded.dsp @@ -84,6 +84,10 @@ SOURCE=..\..\src\gdcmDicomDir.cxx # End Source File # Begin Source File +SOURCE=..\..\src\gdcmDicomDirElement.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\gdcmDict.cxx # End Source File # Begin Source File diff --git a/src/Makefile.am b/src/Makefile.am index a43bce87..ce709d5d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -14,6 +14,7 @@ libgdcm_la_LIBADD = \ libgdcm_la_SOURCES= \ gdcmDicomDir.cxx \ + gdcmDicomDirElement.cxx \ gdcmDict.cxx \ gdcmDictEntry.cxx \ gdcmDictSet.cxx \ @@ -40,9 +41,10 @@ libgdcm_la_SOURCES= \ libgdcmincludedir = $(includedir) -libgdcminclude_HEADERS = \ +libgdcminclude_HEADERS = \ gdcmCommon.h \ gdcmDicomDir.h \ + gdcmDicomDirElement.h \ gdcmDictEntry.h \ gdcmDict.h \ gdcmDictSet.h \ diff --git a/src/gdcmDicomDir.cxx b/src/gdcmDicomDir.cxx index cd1ab61b..e9ea4d7e 100644 --- a/src/gdcmDicomDir.cxx +++ b/src/gdcmDicomDir.cxx @@ -12,188 +12,6 @@ #include #include -//----------------------------------------------------------------------------- -class ELEMENTS -{ -public : - ELEMENTS(unsigned short int _group,unsigned short int _elem,std::string _value) - {group=_group;elem=_elem;value=_value;} - - unsigned short int group; - unsigned short int elem; - std::string value; -}; - -ELEMENTS metaElem[]={ - //Meta Group Length : to be computed later - ELEMENTS(0x0002,0x0000,"12345"), - //File Meta Information Version - ELEMENTS(0x0002,0x0001,"\2\0\0\0"), - //Media Stored SOP Class UID i.e. : 'Media Storage Directory Storage' - ELEMENTS(0x0002,0x0002,"1.2.840.10008.1.3.10"), - //Media Stored SOP Instance UID : may be forged later - ELEMENTS(0x0002,0x0003,""), - //Transfer Syntax UID i.e. : Explicit VR - Little Endian - ELEMENTS(0x0002,0x0010,"1.2.840.10008.1.2.1"), - //Implementation Class UID : may be forged later - ELEMENTS(0x0002,0x0012,""), - //Implementation Version Name - ELEMENTS(0x0002,0x0013,"gdcmLib"), - //File-set ID : - ELEMENTS(0x0004,0x1130,""), - //Offset of the first dir of root dir entity : to be computed later - ELEMENTS(0x0004,0x1200,"0"), - //Offset of the last dir of root dir entity : to be computed later - ELEMENTS(0x0004,0x1202,"0"), - //File-set consistency flag - ELEMENTS(0x0004,0x1212,"0"), - //Directory record sequence : *length* to be set later - ELEMENTS(0x0004,0x1220,"0"), - ELEMENTS(0xffff,0xffff,"") -} ; - -ELEMENTS patientElem[]={ - ELEMENTS(0xfffe,0xe000,"0"), - // Offset of next directory record : to be computed later - ELEMENTS(0x0004,0x1400,"0"), - // Record in use flag : 65535(?) - ELEMENTS(0x0004,0x1410,"65535"), - // Offset of referenced lower-level dir entity : to be computed later - ELEMENTS(0x0004,0x1420,"0"), - // Directory Record Type - ELEMENTS(0x0004,0x1430,"PATIENT "), // don't remove trailing space ! - - // Specific Character Set - ELEMENTS(0x0008,0x0005,"ISO_IR 100"), - // Patient's Name - ELEMENTS(0x0010,0x0010,""), - // Patient ID - ELEMENTS(0x0010,0x0020,""), - // Patient's Birthdate - ELEMENTS(0x0010,0x0030,""), - // Patient's Sex - ELEMENTS(0x0010,0x0040,""), - ELEMENTS(0xffff,0xffff,"") - }; - -ELEMENTS studyElem[]={ - ELEMENTS(0xfffe,0xe000,"0"), - // Offset of next directory record : to be computed later - ELEMENTS(0x0004,0x1400,"0"), - // Record in use flag : 65535(?) - ELEMENTS(0x0004,0x1410,"65535"), - // Offset of referenced lower-level dir entity : to be computed later - ELEMENTS(0x0004,0x1420,"0"), - // Directory Record Type - ELEMENTS(0x0004,0x1430,"STUDY "), // don't remove trailing space ! - - // Specific Character Set - ELEMENTS(0x0008,0x0005,"ISO_IR 100"), - // Study Date - ELEMENTS(0x0008,0x0020,""), - // Study Time - ELEMENTS(0x0008,0x0030,""), - // Accession Number - ELEMENTS(0x0008,0x0050,""), - // Study Description - ELEMENTS(0x0008,0x1030,""), - // Study Instance UID : may be forged later - ELEMENTS(0x0020,0x000d,""), - // Study ID : may be forged later - ELEMENTS(0x0020,0x0010,""), - ELEMENTS(0xffff,0xffff,"") -}; - - -ELEMENTS serieElem[]={ - ELEMENTS(0xfffe,0xe000,"0"), - // Offset of next directory record : to be computed later - ELEMENTS(0x0004,0x1400,"0"), - // Record in use flag : 65535(?) - ELEMENTS(0x0004,0x1410,"65535"), - // Offset of referenced lower-level dir entity : to be computed later - ELEMENTS(0x0004,0x1420,"0"), - // Directory Record Type - ELEMENTS(0x0004,0x1430,"SERIES"), // don't add trailing space ! - - // Specific Character Set - ELEMENTS(0x0008,0x0005,"ISO_IR 100"), - // Series Date - ELEMENTS(0x0008,0x0021,""), - // Series Time - ELEMENTS(0x0008,0x0031,""), - // Modality - ELEMENTS(0x0008,0x0060,""), - // Institution Name : may be forged later - ELEMENTS(0x0008,0x0080,""), - // Institution Address : may be forged later - ELEMENTS(0x0008,0x0081,""), - // Series Description : may be forged later - ELEMENTS(0x0008,0x103e,""), - // Series Instance UID : may be forged later - ELEMENTS(0x0020,0x000e,""), - // Series Number : may be forged later - ELEMENTS(0x0020,0x0011,"0"), - ELEMENTS(0xffff,0xffff,"") -}; - -ELEMENTS imageElem[]={ - ELEMENTS(0xfffe,0xe000,"0"), - // Offset of next directory record : to be computed later - ELEMENTS(0x0004,0x1400,"0"), - // Record in use flag : 65535(?) - ELEMENTS(0x0004,0x1410,"65535"), - // Offset of referenced lower-level dir entity : to be computed later - ELEMENTS(0x0004,0x1420,"0"), - // Directory Record Type - ELEMENTS(0x0004,0x1430,"IMAGE "), // don't remove trailing space ! - - // Referenced File ID : to be set later(relative File Name) - ELEMENTS(0x0004,0x1500,""), - // Referenced SOP Class UID in File : may be forged later - ELEMENTS(0x0004,0x1510,""), - // Referenced SOP Class UID in File : may be forged later - ELEMENTS(0x0004,0x1511,""), - // Referenced Transfer Syntax in File - ELEMENTS(0x0004,0x1512,""), - // Specific Character Set - ELEMENTS(0x0008,0x0005,"ISO_IR 100"), - // Image Type - ELEMENTS(0x0008,0x0008,""), - // SOP Class UID : to be set/forged later - ELEMENTS(0x0008,0x0016,""), - // SOP Instance UID : to be set/forged later - ELEMENTS(0x0008,0x0018,""), - // Content Date - ELEMENTS(0x0008,0x0023,""), - // Content Time - ELEMENTS(0x0008,0x0033,""), - // Referenced Image Sequence : to be set/forged later - ELEMENTS(0x0008,0x1040,""), - ELEMENTS(0xfffe,0xe000,"0"), - // Referenced SOP Class UID : to be set/forged later - ELEMENTS(0x0008,0x1150,""), - // Referenced SOP Instance UID : to be set/forged later - ELEMENTS(0x0008,0x1155,""), - // Image Number - ELEMENTS(0x0020,0x0013,"0"), - // Image Position Patient - ELEMENTS(0x0020,0x0032,"0"), - // Image Orientation(Patient) - ELEMENTS(0x0020,0x0037,"0"), - // Frame of Reference UID - ELEMENTS(0x0020,0x0052,"0"), - // Rows - ELEMENTS(0x0028,0x0010,"0"), - // Columns - ELEMENTS(0x0028,0x0011,"0"), - // Pixel Spacing - ELEMENTS(0x0028,0x0030,"0"), - // Calibration Image - ELEMENTS(0x0050,0x0004,"0"), - ELEMENTS(0xffff,0xffff,"") -}; - //----------------------------------------------------------------------------- // Constructor / Destructor /* @@ -556,7 +374,8 @@ void gdcmDicomDir::SetElements(std::string &path,ListHeader &list) */ void gdcmDicomDir::SetElement(std::string &path,gdcmDicomDirType type,gdcmHeader *header) { - ELEMENTS *elemList; + std::list elemList; + std::list::iterator it; guint16 tmpGr, tmpEl; gdcmDictEntry *dictEntry; gdcmHeaderEntry *entry; @@ -565,33 +384,30 @@ void gdcmDicomDir::SetElement(std::string &path,gdcmDicomDirType type,gdcmHeader switch(type) { case GDCM_PATIENT: - elemList=patientElem; + elemList=gdcmGlobal::GetDicomDirElements()->GetPatientElements(); break; case GDCM_STUDY: - elemList=studyElem; + elemList=gdcmGlobal::GetDicomDirElements()->GetStudyElements(); break; case GDCM_SERIE: - elemList=serieElem; + elemList=gdcmGlobal::GetDicomDirElements()->GetSerieElements(); break; case GDCM_IMAGE: - elemList=imageElem; + elemList=gdcmGlobal::GetDicomDirElements()->GetImageElements(); break; case GDCM_NONE: - elemList=metaElem; + elemList=gdcmGlobal::GetDicomDirElements()->GetMetaElements(); break; default: return; } - for(int i=0;;i++) + for(it=elemList.begin();it!=elemList.end();++it) { - tmpGr=elemList[i].group; - tmpEl=elemList[i].elem; - if(tmpGr==0xffff) - break; + tmpGr=it->group; + tmpEl=it->elem; dictEntry=GetPubDict()->GetDictEntryByNumber(tmpGr,tmpEl); - entry=new gdcmHeaderEntry(dictEntry); entry->SetOffset(0); // just to avoid missprinting @@ -619,7 +435,7 @@ void gdcmDicomDir::SetElement(std::string &path,gdcmDicomDirType type,gdcmHeader } else { - val=elemList[i].value; + val=it->value; } } entry->SetValue(val); diff --git a/src/gdcmDicomDir.h b/src/gdcmDicomDir.h index 95a8d69c..3eb1b625 100644 --- a/src/gdcmDicomDir.h +++ b/src/gdcmDicomDir.h @@ -6,6 +6,7 @@ #include "gdcmHeader.h" #include "gdcmCommon.h" #include "gdcmPatient.h" +#include "gdcmDicomDirElement.h" //----------------------------------------------------------------------------- typedef std::list ListPatient; diff --git a/src/gdcmDicomDirElement.cxx b/src/gdcmDicomDirElement.cxx new file mode 100644 index 00000000..cc83188d --- /dev/null +++ b/src/gdcmDicomDirElement.cxx @@ -0,0 +1,136 @@ +// gdcmDicomDirElement.cxx +//----------------------------------------------------------------------------- +#include + +#include "gdcmDicomDirElement.h" +#include "gdcmUtil.h" + +#ifndef PUB_DICT_PATH +# define PUB_DICT_PATH "../Dicts/" +#endif +#define DICT_ELEM "DicomDir.dic" + +#include +#ifdef GDCM_NO_ANSI_STRING_STREAM +# include +# define ostringstream ostrstream +# else +# include +#endif + +//----------------------------------------------------------------------------- +// Constructor / Destructor +gdcmDicomDirElement::gdcmDicomDirElement(void) +{ + std::string filename=gdcmDictSet::BuildDictPath() + std::string(DICT_ELEM); + std::ifstream from(filename.c_str()); + dbg.Error(!from, "gdcmDicomDirElement::gdcmDicomDirElement: can't open dictionary",filename.c_str()); + + char buff[1024]; + std::string type; + gdcmElement elem; + + while (!from.eof()) { + eatwhite(from); + from.getline(buff, 1024, ' '); + type = buff; + + if( (type=="metaElem") || (type=="patientElem") || + (type=="studyElem") || (type=="serieElem") || + (type=="imageElem") ) + { + from >> std::hex >> elem.group >> elem.elem; + + eatwhite(from); + from.getline(buff, 1024, '"'); + eatwhite(from); + from.getline(buff, 1024, '"'); + elem.value = buff; + + if(type=="metaElem") + MetaList.push_back(elem); + else if(type=="patientElem") + PatientList.push_back(elem); + else if(type=="studyElem") + StudyList.push_back(elem); + else if(type=="serieElem") + SerieList.push_back(elem); + else if(type=="imageElem") + ImageList.push_back(elem); + } + + from.getline(buff, 1024, '\n'); + } + from.close(); +} + +gdcmDicomDirElement::~gdcmDicomDirElement() +{ + MetaList.clear(); + PatientList.clear(); + StudyList.clear(); + SerieList.clear(); + ImageList.clear(); +} + +//----------------------------------------------------------------------------- +// Print +/** + * \ingroup gdcmVR + * \brief Print all + * @param os The output stream to be written to. + */ +void gdcmDicomDirElement::Print(std::ostream &os) +{ + std::ostringstream s; + std::list::iterator it; + char greltag[10]; //group element tag + + s << "Meta Elements :"<group,it->elem); + s << " ("<value<group,it->elem); + s << " ("<value<group,it->elem); + s << " ("<value<group,it->elem); + s << " ("<value<group,it->elem); + s << " ("<value< + +//----------------------------------------------------------------------------- +typedef struct +{ + unsigned short int group; + unsigned short int elem; + std::string value; +} gdcmElement; + +typedef std::list ListMetaElem; +typedef std::list ListPatientElem; +typedef std::list ListStudyElem; +typedef std::list ListSerieElem; +typedef std::list ListImageElem; + +//----------------------------------------------------------------------------- +/* + * \defgroup gdcmDicomDirElement + * \brief gdcmDicomDirElement represents elements contained in a dicom dir + * + */ +class GDCM_EXPORT gdcmDicomDirElement +{ +public: + gdcmDicomDirElement(void); + ~gdcmDicomDirElement(void); + + void Print(std::ostream &os); + + ListMetaElem &GetMetaElements(void) {return(MetaList);}; + ListPatientElem &GetPatientElements(void) {return(PatientList);}; + ListStudyElem &GetStudyElements(void) {return(StudyList);}; + ListSerieElem &GetSerieElements(void) {return(SerieList);}; + ListImageElem &GetImageElements(void) {return(ImageList);}; + +private: + ListMetaElem MetaList; + ListPatientElem PatientList; + ListStudyElem StudyList; + ListSerieElem SerieList; + ListImageElem ImageList; +}; + +//----------------------------------------------------------------------------- +#endif diff --git a/src/gdcmHeaderEntry.cxx b/src/gdcmHeaderEntry.cxx index 3c2ffaf7..a55933c0 100644 --- a/src/gdcmHeaderEntry.cxx +++ b/src/gdcmHeaderEntry.cxx @@ -41,6 +41,7 @@ void gdcmHeaderEntry::Print(std::ostream & os) { std::ostringstream s; guint32 lgth; char greltag[10]; //group element tag + g = GetGroup(); e = GetElement(); v = GetValue(); diff --git a/src/gdcmParser.cxx b/src/gdcmParser.cxx index 7f6384f8..2bb771cb 100644 --- a/src/gdcmParser.cxx +++ b/src/gdcmParser.cxx @@ -1769,7 +1769,7 @@ void gdcmParser::FixHeaderEntryFoundLength(gdcmHeaderEntry *Entry, guint32 Found if (FoundLength%2) { std::cout << "Warning : Tag with uneven length " << FoundLength - << " in x(" << std::hex << gr << "," << el <<")" << std::endl; + << " in x(" << std::hex << gr << "," << el <<")" << std::dec << std::endl; } // Sorry for the patch! diff --git a/src/gdcmUtil.cxx b/src/gdcmUtil.cxx index fb1f87fb..faad0254 100644 --- a/src/gdcmUtil.cxx +++ b/src/gdcmUtil.cxx @@ -52,23 +52,26 @@ void gdcmDebug::Exit(int a) { } //----------------------------------------------------------------------------- -gdcmVR *gdcmGlobal::VR = (gdcmVR *)0; -gdcmTS *gdcmGlobal::TS = (gdcmTS *)0; -gdcmDictSet *gdcmGlobal::Dicts = (gdcmDictSet *)0; +gdcmDictSet *gdcmGlobal::Dicts = (gdcmDictSet *)0; +gdcmVR *gdcmGlobal::VR = (gdcmVR *)0; +gdcmTS *gdcmGlobal::TS = (gdcmTS *)0; +gdcmDicomDirElement *gdcmGlobal::ddElem = (gdcmDicomDirElement *)0; gdcmGlobal gdcmGlob; gdcmGlobal::gdcmGlobal(void) { if (VR || TS || Dicts) dbg.Verbose(0, "gdcmGlobal::gdcmGlobal : VR or TS or Dicts already allocated"); + Dicts = new gdcmDictSet(); VR = new gdcmVR(); TS = new gdcmTS(); - Dicts = new gdcmDictSet(); + ddElem = new gdcmDicomDirElement(); } gdcmGlobal::~gdcmGlobal() { + delete Dicts; delete VR; delete TS; - delete Dicts; + delete ddElem; } gdcmVR *gdcmGlobal::GetVR(void) { @@ -83,6 +86,10 @@ gdcmDictSet *gdcmGlobal::GetDicts(void) { return Dicts; } +gdcmDicomDirElement *gdcmGlobal::GetDicomDirElements(void) { + return ddElem; +} + //----------------------------------------------------------------------------- // Because is not yet available in g++2.96 std::istream& eatwhite(std::istream& is) { diff --git a/src/gdcmUtil.h b/src/gdcmUtil.h index 4c552409..3dca634d 100644 --- a/src/gdcmUtil.h +++ b/src/gdcmUtil.h @@ -6,6 +6,7 @@ #include "gdcmVR.h" #include "gdcmTS.h" #include "gdcmDictSet.h" +#include "gdcmDicomDirElement.h" #include #include #include @@ -47,14 +48,16 @@ public: gdcmGlobal(void); ~gdcmGlobal(); + static gdcmDictSet *GetDicts(void); static gdcmVR *GetVR(void); static gdcmTS *GetTS(void); - static gdcmDictSet *GetDicts(void); + static gdcmDicomDirElement *GetDicomDirElements(void); private: + static gdcmDictSet *Dicts; static gdcmVR *VR; static gdcmTS *TS; - static gdcmDictSet *Dicts; + static gdcmDicomDirElement *ddElem; }; //----------------------------------------------------------------------------- diff --git a/src/win32/gdcmdll.dsp b/src/win32/gdcmdll.dsp index b6215ebc..27dd6876 100644 --- a/src/win32/gdcmdll.dsp +++ b/src/win32/gdcmdll.dsp @@ -58,7 +58,7 @@ LINK32=link.exe # Begin Special Build Tool SOURCE="$(InputPath)" PostBuild_Desc=Copy for test -PostBuild_Cmds=copy ..\..\lib\gdcmdll.dll ..\..\gdcmPython\ copy ..\..\lib\gdcmdll.dll ..\..\test\ copy Release\gdcmdll.lib ..\..\lib\ +PostBuild_Cmds=copy ..\..\lib\gdcmdll.dll ..\..\gdcmPython\ copy ..\..\lib\gdcmdll.dll ..\..\test\ copy Release\gdcmdll.lib ..\..\lib\ # End Special Build Tool !ELSEIF "$(CFG)" == "gdcmdll - Win32 Debug" @@ -90,7 +90,7 @@ LINK32=link.exe # Begin Special Build Tool SOURCE="$(InputPath)" PostBuild_Desc=Copy for test -PostBuild_Cmds=copy ..\..\lib\gdcmdll.dll ..\..\gdcmPython\ copy ..\..\lib\gdcmdll.dll ..\..\test\ copy Debug\gdcmdll.lib ..\..\lib\ +PostBuild_Cmds=copy ..\..\lib\gdcmdll.dll ..\..\gdcmPython\ copy ..\..\lib\gdcmdll.dll ..\..\test\ copy Debug\gdcmdll.lib ..\..\lib\ # End Special Build Tool !ENDIF @@ -108,6 +108,10 @@ SOURCE=..\gdcmDicomDir.cxx # End Source File # Begin Source File +SOURCE=..\gdcmDicomDirElement.cxx +# End Source File +# Begin Source File + SOURCE=..\gdcmDict.cxx # End Source File # Begin Source File @@ -216,6 +220,10 @@ SOURCE=..\gdcmDicomDir.h # End Source File # Begin Source File +SOURCE=..\gdcmDicomDirElement.h +# End Source File +# Begin Source File + SOURCE=..\gdcmDict.h # End Source File # Begin Source File diff --git a/vtk/win32/vtkgdcm.dsp b/vtk/win32/vtkgdcm.dsp index 15ac4449..24e3a42b 100644 --- a/vtk/win32/vtkgdcm.dsp +++ b/vtk/win32/vtkgdcm.dsp @@ -100,6 +100,10 @@ PostBuild_Cmds=copy ..\..\lib\vtkgdcm.dll ..\ copy Debug\vtkgdcm.lib ..\..\lib\v # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File +SOURCE=..\..\src\gdcmDicomDirElement.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\gdcmDict.cxx # End Source File # Begin Source File -- 2.45.2