]> Creatis software - gdcm.git/blob - src/gdcmDicomDirPatient.cxx
3cc33bc7e98ddddfc8203582c7258948952e878c
[gdcm.git] / src / gdcmDicomDirPatient.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDicomDirPatient.cxx,v $
5   Language:  C++
6   Date:      $Date: 2004/08/01 02:39:09 $
7   Version:   $Revision: 1.10 $
8                                                                                 
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.htm for details.
12                                                                                 
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.
16                                                                                 
17 =========================================================================*/
18
19 #include "gdcmDicomDirPatient.h"
20 #include "gdcmDicomDirElement.h"
21 #include "gdcmGlobal.h"
22
23 //-----------------------------------------------------------------------------
24 // Constructor / Destructor
25 /**
26  * \ingroup gdcmDicomDirPatient
27  * \brief   Constructor
28  * @param  s SQ Item holding the elements related to this "PATIENT" part
29  * @param ptagHT pointer to the HTable (gdcmObject needs it 
30  *               to build the gdcmHeaderEntries)
31  */
32 gdcmDicomDirPatient::gdcmDicomDirPatient(gdcmSQItem *s, TagDocEntryHT *ptagHT):
33    gdcmObject(ptagHT)
34 {
35    docEntries = s->GetDocEntries();
36 }
37 /**
38  * \ingroup gdcmDicomDirPatient
39  * \brief   Constructor
40  * @param ptagHT pointer to the HTable (gdcmObject needs it 
41  *               to build the gdcmHeaderEntries)
42  */
43 gdcmDicomDirPatient::gdcmDicomDirPatient(TagDocEntryHT *ptagHT):
44    gdcmObject(ptagHT)
45 {
46 }
47 /**
48  * \ingroup gdcmDicomDirPatient
49  * \brief   Canonical destructor.
50  */
51 gdcmDicomDirPatient::~gdcmDicomDirPatient() 
52 {
53    for(ListDicomDirStudy::iterator cc = studies.begin();
54                                    cc != studies.end(); ++cc)
55    {
56       delete *cc;
57    }
58 }
59
60 //-----------------------------------------------------------------------------
61 // Print
62 /**
63  * \ingroup gdcmDicomDirPatient
64  * \brief   Prints the Object
65  * @return
66  */ 
67 void gdcmDicomDirPatient::Print(std::ostream &os)
68 {
69    os << "PATIENT" << std::endl;
70    gdcmObject::Print(os);
71
72    for(ListDicomDirStudy::iterator cc = studies.begin();
73                                    cc != studies.end(); ++cc)
74    {
75       (*cc)->SetPrintLevel(PrintLevel);
76       (*cc)->Print(os);
77    }
78 }
79
80 //-----------------------------------------------------------------------------
81 // Public
82
83 /**
84  * \ingroup gdcmDicomDir
85  * \brief   adds a new Patient at the begining of the PatientList
86  *          of a partially created DICOMDIR
87  */
88 gdcmDicomDirStudy * gdcmDicomDirPatient::NewStudy()
89 {
90    std::list<gdcmElement> elemList = 
91       gdcmGlobal::GetDicomDirElements()->GetDicomDirStudyElements();
92       
93    gdcmDicomDirStudy *st = new gdcmDicomDirStudy( PtagHT );
94    st->FillObject(elemList);
95
96    studies.push_front(st);
97    return st; 
98 }   
99
100 //-----------------------------------------------------------------------------
101 // Protected
102
103 //-----------------------------------------------------------------------------
104 // Private
105
106 //-----------------------------------------------------------------------------