1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDirStudy.cxx,v $
6 Date: $Date: 2005/06/24 10:55:58 $
7 Version: $Revision: 1.37 $
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"
23 #include "gdcmDebug.h"
27 //-----------------------------------------------------------------------------
28 // Constructor / Destructor
31 * \note End user must use : DicomDirPatient::NewStudy()
33 DicomDirStudy::DicomDirStudy(bool empty)
38 ListDicomDirStudyElem const &elemList =
39 Global::GetDicomDirElements()->GetDicomDirStudyElements();
45 * \brief Canonical destructor.
47 DicomDirStudy::~DicomDirStudy()
52 //-----------------------------------------------------------------------------
55 * \brief Writes the Object
56 * @param fp ofstream to write to
57 * @param t Type of the File (explicit VR, implicitVR, ...)
60 void DicomDirStudy::WriteContent(std::ofstream *fp, FileType t)
62 DicomDirObject::WriteContent(fp, t);
64 for(ListDicomDirSerie::iterator cc = Series.begin();
68 (*cc)->WriteContent( fp, t );
73 * \brief adds a new Serie at the beginning of the SerieList
74 * of a partially created DICOMDIR
76 DicomDirSerie *DicomDirStudy::NewSerie()
78 DicomDirSerie *st = new DicomDirSerie();
84 * \brief Remove all series in the study
86 void DicomDirStudy::ClearSerie()
88 for(ListDicomDirSerie::iterator cc = Series.begin();
98 * \brief Get the first entry while visiting the DicomDirSeries
99 * \return The first DicomDirSerie if found, otherwhise NULL
101 DicomDirSerie *DicomDirStudy::GetFirstSerie()
103 ItSerie = Series.begin();
104 if (ItSerie != Series.end())
110 * \brief Get the next entry while visiting the DicomDirSeries
111 * \note : meaningfull only if GetFirstEntry already called
112 * \return The next DicomDirSerie if found, otherwhise NULL
114 DicomDirSerie *DicomDirStudy::GetNextSerie()
116 gdcmAssertMacro (ItSerie != Series.end());
119 if (ItSerie != Series.end())
125 * \brief Get the last entry while visiting the DicomDirSeries
126 * \return The first DicomDirSerie if found, otherwhise NULL
128 DicomDirSerie *DicomDirStudy::GetLastSerie()
130 ItSerie = Series.end();
131 if (ItSerie != Series.begin())
139 //-----------------------------------------------------------------------------
142 //-----------------------------------------------------------------------------
145 //-----------------------------------------------------------------------------
148 * \brief Prints the Object
149 * @param os ostream to write to
150 * @param indent Indentation string to be prepended during printing
153 void DicomDirStudy::Print(std::ostream &os, std::string const & )
155 os << "STUDY" << std::endl;
156 DicomDirObject::Print(os);
158 for(ListDicomDirSerie::iterator cc = Series.begin();
162 (*cc)->SetPrintLevel(PrintLevel);
167 //-----------------------------------------------------------------------------
168 } // end namespace gdcm