1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDirSerie.cxx,v $
6 Date: $Date: 2005/11/29 12:48:46 $
7 Version: $Revision: 1.40 $
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())
124 * \brief Copies all the attributes from an other DocEntrySet
125 * @param set entry to copy from
126 * @remarks The contained DocEntries a not copied, only referenced
128 void DicomDirSerie::Copy(DocEntrySet *set)
130 // Remove all previous childs
133 DicomDirObject::Copy(set);
135 DicomDirSerie *ddEntry = dynamic_cast<DicomDirSerie *>(set);
138 Images = ddEntry->Images;
139 for(ItImage = Images.begin();ItImage != Images.end();++ItImage)
140 (*ItImage)->Register();
144 //-----------------------------------------------------------------------------
147 //-----------------------------------------------------------------------------
150 //-----------------------------------------------------------------------------
153 * \brief Prints the Object
154 * @param os ostream to write to
155 * @param indent Indentation string to be prepended during printing
157 void DicomDirSerie::Print(std::ostream &os, std::string const &)
159 os << "SERIE" << std::endl;
160 DicomDirObject::Print(os);
162 for(ListDicomDirImage::iterator cc = Images.begin();
166 (*cc)->SetPrintLevel(PrintLevel);
171 //-----------------------------------------------------------------------------
172 } // end namespace gdcm