From: regrain Date: Thu, 22 Jan 2004 14:21:19 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: Version0.4~68 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=4bdf977b8a564a425e9ac35787bb3a5ce50047fb;p=gdcm.git *** empty log message *** --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ba5dd1be..710fc191 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,7 +27,7 @@ SET(libgdcm_la_SOURCES gdcmJpeg2000.cxx gdcmRLE.cxx gdcmParse.cxx - gdcmDICOMDIR.cxx + gdcmDicomDir.cxx gdcmPatient.cxx gdcmStudy.cxx gdcmSequence.cxx diff --git a/src/Makefile.am b/src/Makefile.am index 9a2cb239..2ab95e9a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 index 00000000..eaf7e82f --- /dev/null +++ b/src/gdcmDicomDir.cxx @@ -0,0 +1,101 @@ +// gdcmDicomDir.cxx +//----------------------------------------------------------------------------- +#include "gdcmDicomDir.h" +#include "gdcmPatient.h" +#include "gdcmStudy.h" +#include "gdcmSerie.h" +#include "gdcmImage.h" + +#include + +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 index 00000000..1426b631 --- /dev/null +++ b/src/gdcmDicomDir.h @@ -0,0 +1,35 @@ +// gdcmDICOMDIR.h +//----------------------------------------------------------------------------- +#ifndef GDCMDICOMDIR_H +#define GDCMDICOMDIR_H + +#include "gdcmHeader.h" +#include "gdcmCommon.h" +#include "gdcmPatient.h" + +//----------------------------------------------------------------------------- + +typedef std::list 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 diff --git a/src/win32/gdcmdll.dsp b/src/win32/gdcmdll.dsp index 9581a86a..dcb11081 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 @@ -104,6 +104,10 @@ PostBuild_Cmds=copy ..\..\lib\gdcmdll.dll ..\..\ # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File +SOURCE=..\gdcmDicomDir.cxx +# End Source File +# Begin Source File + SOURCE=..\gdcmDict.cxx # End Source File # Begin Source File @@ -136,6 +140,10 @@ SOURCE=..\gdcmHeaderHelper.cxx # End Source File # Begin Source File +SOURCE=..\gdcmImage.cxx +# End Source File +# Begin Source File + SOURCE=..\gdcmJpeg.cxx # End Source File # Begin Source File @@ -160,6 +168,14 @@ SOURCE=..\gdcmRLE.cxx # End Source File # Begin Source File +SOURCE=..\gdcmSerie.cxx +# End Source File +# Begin Source File + +SOURCE=..\gdcmStudy.cxx +# End Source File +# Begin Source File + SOURCE=..\gdcmTS.cxx # End Source File # Begin Source File @@ -184,6 +200,10 @@ SOURCE=..\gdcmCommon.h # End Source File # Begin Source File +SOURCE=..\gdcmDicomDir.h +# End Source File +# Begin Source File + SOURCE=..\gdcmDict.h # End Source File # Begin Source File @@ -216,10 +236,26 @@ SOURCE=..\gdcmHeaderHelper.h # End Source File # Begin Source File +SOURCE=..\gdcmImage.h +# End Source File +# Begin Source File + +SOURCE=..\gdcmObject.h +# End Source File +# Begin Source File + SOURCE=..\gdcmParser.h # End Source File # Begin Source File +SOURCE=..\gdcmSerie.h +# End Source File +# Begin Source File + +SOURCE=..\gdcmStudy.h +# End Source File +# Begin Source File + SOURCE=..\gdcmTS.h # End Source File # Begin Source File