]> Creatis software - gdcm.git/blob - src/gdcmDicomDirSerie.cxx
ENH: * Huge cleanup:
[gdcm.git] / src / gdcmDicomDirSerie.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDicomDirSerie.cxx,v $
5   Language:  C++
6   Date:      $Date: 2004/12/03 20:16:57 $
7   Version:   $Revision: 1.23 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*/
18
19 #include "gdcmDicomDirSerie.h"
20 #include "gdcmDicomDirElement.h"
21 #include "gdcmDicomDirImage.h"
22 #include "gdcmGlobal.h"
23
24 namespace gdcm 
25 {
26
27 //-----------------------------------------------------------------------------
28 // Constructor / Destructor
29 /**
30  * \brief  Constructor 
31  * @param ptagHT pointer to the HTable (DicomDirObject needs it 
32  *               to build the DocEntries)
33  */
34 DicomDirSerie::DicomDirSerie():
35    DicomDirObject()
36 {
37 }
38 /**
39  * \brief   Canonical destructor.
40  */
41 DicomDirSerie::~DicomDirSerie() 
42 {
43    for(ListDicomDirImage::iterator cc = Images.begin();
44                                    cc != Images.end();
45                                    ++cc)
46    {
47       delete *cc;
48    }
49 }
50
51 //-----------------------------------------------------------------------------
52 // Print
53 /**
54  * \brief   Prints the Object
55  * @return
56  */ 
57 void DicomDirSerie::Print(std::ostream& os)
58 {
59    os << "SERIE" << std::endl;
60    DicomDirObject::Print(os);
61
62    for(ListDicomDirImage::iterator cc = Images.begin();
63                                    cc != Images.end();
64                                    ++cc)
65    {
66       (*cc)->SetPrintLevel(PrintLevel);
67       (*cc)->Print(os);
68    }
69 }
70
71 //-----------------------------------------------------------------------------
72 // Public
73
74 /**
75  * \brief   Writes the Object
76  * @return
77  */ 
78 void DicomDirSerie::WriteContent(std::ofstream* fp, FileType t)
79 {
80    DicomDirObject::WriteContent(fp, t);
81
82    for(ListDicomDirImage::iterator cc = Images.begin();
83                                    cc!= Images.end();
84                                  ++cc )
85    {
86       (*cc)->WriteContent( fp, t );
87    }
88 }
89
90 /**
91  * \brief   adds a new Image (with the basic elements) to a partially created DICOMDIR
92  */
93 DicomDirImage* DicomDirSerie::NewImage()
94 {
95    ListDicomDirImageElem const & elemList = 
96       Global::GetDicomDirElements()->GetDicomDirImageElements();
97
98    DicomDirImage* st = new DicomDirImage();
99    FillObject(elemList);
100    Images.push_front(st);
101
102    return st;   
103
104 //-----------------------------------------------------------------------------
105 // Protected
106
107 //-----------------------------------------------------------------------------
108 // Private
109
110 //-----------------------------------------------------------------------------
111 } // end namespace gdcm
112
113