]> Creatis software - gdcm.git/blobdiff - src/gdcmDicomDirSerie.cxx
- now, DicomDir stuff stakes into account the 'new' structure
[gdcm.git] / src / gdcmDicomDirSerie.cxx
index 1272df3cfb88c61c0a50da666a0cc08d67c4a19c..22f4b4d43ef63c539432154fa012416bc8c0b279 100644 (file)
@@ -1,5 +1,21 @@
-// gdcmDicomDirSerie.cxx
-//-----------------------------------------------------------------------------
+/*=========================================================================
+                                                                                
+  Program:   gdcm
+  Module:    $RCSfile: gdcmDicomDirSerie.cxx,v $
+  Language:  C++
+  Date:      $Date: 2004/08/26 15:29:52 $
+  Version:   $Revision: 1.13 $
+                                                                                
+  Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+  l'Image). All rights reserved. See Doc/License.txt or
+  http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details.
+                                                                                
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+                                                                                
+=========================================================================*/
+
 #include "gdcmDicomDirSerie.h"
 #include "gdcmDicomDirElement.h"
 #include "gdcmGlobal.h"
 // Constructor / Destructor
 /**
  * \brief  Constructor 
- * @param  begin  iterator (inside the gdcmParser chained list)
- *                on the first Header Entry (i.e Dicom Element)
- *                related to this "SERIE" part
- * @param  end  iterator  (inside the gdcmParser chained list)
- *              on the last Header Entry (i.e Dicom Element) 
- *              related to this 'SERIE' part
+ * @param  s  SQ Item holding the elements related to this "SERIE" part
  * @param ptagHT pointer to the HTable (gdcmObject needs it 
- *               to build the gdcmHeaderEntries)
- * @param plistEntries pointer to the chained List (gdcmObject needs it 
- *               to build the gdcmHeaderEntries)
+ *               to build the gdcmDocEntries)
  */
-gdcmDicomDirSerie::gdcmDicomDirSerie(ListTag::iterator begin,
-                                     ListTag::iterator end,              
-                                     TagHeaderEntryHT *ptagHT, 
-                                     ListTag *plistEntries ):
-   gdcmObject(begin,end,ptagHT,plistEntries)
+gdcmDicomDirSerie::gdcmDicomDirSerie(gdcmSQItem *s, TagDocEntryHT *ptagHT):
+   gdcmObject(ptagHT)
 {
+   docEntries = s->GetDocEntries();
 }
 
+/**
+ * \brief  Constructor 
+ * @param ptagHT pointer to the HTable (gdcmObject needs it 
+ *               to build the gdcmDocEntries)
+ */
+gdcmDicomDirSerie::gdcmDicomDirSerie(TagDocEntryHT *ptagHT):
+   gdcmObject(ptagHT)
+{
+}
 /**
  * \brief   Canonical destructor.
  */
 gdcmDicomDirSerie::~gdcmDicomDirSerie() 
 {
-   for(ListDicomDirImage::iterator cc = images.begin();cc != images.end();++cc)
+   for(ListDicomDirImage::iterator cc = images.begin();
+                                   cc != images.end();
+                                   ++cc)
    {
       delete *cc;
    }
@@ -46,28 +64,47 @@ gdcmDicomDirSerie::~gdcmDicomDirSerie()
  */ 
 void gdcmDicomDirSerie::Print(std::ostream &os)
 {
-   os<<"SERIE"<<std::endl;
+   os << "SERIE" << std::endl;
    gdcmObject::Print(os);
 
-   for(ListDicomDirImage::iterator cc = images.begin();cc != images.end();++cc)
+   for(ListDicomDirImage::iterator cc = images.begin();
+                                   cc != images.end();
+                                   ++cc)
    {
-      (*cc)->SetPrintLevel(printLevel);
+      (*cc)->SetPrintLevel(PrintLevel);
       (*cc)->Print(os);
    }
 }
 
 //-----------------------------------------------------------------------------
 // Public
+
 /**
- * \brief   adds a new Image to a partially created DICOMDIR
+ * \brief   Writes the Object
+ * @return
+ */ 
+void gdcmDicomDirSerie::Write(FILE *fp, FileType t)
+{
+   gdcmObject::Write(fp, t);
+
+   for(ListDicomDirImage::iterator cc = images.begin();cc!=images.end();++cc)
+   {
+      (*cc)->Write( fp, t );
+   }
+}
+
+/**
+ * \brief   adds a new Image (with the basic elements) to a partially created DICOMDIR
  */
-gdcmDicomDirImage * gdcmDicomDirSerie::NewImage(void) {
-   std::list<gdcmElement> elemList;   
-   elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirImageElements();
-      
+gdcmDicomDirImage * gdcmDicomDirSerie::NewImage()
+{
+   std::list<gdcmElement> elemList = 
+      gdcmGlobal::GetDicomDirElements()->GetDicomDirImageElements();
+
+   gdcmDicomDirImage *st = new gdcmDicomDirImage(PtagHT);
    FillObject(elemList);
-   gdcmDicomDirImage *st = new gdcmDicomDirImage(i, j, ptagHT, plistEntries);
    images.push_front(st);
+
    return st;   
 } 
 //-----------------------------------------------------------------------------