1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDirPatient.cxx,v $
6 Date: $Date: 2005/01/18 07:53:42 $
7 Version: $Revision: 1.26 $
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 "gdcmDicomDirPatient.h"
20 #include "gdcmDicomDirElement.h"
21 #include "gdcmGlobal.h"
22 #include "gdcmDicomDirStudy.h"
23 #include "gdcmSQItem.h"
28 //-----------------------------------------------------------------------------
29 // Constructor / Destructor
33 DicomDirPatient::DicomDirPatient():
38 * \brief Canonical destructor.
40 DicomDirPatient::~DicomDirPatient()
42 for(ListDicomDirStudy::const_iterator cc = Studies.begin();
50 //-----------------------------------------------------------------------------
53 * \brief Prints the Object
54 * @param os ostream to write to
56 void DicomDirPatient::Print(std::ostream &os, std::string const & )
58 os << "PATIENT" << std::endl;
59 DicomDirObject::Print(os);
61 for(ListDicomDirStudy::const_iterator cc = Studies.begin();
65 (*cc)->SetPrintLevel(PrintLevel);
71 * \brief Writes the Object
72 * @param fp ofstream to write to
73 * @param t Type of the File (explicit VR, implicitVR, ...)
75 void DicomDirPatient::WriteContent(std::ofstream *fp, FileType t)
77 DicomDirObject::WriteContent(fp, t);
79 for(ListDicomDirStudy::iterator cc = Studies.begin();
83 (*cc)->WriteContent( fp, t );
86 //-----------------------------------------------------------------------------
90 * \brief adds a new Patient at the begining of the PatientList
91 * of a partially created DICOMDIR
93 DicomDirStudy* DicomDirPatient::NewStudy()
95 ListDicomDirStudyElem const &elemList =
96 Global::GetDicomDirElements()->GetDicomDirStudyElements();
98 DicomDirStudy *st = new DicomDirStudy();
99 st->FillObject(elemList);
101 Studies.push_front(st);
106 * \brief Get the first entry while visiting the DicomDirStudy
107 * \return The first DicomDirStudy if found, otherwhise NULL
109 DicomDirStudy *DicomDirPatient::GetFirstEntry()
111 ItDicomDirStudy = Studies.begin();
112 return *ItDicomDirStudy;
116 * \brief Get the next entry while visiting the DicomDirStudies
117 * \note : meaningfull only if GetFirstEntry already called
118 * \return The next DicomDirStudies if found, otherwhise NULL
120 DicomDirStudy *DicomDirPatient::GetNextEntry()
122 if (ItDicomDirStudy != Studies.end())
124 DicomDirStudy *tmp = *ItDicomDirStudy;
133 //-----------------------------------------------------------------------------
136 //-----------------------------------------------------------------------------
139 //-----------------------------------------------------------------------------
141 } // end namespace gdcm