]> Creatis software - gdcm.git/blob - src/gdcmDicomDirSerie.cxx
* src/ : fix compilation warnings for the Write method (2 different
[gdcm.git] / src / gdcmDicomDirSerie.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDicomDirSerie.cxx,v $
5   Language:  C++
6   Date:      $Date: 2004/11/25 15:46:11 $
7   Version:   $Revision: 1.21 $
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 "gdcmGlobal.h"
22
23 namespace gdcm 
24 {
25
26 //-----------------------------------------------------------------------------
27 // Constructor / Destructor
28 /**
29  * \brief  Constructor 
30  * @param  s  SQ Item holding the elements related to this "SERIE" part
31  * @param ptagHT pointer to the HTable (DicomDirObject needs it 
32  *               to build the DocEntries)
33  */
34 DicomDirSerie::DicomDirSerie(SQItem* s, TagDocEntryHT* ptagHT) :
35    DicomDirObject(ptagHT)
36 {
37    DocEntries = s->GetDocEntries();
38 }
39
40 /**
41  * \brief  Constructor 
42  * @param ptagHT pointer to the HTable (DicomDirObject needs it 
43  *               to build the DocEntries)
44  */
45 DicomDirSerie::DicomDirSerie(TagDocEntryHT* ptagHT):
46    DicomDirObject(ptagHT)
47 {
48 }
49 /**
50  * \brief   Canonical destructor.
51  */
52 DicomDirSerie::~DicomDirSerie() 
53 {
54    for(ListDicomDirImage::iterator cc = Images.begin();
55                                    cc != Images.end();
56                                    ++cc)
57    {
58       delete *cc;
59    }
60 }
61
62 //-----------------------------------------------------------------------------
63 // Print
64 /**
65  * \brief   Prints the Object
66  * @return
67  */ 
68 void DicomDirSerie::Print(std::ostream& os)
69 {
70    os << "SERIE" << std::endl;
71    DicomDirObject::Print(os);
72
73    for(ListDicomDirImage::iterator cc = Images.begin();
74                                    cc != Images.end();
75                                    ++cc)
76    {
77       (*cc)->SetPrintLevel(PrintLevel);
78       (*cc)->Print(os);
79    }
80 }
81
82 //-----------------------------------------------------------------------------
83 // Public
84
85 /**
86  * \brief   Writes the Object
87  * @return
88  */ 
89 void DicomDirSerie::WriteContent(std::ofstream* fp, FileType t)
90 {
91    DicomDirObject::WriteContent(fp, t);
92
93    for(ListDicomDirImage::iterator cc = Images.begin();
94                                    cc!= Images.end();
95                                  ++cc )
96    {
97       (*cc)->WriteContent( fp, t );
98    }
99 }
100
101 /**
102  * \brief   adds a new Image (with the basic elements) to a partially created DICOMDIR
103  */
104 DicomDirImage* DicomDirSerie::NewImage()
105 {
106    ListDicomDirImageElem const & elemList = 
107       Global::GetDicomDirElements()->GetDicomDirImageElements();
108
109    DicomDirImage* st = new DicomDirImage(PtagHT);
110    FillObject(elemList);
111    Images.push_front(st);
112
113    return st;   
114
115 //-----------------------------------------------------------------------------
116 // Protected
117
118 //-----------------------------------------------------------------------------
119 // Private
120
121 //-----------------------------------------------------------------------------
122 } // end namespace gdcm
123
124