1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDirPatient.cxx,v $
6 Date: $Date: 2004/10/12 04:35:45 $
7 Version: $Revision: 1.15 $
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"
25 //-----------------------------------------------------------------------------
26 // Constructor / Destructor
29 * @param s SQ Item holding the elements related to this "PATIENT" part
30 * @param ptagHT pointer to the HTable (DicomDirObject needs it
31 * to build the HeaderEntries)
33 DicomDirPatient::DicomDirPatient(SQItem *s, TagDocEntryHT *ptagHT):
34 DicomDirObject(ptagHT)
36 docEntries = s->GetDocEntries();
40 * @param ptagHT pointer to the HTable (DicomDirObject needs it
41 * to build the HeaderEntries)
43 DicomDirPatient::DicomDirPatient(TagDocEntryHT* ptagHT):
44 DicomDirObject(ptagHT)
48 * \brief Canonical destructor.
50 DicomDirPatient::~DicomDirPatient()
52 for(ListDicomDirStudy::iterator cc = studies.begin();
53 cc != studies.end(); ++cc)
59 //-----------------------------------------------------------------------------
62 * \brief Prints the Object
65 void DicomDirPatient::Print(std::ostream& os)
67 os << "PATIENT" << std::endl;
68 DicomDirObject::Print(os);
70 for(ListDicomDirStudy::iterator cc = studies.begin();
71 cc != studies.end(); ++cc)
73 (*cc)->SetPrintLevel(PrintLevel);
79 * \brief Writes the Object
82 void DicomDirPatient::Write(FILE* fp, FileType t)
84 DicomDirObject::Write(fp, t);
86 for(ListDicomDirStudy::iterator cc = studies.begin();cc!=studies.end();++cc)
88 (*cc)->Write( fp, t );
91 //-----------------------------------------------------------------------------
95 * \brief adds a new Patient at the begining of the PatientList
96 * of a partially created DICOMDIR
98 DicomDirStudy* DicomDirPatient::NewStudy()
100 std::list<Element> elemList =
101 Global::GetDicomDirElements()->GetDicomDirStudyElements();
103 DicomDirStudy* st = new DicomDirStudy( PtagHT );
104 st->FillObject(elemList);
106 studies.push_front(st);
110 //-----------------------------------------------------------------------------
113 //-----------------------------------------------------------------------------
116 //-----------------------------------------------------------------------------
118 } // end namespace gdcm