1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDirSerie.cxx,v $
6 Date: $Date: 2005/01/18 14:28:32 $
7 Version: $Revision: 1.30 $
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 //-----------------------------------------------------------------------------
75 * \brief Writes the Object
76 * @param fp ofstream to write to
77 * @param t Type of the File (explicit VR, implicitVR, ...)
79 void DicomDirSerie::WriteContent(std::ofstream *fp, FileType t)
81 DicomDirObject::WriteContent(fp, t);
83 for(ListDicomDirImage::iterator cc = Images.begin();
87 (*cc)->WriteContent( fp, t );
92 * \brief adds a new Image (with the basic elements) to a partially created DICOMDIR
94 DicomDirImage *DicomDirSerie::NewImage()
96 ListDicomDirImageElem const &elemList =
97 Global::GetDicomDirElements()->GetDicomDirImageElements();
99 DicomDirImage *st = new DicomDirImage();
100 FillObject(elemList);
101 Images.push_front(st);
107 * \brief Get the first entry while visiting the DicomDirImage
108 * \return The first DicomDirImage if found, otherwhise NULL
110 DicomDirImage *DicomDirSerie::GetFirstEntry()
112 ItDicomDirImage = Images.begin();
113 if (ItDicomDirImage != Images.end())
114 return *ItDicomDirImage;
119 * \brief Get the next entry while visiting the DicomDirImages
120 * \note : meaningfull only if GetFirstEntry already called
121 * \return The next DicomDirImages if found, otherwhise NULL
123 DicomDirImage *DicomDirSerie::GetNextEntry()
125 gdcmAssertMacro (ItDicomDirImage != Images.end());
128 if (ItDicomDirImage != Images.end())
129 return *ItDicomDirImage;
134 //-----------------------------------------------------------------------------
137 //-----------------------------------------------------------------------------
140 //-----------------------------------------------------------------------------
141 } // end namespace gdcm