]> Creatis software - gdcm.git/commitdiff
* FIX : Set the elements to create the DicomDir in a dictionary file
authorregrain <regrain>
Wed, 4 Feb 2004 11:25:06 +0000 (11:25 +0000)
committerregrain <regrain>
Wed, 4 Feb 2004 11:25:06 +0000 (11:25 +0000)
     -- BeNours

15 files changed:
Dicts/DicomDir.dic [new file with mode: 0644]
gdcmPython/gdcm.i
gdcmPython/win32/_vtkGdcm.dsp
gdcmPython/win32/gdcmpyembedded.dsp
src/Makefile.am
src/gdcmDicomDir.cxx
src/gdcmDicomDir.h
src/gdcmDicomDirElement.cxx [new file with mode: 0644]
src/gdcmDicomDirElement.h [new file with mode: 0644]
src/gdcmHeaderEntry.cxx
src/gdcmParser.cxx
src/gdcmUtil.cxx
src/gdcmUtil.h
src/win32/gdcmdll.dsp
vtk/win32/vtkgdcm.dsp

diff --git a/Dicts/DicomDir.dic b/Dicts/DicomDir.dic
new file mode 100644 (file)
index 0000000..7edfc97
--- /dev/null
@@ -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
+
index 1a1bc44f5f1150f611a688f82584d414718b8593..acdc94811e0aae84f4aa9e8bc7186663a910ccc3 100644 (file)
 #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"
index b09c016c2452aa7e399d37edb0e2f7b611a0aff1..5b67033327b90a49844f1c363b3f5b2579d76762 100644 (file)
@@ -62,6 +62,10 @@ SOURCE=..\..\src\gdcmDicomDir.cxx
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\src\gdcmDicomDirElement.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\src\gdcmDict.cxx\r
 # End Source File\r
 # Begin Source File\r
index 51f6b8da01ed23293b4c260e1de0c7e6cb090cf4..5895fb2cda6c09c73ab637b047e486f8da8ab76c 100644 (file)
@@ -84,6 +84,10 @@ SOURCE=..\..\src\gdcmDicomDir.cxx
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\src\gdcmDicomDirElement.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\src\gdcmDict.cxx\r
 # End Source File\r
 # Begin Source File\r
index a43bce8791d308516852ca43fb2e35fafe62e84c..ce709d5dae58cc6248369c6392bf36bd56282bc6 100644 (file)
@@ -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                   \
index cd1ab61b5968db25ea628216e06f927fe5fb389f..e9ea4d7e0933f29640a5ca808344a5b6d84494b5 100644 (file)
 #include <sys/types.h>
 #include <errno.h>
 
-//-----------------------------------------------------------------------------
-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<gdcmElement> elemList;
+   std::list<gdcmElement>::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);
index 95a8d69c06277b9f020e1a6108e7a2732c64dcf4..3eb1b625fa05a962bb7a3983e593141eafb410dd 100644 (file)
@@ -6,6 +6,7 @@
 #include "gdcmHeader.h"
 #include "gdcmCommon.h"
 #include "gdcmPatient.h"
+#include "gdcmDicomDirElement.h"
 
 //-----------------------------------------------------------------------------
 typedef std::list<gdcmPatient *> ListPatient;
diff --git a/src/gdcmDicomDirElement.cxx b/src/gdcmDicomDirElement.cxx
new file mode 100644 (file)
index 0000000..cc83188
--- /dev/null
@@ -0,0 +1,136 @@
+// gdcmDicomDirElement.cxx
+//-----------------------------------------------------------------------------
+#include <fstream>
+
+#include "gdcmDicomDirElement.h"
+#include "gdcmUtil.h"
+
+#ifndef PUB_DICT_PATH
+#  define PUB_DICT_PATH     "../Dicts/"
+#endif
+#define DICT_ELEM "DicomDir.dic"
+
+#include <iostream>
+#ifdef GDCM_NO_ANSI_STRING_STREAM
+#  include <strstream>
+#  define  ostringstream ostrstream
+# else
+#  include <sstream>
+#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<gdcmElement>::iterator it;
+   char greltag[10];  //group element tag
+
+   s << "Meta Elements :"<<std::endl;
+   for (it = MetaList.begin();it!=MetaList.end();++it)
+   {
+      sprintf(greltag,"%04x|%04x ",it->group,it->elem);
+      s << "   ("<<greltag<<") = "<< it->value<<std::endl;
+   }
+
+   s << "Patient Elements :"<<std::endl;
+   for (it = PatientList.begin();it!=PatientList.end();++it)
+   {
+      sprintf(greltag,"%04x|%04x ",it->group,it->elem);
+      s << "   ("<<greltag<<") = "<< it->value<<std::endl;
+   }
+
+   s << "Study Elements :"<<std::endl;
+   for (it = StudyList.begin();it!=StudyList.end();++it)
+   {
+      sprintf(greltag,"%04x|%04x ",it->group,it->elem);
+      s << "   ("<<greltag<<") = "<< it->value<<std::endl;
+   }
+
+   s << "Serie Elements :"<<std::endl;
+   for (it = SerieList.begin();it!=SerieList.end();++it)
+   {
+      sprintf(greltag,"%04x|%04x ",it->group,it->elem);
+      s << "   ("<<greltag<<") = "<< it->value<<std::endl;
+   }
+
+   s << "Image Elements :"<<std::endl;
+   for (it = ImageList.begin();it!=ImageList.end();++it)
+   {
+      sprintf(greltag,"%04x|%04x ",it->group,it->elem);
+      s << "   ("<<greltag<<") = "<< it->value<<std::endl;
+   }
+
+   os << s.str();
+}
+
+//-----------------------------------------------------------------------------
+// Public
+
+//-----------------------------------------------------------------------------
+// Protected
+
+//-----------------------------------------------------------------------------
+// Private
+
+//-----------------------------------------------------------------------------
diff --git a/src/gdcmDicomDirElement.h b/src/gdcmDicomDirElement.h
new file mode 100644 (file)
index 0000000..cd74709
--- /dev/null
@@ -0,0 +1,53 @@
+// gdcmDicomDirElement.h
+//-----------------------------------------------------------------------------
+#ifndef GDCMDICOMDIRELEMENT_H
+#define GDCMDICOMDIRELEMENT_H
+
+#include "gdcmCommon.h"
+
+#include <list>
+
+//-----------------------------------------------------------------------------
+typedef struct
+{
+       unsigned short int group;
+       unsigned short int elem;
+       std::string value;
+} gdcmElement;
+
+typedef std::list<gdcmElement> ListMetaElem;
+typedef std::list<gdcmElement> ListPatientElem;
+typedef std::list<gdcmElement> ListStudyElem;
+typedef std::list<gdcmElement> ListSerieElem;
+typedef std::list<gdcmElement> 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
index 3c2ffaf7601f9e34827341f62d141efd174348b2..a55933c0502308db78c8532a92faf5ab626e7d67 100644 (file)
@@ -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();
index 7f6384f85edb59a4aa795a984ceface39f445775..2bb771cbd2f1236d005d81e71ff6d28939d5eb71 100644 (file)
@@ -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!  
index fb1f87fb248565e7647eb571759083d65cd66a4e..faad02548843d592f30abff1a2bfc3bdb439a2f2 100644 (file)
@@ -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) {
index 4c552409cfe2f191fbd439f1a60c207dde49d060..3dca634d1b3b8ca6c54a2f0a79a84361447531d9 100644 (file)
@@ -6,6 +6,7 @@
 #include "gdcmVR.h"
 #include "gdcmTS.h"
 #include "gdcmDictSet.h"
+#include "gdcmDicomDirElement.h"
 #include <iostream>
 #include <vector>
 #include <string>
@@ -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;
 };
 
 //-----------------------------------------------------------------------------
index b6215ebc9a77fd0404230532d1f6aa0ed41c770a..27dd687677f629c4412104c45e05a5c9dc299797 100644 (file)
@@ -58,7 +58,7 @@ LINK32=link.exe
 # Begin Special Build Tool\r
 SOURCE="$(InputPath)"\r
 PostBuild_Desc=Copy for test\r
-PostBuild_Cmds=copy                    ..\..\lib\gdcmdll.dll                    ..\..\gdcmPython\                      copy                    ..\..\lib\gdcmdll.dll                    ..\..\test\                    copy                 Release\gdcmdll.lib                 ..\..\lib\ \r
+PostBuild_Cmds=copy                     ..\..\lib\gdcmdll.dll                     ..\..\gdcmPython\                    copy                     ..\..\lib\gdcmdll.dll                     ..\..\test\                  copy                  Release\gdcmdll.lib                  ..\..\lib\ \r
 # End Special Build Tool\r
 \r
 !ELSEIF  "$(CFG)" == "gdcmdll - Win32 Debug"\r
@@ -90,7 +90,7 @@ LINK32=link.exe
 # Begin Special Build Tool\r
 SOURCE="$(InputPath)"\r
 PostBuild_Desc=Copy for test\r
-PostBuild_Cmds=copy                    ..\..\lib\gdcmdll.dll                    ..\..\gdcmPython\                      copy                    ..\..\lib\gdcmdll.dll                    ..\..\test\                    copy                 Debug\gdcmdll.lib                 ..\..\lib\ \r
+PostBuild_Cmds=copy                     ..\..\lib\gdcmdll.dll                     ..\..\gdcmPython\                    copy                     ..\..\lib\gdcmdll.dll                     ..\..\test\                  copy                  Debug\gdcmdll.lib                  ..\..\lib\ \r
 # End Special Build Tool\r
 \r
 !ENDIF \r
@@ -108,6 +108,10 @@ SOURCE=..\gdcmDicomDir.cxx
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\gdcmDicomDirElement.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\gdcmDict.cxx\r
 # End Source File\r
 # Begin Source File\r
@@ -216,6 +220,10 @@ SOURCE=..\gdcmDicomDir.h
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\gdcmDicomDirElement.h\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\gdcmDict.h\r
 # End Source File\r
 # Begin Source File\r
index 15ac44492bb1a23e93058c41d5ef3171601ce0f5..24e3a42b053cb3e740ff6388718df4278803a4d5 100644 (file)
@@ -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"\r
 # Begin Source File\r
 \r
+SOURCE=..\..\src\gdcmDicomDirElement.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\src\gdcmDict.cxx\r
 # End Source File\r
 # Begin Source File\r