From fec70eb0129b86c02e256a069d3eec45c6c43e46 Mon Sep 17 00:00:00 2001 From: jpr Date: Mon, 17 Jan 2005 10:59:52 +0000 Subject: [PATCH] 2005-01-15 Jean-Pierre Roux * ADD DicomDir, DicomDirPatient, DicomDirStudy, DicomDirSerie, DicomDirImage related methods, in order not to expose internal mechanisms InitTraversal(); GetNextEntry(); * REM methods that exposed internal mechanisms : DicomDir::GetDicomDirPatients() DicomDirPatient::GetDicomDirStudies() DicomDirStudy::GetDicomDirSeries() DicomDirSerie::GetDicomDirImages() --- src/gdcmDicomDir.cxx | 32 ++++++++++++++++++++++++++++++-- src/gdcmDicomDir.h | 10 ++++++---- src/gdcmDicomDirPatient.cxx | 29 +++++++++++++++++++++++++++-- src/gdcmDicomDirPatient.h | 17 ++++++++++++----- src/gdcmDicomDirSerie.cxx | 33 ++++++++++++++++++++++++++++++--- src/gdcmDicomDirSerie.h | 35 ++++++++++++++++------------------- src/gdcmDicomDirStudy.cxx | 32 +++++++++++++++++++++++++++++--- src/gdcmDicomDirStudy.h | 34 ++++++++++++++++------------------ 8 files changed, 166 insertions(+), 56 deletions(-) diff --git a/src/gdcmDicomDir.cxx b/src/gdcmDicomDir.cxx index fa16153d..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/16 04:50:41 $ - Version: $Revision: 1.102 $ + 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 @@ -987,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 //----------------------------------------------------------------------------- diff --git a/src/gdcmDicomDir.h b/src/gdcmDicomDir.h index 9aaad605..0391c5a2 100644 --- a/src/gdcmDicomDir.h +++ b/src/gdcmDicomDir.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDir.h,v $ Language: C++ - Date: $Date: 2005/01/16 04:50:41 $ - Version: $Revision: 1.46 $ + Date: $Date: 2005/01/17 10:59:52 $ + Version: $Revision: 1.47 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -66,8 +66,9 @@ public: /// Returns a pointer to the DicomDirMeta for this DICOMDIR. DicomDirMeta* GetDicomDirMeta() { return MetaElems; }; - /// Returns the PATIENT chained List for this DICOMDIR. - ListDicomDirPatient const & GetDicomDirPatients() const { return Patients; }; + // should avoid exposing internal mechanism + void InitTraversal(); + DicomDirPatient *GetNextEntry(); /// Parsing void ParseDirectory(); @@ -142,6 +143,7 @@ private: /// Pointer on *the* DicomDirObject 'DicomDirMeta Elements' DicomDirMeta* MetaElems; + ListDicomDirPatient::iterator ItDicomDirPatient; /// Chained list of DicomDirPatient (to be exploited recursively) ListDicomDirPatient Patients; diff --git a/src/gdcmDicomDirPatient.cxx b/src/gdcmDicomDirPatient.cxx index 9a26b4fc..e3235ec8 100644 --- a/src/gdcmDicomDirPatient.cxx +++ b/src/gdcmDicomDirPatient.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirPatient.cxx,v $ Language: C++ - Date: $Date: 2005/01/16 04:50:41 $ - Version: $Revision: 1.24 $ + Date: $Date: 2005/01/17 10:59:52 $ + Version: $Revision: 1.25 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -102,6 +102,31 @@ DicomDirStudy* DicomDirPatient::NewStudy() return st; } +/** + * \brief Initialise the visit of the DicomDirPatients + */ +void DicomDirPatient::InitTraversal() +{ + ItDicomDirStudy = Studies.begin(); +} + +/** + * \brief Get the next entry while visiting the DicomDirStudies + * \return The next DicomDirStudies if found, otherwhise NULL + */ +DicomDirStudy *DicomDirPatient::GetNextEntry() +{ + if (ItDicomDirStudy != Studies.end()) + { + DicomDirStudy *tmp = *ItDicomDirStudy; + ++ItDicomDirStudy; + return tmp; + } + else + { + return NULL; + } +} //----------------------------------------------------------------------------- // Protected diff --git a/src/gdcmDicomDirPatient.h b/src/gdcmDicomDirPatient.h index 80a535e1..e1cc299e 100644 --- a/src/gdcmDicomDirPatient.h +++ b/src/gdcmDicomDirPatient.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirPatient.h,v $ Language: C++ - Date: $Date: 2005/01/16 04:50:41 $ - Version: $Revision: 1.18 $ + Date: $Date: 2005/01/17 10:59:52 $ + Version: $Revision: 1.19 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -30,7 +30,6 @@ typedef std::list ListDicomDirStudy; //----------------------------------------------------------------------------- /** - * \ingroup DicomDirPatient * \brief describes a PATIENT within a DICOMDIR (DicomDir) */ @@ -43,19 +42,27 @@ public: void Print(std::ostream &os = std::cout, std::string const & indent = "" ); void WriteContent(std::ofstream *fp, FileType t); + // TODO Remove GetDicomDirStudies + // use InitTraversal + GetNextEntry instead. + /// Returns the STUDY chained List for this PATIENT. ListDicomDirStudy const &GetDicomDirStudies() const { return Studies; }; + // should avoid exposing internal mechanism + void InitTraversal(); + DicomDirStudy *GetNextEntry(); + /// adds the passed STUDY to the STUDY chained List for this PATIENT. void AddDicomDirStudy (DicomDirStudy *obj) { Studies.push_back(obj); }; - /// TODO DicomDirStudy *NewStudy(); private: - /// chained list of DicomDirStudy + /// chained list of DicomDirStudy (to be exploited recursively) ListDicomDirStudy Studies; + /// iterator on the DicomDirStudies of the current DicomDirPatient + ListDicomDirStudy::iterator ItDicomDirStudy; }; } // end namespace gdcm diff --git a/src/gdcmDicomDirSerie.cxx b/src/gdcmDicomDirSerie.cxx index b78fc9fd..24529ce3 100644 --- a/src/gdcmDicomDirSerie.cxx +++ b/src/gdcmDicomDirSerie.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirSerie.cxx,v $ Language: C++ - Date: $Date: 2005/01/16 04:50:41 $ - Version: $Revision: 1.26 $ + Date: $Date: 2005/01/17 10:59:52 $ + Version: $Revision: 1.27 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -99,7 +99,34 @@ DicomDirImage *DicomDirSerie::NewImage() Images.push_front(st); return st; -} +} + +/** + * \brief Initialise the visit of the Images + */ +void DicomDirSerie::InitTraversal() +{ + ItDicomDirImage = Images.begin(); +} + +/** + * \brief Get the next entry while visiting the DicomDirImages + * \return The next DicomDirImages if found, otherwhise NULL + */ +DicomDirImage *DicomDirSerie::GetNextEntry() +{ + if (ItDicomDirImage != Images.end()) + { + DicomDirImage *tmp = *ItDicomDirImage; + ++ItDicomDirImage; + return tmp; + } + else + { + return NULL; + } +} + //----------------------------------------------------------------------------- // Protected diff --git a/src/gdcmDicomDirSerie.h b/src/gdcmDicomDirSerie.h index d86e5e49..99223174 100644 --- a/src/gdcmDicomDirSerie.h +++ b/src/gdcmDicomDirSerie.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirSerie.h,v $ Language: C++ - Date: $Date: 2005/01/16 04:50:41 $ - Version: $Revision: 1.19 $ + Date: $Date: 2005/01/17 10:59:52 $ + Version: $Revision: 1.20 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -29,7 +29,6 @@ typedef std::list ListDicomDirImage; //----------------------------------------------------------------------------- /** - * \ingroup DicomDirSerie * \brief describes a SERIE within a within a STUDY * (DicomDirStudy) of a given DICOMDIR (DicomDir) */ @@ -42,29 +41,27 @@ public: void Print( std::ostream &os = std::cout, std::string const & indent = "" ); void WriteContent( std::ofstream *fp, FileType t ); - /** - * \ingroup DicomDirSerie - * \brief returns the IMAGE chained List for this SERIE. - */ + // TODO Remove GetDicomDirImages + // use InitTraversal + GetNextEntry instead. + + /// Returns the IMAGE chained List for this SERIE. ListDicomDirImage const &GetDicomDirImages() const { return Images; }; - /** - * \ingroup DicomDirSerie - * \brief adds the passed IMAGE to the IMAGE chained List for this SERIE. - */ + // should avoid exposing internal mechanism + void InitTraversal(); + DicomDirImage *GetNextEntry(); + + /// adds the passed IMAGE to the IMAGE chained List for this SERIE. void AddDicomDirImage(DicomDirImage *obj) { Images.push_back(obj); }; -/** - * \ingroup DicomDirSerie - * \brief TODO - */ DicomDirImage *NewImage(); - + private: -/** -* \brief chained list of DicomDirImages -*/ + + ///chained list of DicomDirImages (to be exploited recursively) ListDicomDirImage Images; + /// iterator on the DicomDirImages of the current DicomDirSerie + ListDicomDirImage::iterator ItDicomDirImage; }; } // end namespace gdcm //----------------------------------------------------------------------------- diff --git a/src/gdcmDicomDirStudy.cxx b/src/gdcmDicomDirStudy.cxx index 5ac40f93..849cc78c 100644 --- a/src/gdcmDicomDirStudy.cxx +++ b/src/gdcmDicomDirStudy.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirStudy.cxx,v $ Language: C++ - Date: $Date: 2005/01/16 04:50:41 $ - Version: $Revision: 1.23 $ + Date: $Date: 2005/01/17 10:59:52 $ + Version: $Revision: 1.24 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -102,7 +102,33 @@ DicomDirSerie *DicomDirStudy::NewSerie() Series.push_front(st); return st; -} +} + +/** + * \brief Initialise the visit of the Series + */ +void DicomDirStudy::InitTraversal() +{ + ItDicomDirSerie = Series.begin(); +} + +/** + * \brief Get the next entry while visiting the DicomDirSeries + * \return The next DicomDirSeries if found, otherwhise NULL + */ +DicomDirSerie *DicomDirStudy::GetNextEntry() +{ + if (ItDicomDirSerie != Series.end()) + { + DicomDirSerie *tmp = *ItDicomDirSerie; + ++ItDicomDirSerie; + return tmp; + } + else + { + return NULL; + } +} //----------------------------------------------------------------------------- // Protected diff --git a/src/gdcmDicomDirStudy.h b/src/gdcmDicomDirStudy.h index aad51502..350fe6dc 100644 --- a/src/gdcmDicomDirStudy.h +++ b/src/gdcmDicomDirStudy.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirStudy.h,v $ Language: C++ - Date: $Date: 2005/01/16 04:50:41 $ - Version: $Revision: 1.17 $ + Date: $Date: 2005/01/17 10:59:52 $ + Version: $Revision: 1.18 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -29,7 +29,6 @@ typedef std::list ListDicomDirSerie; //----------------------------------------------------------------------------- /** - * \ingroup DicomDirStudy * \brief describes a STUDY within a within a PATIENT * (DicomDirPatient) of a given DICOMDIR (DicomDir) */ @@ -42,29 +41,28 @@ public: void Print(std::ostream &os = std::cout, std::string const & indent = "" ); void WriteContent(std::ofstream *fp, FileType t); - /** - * \ingroup DicomDirStudy - * \brief returns the SERIE chained List for this STUDY. - */ + // TODO Remove GetDicomDirSeries + // use InitTraversal + GetNextEntry instead. + + /// Returns the SERIE chained List for this STUDY. ListDicomDirSerie const &GetDicomDirSeries() const { return Series; }; - /** - * \ingroup DicomDirStudy - * \brief adds the passed SERIE to the SERIE chained List for this STUDY. - */ + // should avoid exposing internal mechanism + void InitTraversal(); + DicomDirSerie *GetNextEntry(); + + /// adds the passed SERIE to the SERIE chained List for this STUDY. void AddDicomDirSerie(DicomDirSerie *obj) { Series.push_back(obj); }; - /** - * \ingroup DicomDirStudy - * \brief TODO - */ DicomDirSerie* NewSerie(); private: -/** -* \brief chained list of DicomDirSeries (to be exploited recursively) -*/ + + /// chained list of DicomDirSeries (to be exploited recursively) ListDicomDirSerie Series; + /// iterator on the DicomDirSeries of the current DicomDirStudy + ListDicomDirSerie::iterator ItDicomDirSerie; + }; } // end namespace gdcm -- 2.48.1