1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDirSerie.cxx,v $
6 Date: $Date: 2005/10/25 14:52:33 $
7 Version: $Revision: 1.39 $
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"
27 //-----------------------------------------------------------------------------
28 // Constructor / Destructor
31 * \note End user must use : DicomDirStudy::NewSerie()
33 DicomDirSerie::DicomDirSerie(bool empty):
38 ListDicomDirSerieElem const &elemList =
39 Global::GetDicomDirElements()->GetDicomDirSerieElements();
45 * \brief Canonical destructor.
47 DicomDirSerie::~DicomDirSerie()
52 //-----------------------------------------------------------------------------
55 * \brief Writes the Object
56 * @param fp ofstream to write to
57 * @param t Type of the File (explicit VR, implicitVR, ...)
59 void DicomDirSerie::WriteContent(std::ofstream *fp, FileType t)
61 DicomDirObject::WriteContent(fp, t);
63 for(ListDicomDirImage::iterator cc = Images.begin();
67 (*cc)->WriteContent( fp, t );
72 * \brief adds a new Image (with the basic elements) to a partially created
75 DicomDirImage *DicomDirSerie::NewImage()
77 DicomDirImage *dd = DicomDirImage::New();
83 * \brief Remove all images in the serie
85 void DicomDirSerie::ClearImage()
87 for(ListDicomDirImage::iterator cc = Images.begin();
97 * \brief Get the first entry while visiting the DicomDirImage
98 * \return The first DicomDirImage if DicomDirserie not empty, otherwhise NULL
100 DicomDirImage *DicomDirSerie::GetFirstImage()
102 ItImage = Images.begin();
103 if (ItImage != Images.end())
109 * \brief Get the next entry while visiting the DicomDirImages
110 * \note : meaningfull only if GetFirstEntry already called
111 * \return The next DicomDirImages if found, otherwhise NULL
113 DicomDirImage *DicomDirSerie::GetNextImage()
115 gdcmAssertMacro (ItImage != Images.end());
118 if (ItImage != Images.end())
123 //-----------------------------------------------------------------------------
126 //-----------------------------------------------------------------------------
129 //-----------------------------------------------------------------------------
132 * \brief Prints the Object
133 * @param os ostream to write to
134 * @param indent Indentation string to be prepended during printing
136 void DicomDirSerie::Print(std::ostream &os, std::string const &)
138 os << "SERIE" << std::endl;
139 DicomDirObject::Print(os);
141 for(ListDicomDirImage::iterator cc = Images.begin();
145 (*cc)->SetPrintLevel(PrintLevel);
150 //-----------------------------------------------------------------------------
151 } // end namespace gdcm