1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDirSerie.cxx,v $
6 Date: $Date: 2005/01/28 17:01:29 $
7 Version: $Revision: 1.36 $
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.
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.
17 =========================================================================*/
19 #include "gdcmDicomDirSerie.h"
20 #include "gdcmDicomDirElement.h"
21 #include "gdcmDicomDirImage.h"
22 #include "gdcmGlobal.h"
23 #include "gdcmDebug.h"
28 //-----------------------------------------------------------------------------
29 // Constructor / Destructor
32 * \note End user must use : DicomDirStudy::NewSerie()
34 DicomDirSerie::DicomDirSerie(bool empty):
39 ListDicomDirSerieElem const &elemList =
40 Global::GetDicomDirElements()->GetDicomDirSerieElements();
46 * \brief Canonical destructor.
48 DicomDirSerie::~DicomDirSerie()
53 //-----------------------------------------------------------------------------
56 * \brief Prints the Object
57 * @param os ostream to write to
58 * @param indent Indentation string to be prepended during printing
60 void DicomDirSerie::Print(std::ostream &os, std::string const &)
62 os << "SERIE" << std::endl;
63 DicomDirObject::Print(os);
65 for(ListDicomDirImage::iterator cc = Images.begin();
69 (*cc)->SetPrintLevel(PrintLevel);
74 //-----------------------------------------------------------------------------
77 * \brief Writes the Object
78 * @param fp ofstream to write to
79 * @param t Type of the File (explicit VR, implicitVR, ...)
81 void DicomDirSerie::WriteContent(std::ofstream *fp, FileType t)
83 DicomDirObject::WriteContent(fp, t);
85 for(ListDicomDirImage::iterator cc = Images.begin();
89 (*cc)->WriteContent( fp, t );
94 * \brief adds a new Image (with the basic elements) to a partially created
97 DicomDirImage *DicomDirSerie::NewImage()
99 DicomDirImage *st = new DicomDirImage();
100 Images.push_back(st);
105 * \brief Remove all images in the serie
107 void DicomDirSerie::ClearImage()
109 for(ListDicomDirImage::iterator cc = Images.begin();
119 * \brief Get the first entry while visiting the DicomDirImage
120 * \return The first DicomDirImage if DicomDirserie not empty, otherwhise NULL
122 DicomDirImage *DicomDirSerie::GetFirstImage()
124 ItImage = Images.begin();
125 if (ItImage != Images.end())
131 * \brief Get the next entry while visiting the DicomDirImages
132 * \note : meaningfull only if GetFirstEntry already called
133 * \return The next DicomDirImages if found, otherwhise NULL
135 DicomDirImage *DicomDirSerie::GetNextImage()
137 gdcmAssertMacro (ItImage != Images.end());
140 if (ItImage != Images.end())
145 //-----------------------------------------------------------------------------
148 //-----------------------------------------------------------------------------
151 //-----------------------------------------------------------------------------
152 } // end namespace gdcm