--- /dev/null
+// 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;
+ }
+}
--- /dev/null
+// 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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