X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDicomDir.cxx;h=1d5bed3a7f603d460b6a32cd922da8bf39421fe4;hb=53d8646509a5a15166422a0d41533be61670c6aa;hp=1ef0feab48d1fa64c560a61a5194a753e16a280b;hpb=a462ce9f1af0894cd930ab04f2e65cd80dfa7084;p=gdcm.git diff --git a/src/gdcmDicomDir.cxx b/src/gdcmDicomDir.cxx index 1ef0feab..1d5bed3a 100644 --- a/src/gdcmDicomDir.cxx +++ b/src/gdcmDicomDir.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDir.cxx,v $ Language: C++ - Date: $Date: 2005/01/08 15:03:59 $ - Version: $Revision: 1.97 $ + Date: $Date: 2005/01/17 10:59:52 $ + Version: $Revision: 1.103 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -82,16 +82,21 @@ DicomDir::DicomDir() DicomDir::DicomDir(std::string const &fileName, bool parseDir ): Document( fileName ) { - // Whatever user passed (a root directory or a DICOMDIR) - // and whatever the value of parseDir was, - // Document is already executed + // At this step, Document constructor is already executed, + // whatever user passed (a root directory or a DICOMDIR) + // and whatever the value of parseDir was. + // (nothing is cheked in Document constructor, to avoid overhead) + Initialize(); // sets all private fields to NULL // if user passed a root directory, sure we didn't get anything if ( TagHT.begin() == TagHT.end() ) // when user passed a Directory to parse { - gdcmVerboseMacro( "Entry HT empty"); + if (!parseDir) + gdcmVerboseMacro( "Entry HT empty for file: "<GetSQItems(); @@ -757,25 +768,21 @@ void DicomDir::CreateDicomDir() { si = new DicomDirPatient(); AddDicomDirPatientToEnd( static_cast(si) ); - type = DicomDir::GDCM_DICOMDIR_PATIENT; } else if( v == "STUDY " ) { si = new DicomDirStudy(); AddDicomDirStudyToEnd( static_cast(si) ); - type = DicomDir::GDCM_DICOMDIR_STUDY; } else if( v == "SERIES" ) { si = new DicomDirSerie(); AddDicomDirSerieToEnd( static_cast(si) ); - type = DicomDir::GDCM_DICOMDIR_SERIE; } else if( v == "IMAGE " ) { si = new DicomDirImage(); AddDicomDirImageToEnd( static_cast(si) ); - type = DicomDir::GDCM_DICOMDIR_IMAGE; } else { @@ -980,6 +987,34 @@ bool DicomDir::HeaderLessThan(Document *header1, Document *header2) { return *header1 < *header2; } + +/** + * \brief Initialise the visit of the DicomDirPatients of the DicomDir + */ +void DicomDir::InitTraversal() +{ + ItDicomDirPatient = Patients.begin(); +} + +/** + * \brief Get the next entry while visiting the DicomDirPatients + * \return The next DicomDirPatient if found, otherwhise NULL + */ +DicomDirPatient *DicomDir::GetNextEntry() +{ + if (ItDicomDirPatient != Patients.end()) + { + DicomDirPatient *tmp = *ItDicomDirPatient; + ++ItDicomDirPatient; + return tmp; + } + else + { + return NULL; + } +} + + } // end namespace gdcm //-----------------------------------------------------------------------------