1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDirStudy.cxx,v $
6 Date: $Date: 2005/01/18 07:53:42 $
7 Version: $Revision: 1.25 $
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 "gdcmDicomDirStudy.h"
20 #include "gdcmDicomDirElement.h"
21 #include "gdcmGlobal.h"
22 #include "gdcmDicomDirSerie.h"
26 //-----------------------------------------------------------------------------
27 // Constructor / Destructor
31 DicomDirStudy::DicomDirStudy():
36 * \brief Canonical destructor.
38 DicomDirStudy::~DicomDirStudy()
40 for(ListDicomDirSerie::iterator cc = Series.begin();
48 //-----------------------------------------------------------------------------
51 * \brief Prints the Object
52 * @param os ostream to write to
55 void DicomDirStudy::Print(std::ostream &os, std::string const & )
57 os << "STUDY" << std::endl;
58 DicomDirObject::Print(os);
60 for(ListDicomDirSerie::iterator cc = Series.begin();
64 (*cc)->SetPrintLevel(PrintLevel);
69 //-----------------------------------------------------------------------------
73 * \brief Writes the Object
74 * @param fp ofstream to write to
75 * @param t Type of the File (explicit VR, implicitVR, ...)
78 void DicomDirStudy::WriteContent(std::ofstream *fp, FileType t)
80 DicomDirObject::WriteContent(fp, t);
82 for(ListDicomDirSerie::iterator cc = Series.begin();
86 (*cc)->WriteContent( fp, t );
91 * \brief adds a new Serie at the begining of the SerieList
92 * of a partially created DICOMDIR
94 DicomDirSerie *DicomDirStudy::NewSerie()
96 ListDicomDirSerieElem const &elemList =
97 Global::GetDicomDirElements()->GetDicomDirSerieElements();
99 DicomDirSerie* st = new DicomDirSerie();
100 FillObject(elemList);
101 Series.push_front(st);
107 * \brief Get the first entry while visiting the DicomDirSeries
108 * \return The first DicomDirSerie if found, otherwhise NULL
110 DicomDirSerie *DicomDirStudy::GetFirstEntry()
112 ItDicomDirSerie = Series.begin();
113 return *ItDicomDirSerie;
117 * \brief Get the next entry while visiting the DicomDirSeries
118 * \note : meaningfull only if GetFirstEntry already called
119 * \return The next DicomDirSerie if found, otherwhise NULL
121 DicomDirSerie *DicomDirStudy::GetNextEntry()
123 if (ItDicomDirSerie != Series.end())
125 DicomDirSerie *tmp = *ItDicomDirSerie;
134 //-----------------------------------------------------------------------------
137 //-----------------------------------------------------------------------------
140 //-----------------------------------------------------------------------------
141 } // end namespace gdcm