]> Creatis software - gdcm.git/commitdiff
*** empty log message ***
authorregrain <regrain>
Thu, 22 Jan 2004 14:21:19 +0000 (14:21 +0000)
committerregrain <regrain>
Thu, 22 Jan 2004 14:21:19 +0000 (14:21 +0000)
src/CMakeLists.txt
src/Makefile.am
src/gdcmDicomDir.cxx [new file with mode: 0644]
src/gdcmDicomDir.h [new file with mode: 0644]
src/win32/gdcmdll.dsp

index ba5dd1bed2d4213d7ee4f1a01b3be1572bf9c452..710fc191a17636a1ec257f13f7dc8703c94cc8e6 100644 (file)
@@ -27,7 +27,7 @@ SET(libgdcm_la_SOURCES
        gdcmJpeg2000.cxx\r
        gdcmRLE.cxx\r
        gdcmParse.cxx\r
-       gdcmDICOMDIR.cxx\r
+       gdcmDicomDir.cxx\r
        gdcmPatient.cxx\r
        gdcmStudy.cxx\r
        gdcmSequence.cxx\r
index 9a2cb239c847fcd09173c710d1c021107e0761d4..2ab95e9a94a3f90439a8d44e7aed26d553ba2d57 100644 (file)
@@ -30,7 +30,7 @@ libgdcm_la_SOURCES=                \
    gdcmJpeg2000.cxx                \
    gdcmRLE.cxx                     \
    gdcmParsePixels.cxx             \
-   gdcmDICOMDIR.cxx                \
+   gdcmDicomDir.cxx                \
    gdcmObject.cxx                  \
    gdcmPatient.cxx                 \
    gdcmStudy.cxx                   \
@@ -52,7 +52,7 @@ libgdcminclude_HEADERS =                \
        gdcmVR.h                        \
        gdcmTS.h                        \
        gdcmFile.h                      \
-       gdcmDICOMDIR.h                  \
+       gdcmDicomDir.h                  \
        gdcmObject.h                    \
        gdcmPatient.h                   \
        gdcmStudy.h                     \
diff --git a/src/gdcmDicomDir.cxx b/src/gdcmDicomDir.cxx
new file mode 100644 (file)
index 0000000..eaf7e82
--- /dev/null
@@ -0,0 +1,101 @@
+// gdcmDicomDir.cxx
+//-----------------------------------------------------------------------------
+#include "gdcmDicomDir.h"
+#include "gdcmPatient.h"
+#include "gdcmStudy.h"
+#include "gdcmSerie.h"
+#include "gdcmImage.h"
+
+#include <string>
+
+gdcmDicomDir::gdcmDicomDir(std::string & FileName,
+                           bool exception_on_error):
+   gdcmParser(FileName.c_str(),exception_on_error, true )  {
+
+
+   gdcmPatient *patCur;
+   gdcmStudy   *studCur;
+   gdcmSerie   *serCur;
+   gdcmImage   *imaCur; 
+     
+   ListTag::iterator i, j;
+   
+   
+     if ( GetListEntry().begin() ==   GetListEntry().end() ) {
+        cout << "ListEntry vide " << endl;
+     }     
+     i = GetListEntry().begin();              
+     while ( i != GetListEntry().end() ) {
+
+       // std::cout << std::hex << (*i)->GetGroup() << 
+       //                  " " << (*i)->GetElement() << endl;
+
+       std::string v = (*i)->GetValue();               
+        if (v == "PATIENT ") {
+          patCur=new gdcmPatient();
+          //cout << "PATIENT" << endl,
+          patCur->beginObj =i; 
+          GetPatients().push_back(patCur);          
+       }       
+
+        if (v == "STUDY ") {
+           //cout << "STUDY" << endl,
+           studCur=new gdcmStudy();
+          studCur->beginObj = patCur->endObj = i;                 
+           lPatient::iterator aa = GetPatients().end();
+           --aa;
+          (*aa)->GetStudies().push_back(studCur);
+       }
+           studCur=new gdcmStudy();
+        
+        if (v == "SERIES") {
+          //cout << "SERIES" << endl,
+           serCur=new gdcmSerie();
+
+          serCur->beginObj  = studCur->endObj= i;              
+          lPatient::iterator aa = GetPatients().end();
+           --aa;
+          lStudy::iterator bb = (*aa)->GetStudies().end();
+          --bb;
+          (*bb)->GetSeries().push_back(serCur);
+       }
+               
+        if (v == "IMAGE ") {
+           //cout << "IMAGE" << endl;
+           imaCur=new gdcmImage();
+          imaCur->beginObj  = serCur->endObj= i;               
+
+          lPatient::iterator aa = GetPatients().end();
+           --aa;
+          lStudy::iterator bb = (*aa)->GetStudies().end();
+          --bb;
+          lSerie::iterator cc = (*bb)->GetSeries().end();
+          --cc; 
+          (*cc)->GetImages().push_back(imaCur);
+          
+          
+          /* ---
+          // ce n'est pas sur une nouvelle IMAGE, qu'il faut intervenir
+          // mais lorsqu'on rencontre un 'non IMAGE' apres des 'IMAGE'
+          lImage::iterator dd = (*cc)->GetImages().end();
+
+          if ( (*cc)->GetImages().begin() != dd ) {
+             --dd;
+             (*dd)->endObj = i;           
+          }
+        --- */                    
+       }                                 
+       ++i; 
+      }      
+}
+
+
+gdcmDicomDir::~gdcmDicomDir() {
+   lPatient::iterator cc = GetPatients().begin();
+   while  (cc != GetPatients().end() ) {
+      //cout << "delete PATIENT" << endl;
+      delete *cc;
+      ++cc;
+   }
+}
diff --git a/src/gdcmDicomDir.h b/src/gdcmDicomDir.h
new file mode 100644 (file)
index 0000000..1426b63
--- /dev/null
@@ -0,0 +1,35 @@
+// gdcmDICOMDIR.h
+//-----------------------------------------------------------------------------
+#ifndef GDCMDICOMDIR_H
+#define GDCMDICOMDIR_H
+
+#include "gdcmHeader.h"
+#include "gdcmCommon.h"
+#include "gdcmPatient.h"
+
+//-----------------------------------------------------------------------------
+
+typedef std::list<gdcmPatient *> lPatient;
+
+//-----------------------------------------------------------------------------
+/*
+ * \defgroup gdcmDicomDir
+ * \brief    gdcmDicomDir defines an object representing a DICOMDIR in memory.
+ *
+ */
+class GDCM_EXPORT gdcmDicomDir: public gdcmParser {
+public:
+
+   gdcmDicomDir(std::string &FileName,bool exception_on_error = false );
+   ~gdcmDicomDir();
+
+   inline lPatient &GetPatients() {return patients;};
+   inline void AddPatient(gdcmPatient *patient) {patients.push_back(patient);};
+   
+private:
+   lPatient patients;
+
+};
+
+//-----------------------------------------------------------------------------
+#endif
index 9581a86a12fbc9cb8629a29b1bde1ce07265d42d..dcb110811f23668268c0d1baa3e2cef828940c01 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
@@ -104,6 +104,10 @@ PostBuild_Cmds=copy                 ..\..\lib\gdcmdll.dll                 ..\..\
 # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
 # Begin Source File\r
 \r
+SOURCE=..\gdcmDicomDir.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\gdcmDict.cxx\r
 # End Source File\r
 # Begin Source File\r
@@ -136,6 +140,10 @@ SOURCE=..\gdcmHeaderHelper.cxx
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\gdcmImage.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\gdcmJpeg.cxx\r
 # End Source File\r
 # Begin Source File\r
@@ -160,6 +168,14 @@ SOURCE=..\gdcmRLE.cxx
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\gdcmSerie.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\gdcmStudy.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\gdcmTS.cxx\r
 # End Source File\r
 # Begin Source File\r
@@ -184,6 +200,10 @@ SOURCE=..\gdcmCommon.h
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\gdcmDicomDir.h\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\gdcmDict.h\r
 # End Source File\r
 # Begin Source File\r
@@ -216,10 +236,26 @@ SOURCE=..\gdcmHeaderHelper.h
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\gdcmImage.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\gdcmObject.h\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\gdcmParser.h\r
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\gdcmSerie.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\gdcmStudy.h\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\gdcmTS.h\r
 # End Source File\r
 # Begin Source File\r