]> Creatis software - gdcm.git/commitdiff
2005-01-15 Jean-Pierre Roux <jpr@creatis.univ-lyon1.fr>
authorjpr <jpr>
Mon, 17 Jan 2005 10:59:52 +0000 (10:59 +0000)
committerjpr <jpr>
Mon, 17 Jan 2005 10:59:52 +0000 (10:59 +0000)
    * 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
src/gdcmDicomDir.h
src/gdcmDicomDirPatient.cxx
src/gdcmDicomDirPatient.h
src/gdcmDicomDirSerie.cxx
src/gdcmDicomDirSerie.h
src/gdcmDicomDirStudy.cxx
src/gdcmDicomDirStudy.h

index fa16153d718e160de3cecb95fc67fb94b130d084..1d5bed3a7f603d460b6a32cd922da8bf39421fe4 100644 (file)
@@ -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
 
 //-----------------------------------------------------------------------------
index 9aaad605f5e9b634048b2bd384fb868177c678b6..0391c5a2b85c21e76d78db73f3bcbf217589cb6a 100644 (file)
@@ -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;
index 9a26b4fc9ca21da230f0a377ac215131e1c0144b..e3235ec8e4aa45933c421e3af20c68d8b61c2cb2 100644 (file)
@@ -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
 
index 80a535e101a3483533f4f8f1a1309a3fcb10a65e..e1cc299e7f70490e997cfa716f50dc3701ca1da6 100644 (file)
@@ -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<DicomDirStudy*> 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
 
index b78fc9fdde2aa92067bf979cd496826982eefe45..24529ce3ea45f891cd54726ed2092e6dde4d8fbd 100644 (file)
@@ -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
 
index d86e5e49f1a75de5657d2792378d973622f92079..992231747dea2e68f18acb63c13d3b26e475b35d 100644 (file)
@@ -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<DicomDirImage *> 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
 //-----------------------------------------------------------------------------
index 5ac40f93fdddfaf6da441cf0803692bf2d0550c4..849cc78cd874182dbd6bb1c7984c40207c07d87c 100644 (file)
@@ -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
 
index aad51502c0db209410f3b9c75c873f2f6707ae8e..350fe6dc86e62c505577b824b7b6ed5f50fa4e72 100644 (file)
@@ -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<DicomDirSerie *> 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