1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDirStudy.cxx,v $
6 Date: $Date: 2005/01/18 14:28:32 $
7 Version: $Revision: 1.27 $
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
32 DicomDirStudy::DicomDirStudy():
37 * \brief Canonical destructor.
39 DicomDirStudy::~DicomDirStudy()
41 for(ListDicomDirSerie::iterator cc = Series.begin();
49 //-----------------------------------------------------------------------------
52 * \brief Prints the Object
53 * @param os ostream to write to
54 * @param indent indent
57 void DicomDirStudy::Print(std::ostream &os, std::string const & )
59 os << "STUDY" << std::endl;
60 DicomDirObject::Print(os);
62 for(ListDicomDirSerie::iterator cc = Series.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, ...)
80 void DicomDirStudy::WriteContent(std::ofstream *fp, FileType t)
82 DicomDirObject::WriteContent(fp, t);
84 for(ListDicomDirSerie::iterator cc = Series.begin();
88 (*cc)->WriteContent( fp, t );
93 * \brief adds a new Serie at the begining of the SerieList
94 * of a partially created DICOMDIR
96 DicomDirSerie *DicomDirStudy::NewSerie()
98 ListDicomDirSerieElem const &elemList =
99 Global::GetDicomDirElements()->GetDicomDirSerieElements();
101 DicomDirSerie* st = new DicomDirSerie();
102 FillObject(elemList);
103 Series.push_front(st);
109 * \brief Get the first entry while visiting the DicomDirSeries
110 * \return The first DicomDirSerie if found, otherwhise NULL
112 DicomDirSerie *DicomDirStudy::GetFirstEntry()
114 ItDicomDirSerie = Series.begin();
115 if (ItDicomDirSerie != Series.end())
116 return *ItDicomDirSerie;
121 * \brief Get the next entry while visiting the DicomDirSeries
122 * \note : meaningfull only if GetFirstEntry already called
123 * \return The next DicomDirSerie if found, otherwhise NULL
125 DicomDirSerie *DicomDirStudy::GetNextEntry()
127 gdcmAssertMacro (ItDicomDirSerie != Series.end());
130 if (ItDicomDirSerie != Series.end())
131 return *ItDicomDirSerie;
135 //-----------------------------------------------------------------------------
138 //-----------------------------------------------------------------------------
141 //-----------------------------------------------------------------------------
142 } // end namespace gdcm