1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDirStudy.cxx,v $
6 Date: $Date: 2005/01/28 17:01:29 $
7 Version: $Revision: 1.33 $
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 Prints the Object
56 * @param os ostream to write to
57 * @param indent Indentation string to be prepended during printing
60 void DicomDirStudy::Print(std::ostream &os, std::string const & )
62 os << "STUDY" << std::endl;
63 DicomDirObject::Print(os);
65 for(ListDicomDirSerie::iterator cc = Series.begin();
69 (*cc)->SetPrintLevel(PrintLevel);
74 //-----------------------------------------------------------------------------
77 * \brief Writes the Object
78 * @param fp ofstream to write to
79 * @param t Type of the File (explicit VR, implicitVR, ...)
82 void DicomDirStudy::WriteContent(std::ofstream *fp, FileType t)
84 DicomDirObject::WriteContent(fp, t);
86 for(ListDicomDirSerie::iterator cc = Series.begin();
90 (*cc)->WriteContent( fp, t );
95 * \brief adds a new Serie at the begining of the SerieList
96 * of a partially created DICOMDIR
98 DicomDirSerie *DicomDirStudy::NewSerie()
100 DicomDirSerie* st = new DicomDirSerie();
101 Series.push_back(st);
106 * \brief Remove all series in the study
108 void DicomDirStudy::ClearSerie()
110 for(ListDicomDirSerie::iterator cc = Series.begin();
120 * \brief Get the first entry while visiting the DicomDirSeries
121 * \return The first DicomDirSerie if found, otherwhise NULL
123 DicomDirSerie *DicomDirStudy::GetFirstSerie()
125 ItSerie = Series.begin();
126 if (ItSerie != Series.end())
132 * \brief Get the next entry while visiting the DicomDirSeries
133 * \note : meaningfull only if GetFirstEntry already called
134 * \return The next DicomDirSerie if found, otherwhise NULL
136 DicomDirSerie *DicomDirStudy::GetNextSerie()
138 gdcmAssertMacro (ItSerie != Series.end());
141 if (ItSerie != Series.end())
147 * \brief Get the last entry while visiting the DicomDirSeries
148 * \return The first DicomDirSerie if found, otherwhise NULL
150 DicomDirSerie *DicomDirStudy::GetLastSerie()
152 ItSerie = Series.end();
153 if (ItSerie != Series.begin())
161 //-----------------------------------------------------------------------------
164 //-----------------------------------------------------------------------------
167 //-----------------------------------------------------------------------------
168 } // end namespace gdcm