]> Creatis software - gdcm.git/commitdiff
* src/gdcmDicomDirObject.h : set the FillObject method in protected.
authorregrain <regrain>
Thu, 20 Jan 2005 16:16:41 +0000 (16:16 +0000)
committerregrain <regrain>
Thu, 20 Jan 2005 16:16:41 +0000 (16:16 +0000)
     Thus, DicomDirXXX are created with a flad that indicates if the created
     object is empty or not (when not empty, the DicomDirElement is used to
     fill the object)
   -- BeNours

14 files changed:
ChangeLog
src/gdcmDicomDir.cxx
src/gdcmDicomDirImage.cxx
src/gdcmDicomDirImage.h
src/gdcmDicomDirMeta.cxx
src/gdcmDicomDirMeta.h
src/gdcmDicomDirObject.cxx
src/gdcmDicomDirObject.h
src/gdcmDicomDirPatient.cxx
src/gdcmDicomDirPatient.h
src/gdcmDicomDirSerie.cxx
src/gdcmDicomDirSerie.h
src/gdcmDicomDirStudy.cxx
src/gdcmDicomDirStudy.h

index 7f28371734c1eb9a32840a9318c974ae8e6bfd11..6956bf1dfa5b64fc6dc665414c4293fb8f863b7c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-01-20 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
+   * src/gdcmDicomDirObject.h : set the FillObject method in protected.
+     Thus, DicomDirXXX are created with a flad that indicates if the created 
+     object is empty or not (when not empty, the DicomDirElement is used to
+     fill the object)
+
 2005-01-20 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
    * src/gdcmDicomDir.cxx : simplify the NewPatient method, like made in
      gdcm::DicomDirPatient, gdcm::DicomDirStudy, gdcm::DicomDirSerie
index 7dd1f1f3418aba02120419ccd0e5662528e4a5f4..95b2800473904fd4475a761adc1f98b6e140d38e 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDir.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/20 11:33:44 $
-  Version:   $Revision: 1.110 $
+  Date:      $Date: 2005/01/20 16:16:41 $
+  Version:   $Revision: 1.111 $
   
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -471,10 +471,11 @@ DicomDirMeta * DicomDir::NewMeta()
    if( MetaElems )
       delete MetaElems;
 
-   MetaElems = new DicomDirMeta();
   
    if ( TagHT.begin() != TagHT.end() ) // after Document Parsing
    { 
+      MetaElems = new DicomDirMeta(true);
+
       TagDocEntryHT::iterator lastOneButSequence = TagHT.end();
       lastOneButSequence --;
       // ALL the 'out of Sequence' Tags belong to Meta Elems
@@ -488,9 +489,7 @@ DicomDirMeta * DicomDir::NewMeta()
    }
    else  // after root directory parsing
    {
-      ListDicomDirMetaElem const &elemList = 
-         Global::GetDicomDirElements()->GetDicomDirMetaElements();
-      MetaElems->FillObject(elemList);
+      MetaElems = new DicomDirMeta(false);
    }
    MetaElems->SetSQItemNumber(0); // To avoid further missprinting
    return MetaElems;  
@@ -501,11 +500,7 @@ DicomDirMeta * DicomDir::NewMeta()
  */
 DicomDirPatient *DicomDir::NewPatient()
 {
-   ListDicomDirPatientElem const & elemList =
-      Global::GetDicomDirElements()->GetDicomDirPatientElements(); 
    DicomDirPatient *p = new DicomDirPatient();
-   p->FillObject(elemList);
-
    AddPatientToEnd( p );
    return p;
 }
@@ -533,7 +528,7 @@ void DicomDir::SetElement(std::string const &path, DicomDirType type,
    {
       case GDCM_DICOMDIR_IMAGE:
          elemList = Global::GetDicomDirElements()->GetDicomDirImageElements();
-         si = new DicomDirImage();
+         si = new DicomDirImage(true);
          if( !AddImageToEnd(static_cast<DicomDirImage *>(si)) )
          {
             delete si;
@@ -542,7 +537,7 @@ void DicomDir::SetElement(std::string const &path, DicomDirType type,
          break;
       case GDCM_DICOMDIR_SERIE:
          elemList = Global::GetDicomDirElements()->GetDicomDirSerieElements();
-         si = new DicomDirSerie();
+         si = new DicomDirSerie(true);
          if( !AddSerieToEnd(static_cast<DicomDirSerie *>(si)) )
          {
             delete si;
@@ -551,7 +546,7 @@ void DicomDir::SetElement(std::string const &path, DicomDirType type,
          break;
       case GDCM_DICOMDIR_STUDY:
          elemList = Global::GetDicomDirElements()->GetDicomDirStudyElements();
-         si = new DicomDirStudy();
+         si = new DicomDirStudy(true);
          if( !AddStudyToEnd(static_cast<DicomDirStudy *>(si)) )
          {
             delete si;
@@ -560,7 +555,7 @@ void DicomDir::SetElement(std::string const &path, DicomDirType type,
          break;
       case GDCM_DICOMDIR_PATIENT:
          elemList = Global::GetDicomDirElements()->GetDicomDirPatientElements();
-         si = new DicomDirPatient();
+         si = new DicomDirPatient(true);
          if( !AddPatientToEnd(static_cast<DicomDirPatient *>(si)) )
          {
             delete si;
@@ -569,7 +564,7 @@ void DicomDir::SetElement(std::string const &path, DicomDirType type,
          break;
       case GDCM_DICOMDIR_META:
          elemList = Global::GetDicomDirElements()->GetDicomDirMetaElements();
-         si = new DicomDirMeta();
+         si = new DicomDirMeta(true);
          if( MetaElems )
          {
             delete MetaElems;
@@ -767,7 +762,7 @@ void DicomDir::CreateDicomDir()
 
       if( v == "PATIENT " )
       {
-         si = new DicomDirPatient();
+         si = new DicomDirPatient(true);
          if( !AddPatientToEnd( static_cast<DicomDirPatient *>(si)) )
          {
             delete si;
@@ -777,7 +772,7 @@ void DicomDir::CreateDicomDir()
       }
       else if( v == "STUDY " )
       {
-         si = new DicomDirStudy();
+         si = new DicomDirStudy(true);
          if( !AddStudyToEnd( static_cast<DicomDirStudy *>(si)) )
          {
             delete si;
@@ -787,7 +782,7 @@ void DicomDir::CreateDicomDir()
       }
       else if( v == "SERIES" )
       {
-         si = new DicomDirSerie();
+         si = new DicomDirSerie(true);
          if( !AddSerieToEnd( static_cast<DicomDirSerie *>(si)) )
          {
             delete si;
@@ -797,7 +792,7 @@ void DicomDir::CreateDicomDir()
       }
       else if( v == "IMAGE " ) 
       {
-         si = new DicomDirImage();
+         si = new DicomDirImage(true);
          if( !AddImageToEnd( static_cast<DicomDirImage *>(si)) )
          {
             delete si;
index 0ddbfc463409c2279101918589e7abb4b9527875..6ad054f8c9d6d72e423dde6c17cbfcbe867fed4b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirImage.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/18 14:28:32 $
-  Version:   $Revision: 1.18 $
+  Date:      $Date: 2005/01/20 16:16:42 $
+  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
@@ -18,6 +18,7 @@
 
 #include "gdcmDicomDirImage.h"
 #include "gdcmValEntry.h"
+#include "gdcmGlobal.h"
 
 namespace gdcm 
 {
@@ -26,10 +27,17 @@ namespace gdcm
 /**
  * \brief  Constructor 
  */
-DicomDirImage::DicomDirImage():
+DicomDirImage::DicomDirImage(bool empty):
    DicomDirObject()
 {
+   if( !empty )
+   {
+      ListDicomDirImageElem const &elemList = 
+         Global::GetDicomDirElements()->GetDicomDirImageElements();
+      FillObject(elemList);
+   }
 }
+
 /**
  * \brief   Canonical destructor.
  */
@@ -54,7 +62,7 @@ void DicomDirImage::Print(std::ostream &os, std::string const & )
    {
       if( (*i)->GetGroup() == 0x0004 && (*i)->GetElement() == 0x1500 )
       {
-         os << ((ValEntry *)(*i))->GetValue(); //FIXME
+         os << (dynamic_cast<ValEntry *>(*i))->GetValue(); //FIXME
       }
    }
    os << std::endl;
index cb5026dfea303ec0c24172f0a826be688c625b97..a212aeb2e8934a8edb65f075e326e379de04a38b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirImage.h,v $
   Language:  C++
-  Date:      $Date: 2005/01/16 04:50:41 $
-  Version:   $Revision: 1.14 $
+  Date:      $Date: 2005/01/20 16:16:42 $
+  Version:   $Revision: 1.15 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -32,7 +32,7 @@ namespace gdcm
  class GDCM_EXPORT DicomDirImage : public DicomDirObject
 {
 public:
-   DicomDirImage(); 
+   DicomDirImage(bool empty=false); 
    ~DicomDirImage();
 
    void Print(std::ostream &os = std::cout, std::string const & indent = "" );
index 43f2c0564efc983d2a0ec8983ac2c7f3999a780b..516150de0cd29c7635ccbe431ebab977b28d5312 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirMeta.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/18 14:28:32 $
-  Version:   $Revision: 1.23 $
+  Date:      $Date: 2005/01/20 16:16:42 $
+  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
@@ -19,6 +19,7 @@
 #include "gdcmDicomDirMeta.h"
 #include "gdcmDocument.h"
 #include "gdcmDocEntry.h"
+#include "gdcmGlobal.h"
 
 namespace gdcm 
 {
@@ -29,9 +30,15 @@ namespace gdcm
 /**
  * \brief  Constructor
  */ 
-DicomDirMeta::DicomDirMeta():
+DicomDirMeta::DicomDirMeta(bool empty):
    DicomDirObject()
 {
+   if( !empty )
+   {
+      ListDicomDirStudyElem const &elemList = 
+         Global::GetDicomDirElements()->GetDicomDirMetaElements();
+      FillObject(elemList);
+   }
 }
 
 /**
@@ -90,5 +97,4 @@ void DicomDirMeta::WriteContent(std::ofstream *fp, FileType t)
 // Private
 
 //-----------------------------------------------------------------------------
-
 } // end namespace gdcm
index 9e530882462f140c4642b2fecb328cce63e43115..3274a9af65860fc72b32f082948eae7a9054bdc3 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirMeta.h,v $
   Language:  C++
-  Date:      $Date: 2005/01/16 04:50:41 $
-  Version:   $Revision: 1.16 $
+  Date:      $Date: 2005/01/20 16:16:42 $
+  Version:   $Revision: 1.17 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -32,7 +32,7 @@ namespace gdcm
 class GDCM_EXPORT DicomDirMeta : public DicomDirObject 
 {
 public:
-   DicomDirMeta(); 
+   DicomDirMeta(bool empty=false); 
    ~DicomDirMeta();
 
    virtual void Print(std::ostream &os = std::cout, std::string const & indent = "" );
index c4501ffc2a27222d0321446ca24317c4953cc7f8..a06a2810ef221d9b7e9d95cfea70de7b4d4a8c96 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirObject.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/20 11:09:23 $
-  Version:   $Revision: 1.16 $
+  Date:      $Date: 2005/01/20 16:16:42 $
+  Version:   $Revision: 1.17 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -37,7 +37,6 @@ DicomDirObject::DicomDirObject(int depth)
 {
 }
 
-
 /**
  * \brief   Canonical destructor.
  */
@@ -45,7 +44,6 @@ DicomDirObject::~DicomDirObject()
 {
 }
 
-
 //-----------------------------------------------------------------------------
 // Public
 
@@ -59,7 +57,6 @@ DicomDirObject::~DicomDirObject()
 void DicomDirObject::FillObject(ListDicomDirMetaElem const &elemList)
 {
   // FillObject fills up the SQItem that will be conneected to the right place
-
    ListDicomDirMetaElem::const_iterator it;
    uint16_t tmpGr,tmpEl;
    DictEntry *dictEntry;
@@ -78,5 +75,9 @@ void DicomDirObject::FillObject(ListDicomDirMetaElem const &elemList)
       AddEntry(entry);
    }   
 }   
-} // end namespace gdcm
 
+//-----------------------------------------------------------------------------
+// Private
+
+//-----------------------------------------------------------------------------
+} // end namespace gdcm
index 2c70277b489b2a17721d76661cb1dc8a125da209..361f49645cab7daf8d7ea0d84bfa8f964140305a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirObject.h,v $
   Language:  C++
-  Date:      $Date: 2005/01/20 11:09:23 $
-  Version:   $Revision: 1.13 $
+  Date:      $Date: 2005/01/20 16:16:42 $
+  Version:   $Revision: 1.14 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -41,7 +41,6 @@ typedef std::list<DicomDirObject *> ListContent;
 class GDCM_EXPORT DicomDirObject : public SQItem
 {
 public:
-   void FillObject(ListDicomDirMetaElem const &elemList);
 
 protected:
    // Constructor and destructor are protected to avoid end user to
@@ -49,6 +48,8 @@ protected:
    // NO ! DicomDir needs to instanciate it!
    DicomDirObject(int depth = 1);
    ~DicomDirObject();
+
+   void FillObject(ListDicomDirMetaElem const &elemList);
 };
 } // end namespace gdcm
 
index 035f6492805d66dd078277320d037ebe74948652..cc2ba5b58d937cb7495d0d23e81a52a60a32d4cd 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirPatient.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/20 11:09:23 $
-  Version:   $Revision: 1.29 $
+  Date:      $Date: 2005/01/20 16:16:42 $
+  Version:   $Revision: 1.30 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -31,10 +31,17 @@ namespace gdcm
 /**
  * \brief   Constructor
  */
-DicomDirPatient::DicomDirPatient():
+DicomDirPatient::DicomDirPatient(bool empty):
    DicomDirObject()
 {
+   if( !empty )
+   {
+      ListDicomDirStudyElem const &elemList = 
+         Global::GetDicomDirElements()->GetDicomDirPatientElements();
+      FillObject(elemList);
+   }
 }
+
 /**
  * \brief   Canonical destructor.
  */
@@ -94,12 +101,7 @@ void DicomDirPatient::WriteContent(std::ofstream *fp, FileType t)
  */
 DicomDirStudy* DicomDirPatient::NewStudy()
 {
-   ListDicomDirStudyElem const &elemList = 
-      Global::GetDicomDirElements()->GetDicomDirStudyElements();
-      
    DicomDirStudy *st = new DicomDirStudy();
-   st->FillObject(elemList);
-
    Studies.push_back(st);
    return st; 
 }   
@@ -154,5 +156,4 @@ DicomDirStudy *DicomDirPatient::GetLastStudy()
 // Private
 
 //-----------------------------------------------------------------------------
-
 } // end namespace gdcm
index b3602e5a68460dcfefa66c0a38e381865214313b..d1f9ebfe38f514622b2440275087ef83ea120de9 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirPatient.h,v $
   Language:  C++
-  Date:      $Date: 2005/01/20 11:09:23 $
-  Version:   $Revision: 1.21 $
+  Date:      $Date: 2005/01/20 16:16:42 $
+  Version:   $Revision: 1.22 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -36,7 +36,7 @@ typedef std::list<DicomDirStudy*> ListDicomDirStudy;
 class GDCM_EXPORT DicomDirPatient : public DicomDirObject 
 {
 public:
-   DicomDirPatient(); 
+   DicomDirPatient(bool empty=false); 
    ~DicomDirPatient();
 
    void Print(std::ostream &os = std::cout, std::string const & indent = "" );
index 0abf587e748e0f0b01157f891b54d405b18f2b83..5ae79875455ac04f3d94717dd73c6c7559329294 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirSerie.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/20 11:09:23 $
-  Version:   $Revision: 1.31 $
+  Date:      $Date: 2005/01/20 16:16:42 $
+  Version:   $Revision: 1.32 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -30,10 +30,17 @@ namespace gdcm
 /**
  * \brief  Constructor 
  */
-DicomDirSerie::DicomDirSerie():
+DicomDirSerie::DicomDirSerie(bool empty):
    DicomDirObject()
 {
+   if( !empty )
+   {
+      ListDicomDirSerieElem const &elemList = 
+         Global::GetDicomDirElements()->GetDicomDirSerieElements();   
+      FillObject(elemList);
+   }
 }
+
 /**
  * \brief   Canonical destructor.
  */
@@ -92,12 +99,7 @@ void DicomDirSerie::WriteContent(std::ofstream *fp, FileType t)
  */
 DicomDirImage *DicomDirSerie::NewImage()
 {
-   ListDicomDirImageElem const &elemList = 
-      Global::GetDicomDirElements()->GetDicomDirImageElements();
-
    DicomDirImage *st = new DicomDirImage();
-   st->FillObject(elemList);
-
    Images.push_back(st);
    return st;   
 }
index 751400477ed396ad5f0f7817b1ddf4cc15902424..c87f0037a94ddaeeccb151675abe3bd1af6d0828 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirSerie.h,v $
   Language:  C++
-  Date:      $Date: 2005/01/20 11:09:23 $
-  Version:   $Revision: 1.22 $
+  Date:      $Date: 2005/01/20 16:16:42 $
+  Version:   $Revision: 1.23 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -35,7 +35,7 @@ typedef std::list<DicomDirImage *> ListDicomDirImage;
 class GDCM_EXPORT DicomDirSerie : public DicomDirObject 
 {
 public:
-   DicomDirSerie(); 
+   DicomDirSerie(bool empty=false); 
    ~DicomDirSerie();
 
    void Print( std::ostream &os = std::cout, std::string const & indent = "" );
index 3a552627ab61b00c08d27a445a89329094ce9f74..6c43c6b01dec6eab9b6bcb8a72e49dac36a2e2b4 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirStudy.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/20 11:09:23 $
-  Version:   $Revision: 1.28 $
+  Date:      $Date: 2005/01/20 16:16:42 $
+  Version:   $Revision: 1.29 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -29,10 +29,17 @@ namespace gdcm
 /**
  * \brief  Constructor 
  */
-DicomDirStudy::DicomDirStudy():
+DicomDirStudy::DicomDirStudy(bool empty):
    DicomDirObject()
 {
+   if( !empty )
+   {
+      ListDicomDirStudyElem const &elemList = 
+         Global::GetDicomDirElements()->GetDicomDirStudyElements();
+      FillObject(elemList);
+   }
 }
+
 /**
  * \brief   Canonical destructor.
  */
@@ -94,12 +101,7 @@ void DicomDirStudy::WriteContent(std::ofstream *fp, FileType t)
  */
 DicomDirSerie *DicomDirStudy::NewSerie()
 {
-   ListDicomDirSerieElem const &elemList = 
-      Global::GetDicomDirElements()->GetDicomDirSerieElements();   
-
    DicomDirSerie* st = new DicomDirSerie();
-   st->FillObject(elemList);
-
    Series.push_back(st);
    return st;
 } 
index 57d533af0ef4baa86ac816b9cc500017d0a53a8a..ae743881a0729d44a7bbf3ceddf6a015c4c3c701 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirStudy.h,v $
   Language:  C++
-  Date:      $Date: 2005/01/20 11:09:23 $
-  Version:   $Revision: 1.20 $
+  Date:      $Date: 2005/01/20 16:16:42 $
+  Version:   $Revision: 1.21 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -35,7 +35,7 @@ typedef std::list<DicomDirSerie *> ListDicomDirSerie;
 class GDCM_EXPORT DicomDirStudy : public DicomDirObject
 {
 public:
-   DicomDirStudy(); 
+   DicomDirStudy(bool empty=false); 
    ~DicomDirStudy();
 
    void Print(std::ostream &os = std::cout, std::string const & indent = "" );