1 /*=========================================================================
4 Module: $RCSfile: PrintDicomDir.cxx,v $
6 Date: $Date: 2005/01/11 11:37:12 $
7 Version: $Revision: 1.10 $
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 =========================================================================*/
18 #include "gdcmDocument.h"
19 #include "gdcmDicomDir.h"
20 #include "gdcmValEntry.h"
21 #include "gdcmDicomDirPatient.h"
22 #include "gdcmDicomDirStudy.h"
23 #include "gdcmDicomDirSerie.h"
24 #include "gdcmDicomDirImage.h"
26 #include "gdcmDebug.h"
31 int main(int argc, char* argv[])
35 gdcm::ListDicomDirPatient::const_iterator itPatient;
36 gdcm::ListDicomDirStudy::const_iterator itStudy;
37 gdcm::ListDicomDirSerie::const_iterator itSerie;
38 //gdcm::ListDicomDirImage::const_iterator itImage;
45 file += GDCM_DATA_ROOT;
50 gdcm::Debug::SetDebugOn();
52 e1 = new gdcm::DicomDir( file );
55 int level = atoi(argv[2]);
56 e1->SetPrintLevel(level);
59 if(e1->GetDicomDirPatients().begin() == e1->GetDicomDirPatients().end() )
61 std::cout<<"Empty list"<<std::endl;
65 // Structure use Examples
66 // DON'T REMOVE neither the following code, nor the commented out lines
69 cout << std::endl << std::endl
70 << " = PATIENT List =========================================="
71 << std::endl<< std::endl;
73 itPatient = e1->GetDicomDirPatients().begin();
74 while ( itPatient != e1->GetDicomDirPatients().end() ) { // on degouline la liste de PATIENT
75 std::cout << (*itPatient)->GetEntry(0x0010, 0x0010) << std::endl; // Patient's Name
81 cout << std::endl << std::endl
82 << " = PATIENT/STUDY List ======================================="
83 << std::endl<< std::endl;
85 itPatient = e1->GetDicomDirPatients().begin();
86 while ( itPatient != e1->GetDicomDirPatients().end() ) { // on degouline la liste de PATIENT
87 std::cout << (*itPatient)->GetEntry(0x0010, 0x0010) << std::endl; // Patient's Name
88 itStudy = ((*itPatient)->GetDicomDirStudies()).begin();
89 while (itStudy != (*itPatient)->GetDicomDirStudies().end() ) { // on degouline les STUDY de ce patient
90 std::cout << "--- "<< (*itStudy)->GetEntry(0x0008, 0x1030) << std::endl; // Study Description
99 std::cout << std::endl << std::endl
100 << " = PATIENT/STUDY/SERIE List =================================="
101 << std::endl<< std::endl;
103 itPatient = e1->GetDicomDirPatients().begin();
104 while ( itPatient != e1->GetDicomDirPatients().end() ) { // on degouline la liste de PATIENT
105 // Patient's Name, Patient ID
106 std::cout << "Pat.Name:[" << (*itPatient)->GetEntry(0x0010, 0x0010) <<"]"; // Patient's Name
107 std::cout << " Pat.ID:[";
108 std::cout << (*itPatient)->GetEntry(0x0010, 0x0020) << "]" << std::endl; // Patient ID
109 itStudy = ((*itPatient)->GetDicomDirStudies()).begin();
110 while (itStudy != (*itPatient)->GetDicomDirStudies().end() ) { // on degouline les STUDY de ce patient
111 std::cout << "--- Stud.descr:[" << (*itStudy)->GetEntry(0x0008, 0x1030) << "]";// Study Description
112 std::cout << " Stud.ID:[" << (*itStudy)->GetEntry(0x0020, 0x0010); // Study ID
113 std::cout << "]" << std::endl;
114 itSerie = ((*itStudy)->GetDicomDirSeries()).begin();
115 while (itSerie != (*itStudy)->GetDicomDirSeries().end() ) { // on degouline les SERIES de cette study
116 std::cout << "--- --- Ser.Descr:["<< (*itSerie)->GetEntry(0x0008, 0x103e)<< "]"; // Series Description
117 std::cout << " Ser.nb:[" << (*itSerie)->GetEntry(0x0020, 0x0011); // Series number
118 std::cout << "] Mod.:[" << (*itSerie)->GetEntry(0x0008, 0x0060) << "]"; // Modality
119 std::cout << std::endl;
129 cout << std::endl << std::endl
130 << " = PATIENT/STUDY/SERIE/IMAGE List ============================"
131 << std::endl<< std::endl;
133 itPatient = e1->GetDicomDirPatients().begin();
134 while ( itPatient != e1->GetDicomDirPatients().end() ) { // on degouline la liste de PATIENT
135 std::cout << (*itPatient)->GetEntry(0x0010, 0x0010) << std::endl; // Patient's Name
136 itStudy = ((*itPatient)->GetDicomDirStudies()).begin();
137 while (itStudy != (*itPatient)->GetDicomDirStudies().end() ) { // on degouline les STUDY de ce patient
138 std::cout << "--- "<< (*itStudy)->GetEntry(0x0008, 0x1030) << std::endl; // Study Description
139 itSerie = ((*itStudy)->GetDicomDirSeries()).begin();
140 while (itSerie != (*itStudy)->GetDicomDirSeries().end() ) { // on degouline les SERIES de cette study
141 std::cout << "--- --- "<< (*itSerie)->GetEntry(0x0008, 0x103e) << std::endl; // Serie Description
142 itImage = ((*itSerie)->GetDicomDirImages()).begin();
143 while (itImage != (*itSerie)->GetDicomDirImages().end() ) { // on degouline les SERIES de cette study
144 std::cout << "--- --- --- "<< (*itImage)->GetEntry(0x0004, 0x1500) << std::endl; // File name
156 // cout << std::endl << std::endl
157 // << " = DICOMDIR full content =========================================="
158 // << std::endl<< std::endl;
161 std::cout<<std::flush;