1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDirSerie.cxx,v $
6 Date: $Date: 2005/01/20 11:09:23 $
7 Version: $Revision: 1.31 $
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
33 DicomDirSerie::DicomDirSerie():
38 * \brief Canonical destructor.
40 DicomDirSerie::~DicomDirSerie()
42 for(ListDicomDirImage::iterator cc = Images.begin();
50 //-----------------------------------------------------------------------------
53 * \brief Prints the Object
54 * @param os ostream to write to
55 * @param indent indent
57 void DicomDirSerie::Print(std::ostream &os, std::string const &)
59 os << "SERIE" << std::endl;
60 DicomDirObject::Print(os);
62 for(ListDicomDirImage::iterator cc = Images.begin();
66 (*cc)->SetPrintLevel(PrintLevel);
71 //-----------------------------------------------------------------------------
74 * \brief Writes the Object
75 * @param fp ofstream to write to
76 * @param t Type of the File (explicit VR, implicitVR, ...)
78 void DicomDirSerie::WriteContent(std::ofstream *fp, FileType t)
80 DicomDirObject::WriteContent(fp, t);
82 for(ListDicomDirImage::iterator cc = Images.begin();
86 (*cc)->WriteContent( fp, t );
91 * \brief adds a new Image (with the basic elements) to a partially created DICOMDIR
93 DicomDirImage *DicomDirSerie::NewImage()
95 ListDicomDirImageElem const &elemList =
96 Global::GetDicomDirElements()->GetDicomDirImageElements();
98 DicomDirImage *st = new DicomDirImage();
99 st->FillObject(elemList);
101 Images.push_back(st);
106 * \brief Get the first entry while visiting the DicomDirImage
107 * \return The first DicomDirImage if found, otherwhise NULL
109 DicomDirImage *DicomDirSerie::GetFirstImage()
111 ItImage = Images.begin();
112 if (ItImage != Images.end())
118 * \brief Get the next entry while visiting the DicomDirImages
119 * \note : meaningfull only if GetFirstEntry already called
120 * \return The next DicomDirImages if found, otherwhise NULL
122 DicomDirImage *DicomDirSerie::GetNextImage()
124 gdcmAssertMacro (ItImage != Images.end());
127 if (ItImage != Images.end())
134 * \brief Get the first entry while visiting the DicomDirImage
135 * \return The first DicomDirImage if found, otherwhise NULL
137 DicomDirImage *DicomDirSerie::GetLastImage()
139 ItImage = Images.end();
140 if (ItImage != Images.begin())
148 //-----------------------------------------------------------------------------
151 //-----------------------------------------------------------------------------
154 //-----------------------------------------------------------------------------
155 } // end namespace gdcm