3 #include "gdcmHeaderEntry.h"
4 #include "gdcmDicomDir.h"
7 #ifdef GDCM_NO_ANSI_STRING_STREAM
9 # define ostringstream ostrstream
16 #define ostringstream ostrstream
21 int main(int argc, char* argv[])
24 ListTag::iterator deb , fin;
25 ListPatient::iterator itPatient;
26 ListStudy::iterator itStudy;
27 ListSerie::iterator itSerie;
28 ListImage::iterator itImage;
35 file = "../gdcmData/DICOMDIR";
37 e1 = new gdcmDicomDir(file.c_str());
39 int level = atoi(argv[2]);
40 e1->SetPrintLevel(level);
43 if(e1->GetPatients().begin() == e1->GetPatients().end() )
45 std::cout<<"Empty list"<<std::endl;
49 // Exemples exploitation de la structure
51 // DON'T REMOVE neither the folowong code, nor the commented out lines
54 cout << std::endl << std::endl
55 << " = Liste des PATIENT =========================================="
56 << std::endl<< std::endl;
59 itPatient = e1->GetPatients().begin();
60 while ( itPatient != e1->GetPatients().end() ) { // on degouline la liste de PATIENT
61 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
67 cout << std::endl << std::endl
68 << " = Liste des PATIENT/STUDY =========================================="
69 << std::endl<< std::endl;
71 itPatient = e1->GetPatients().begin();
72 while ( itPatient != e1->GetPatients().end() ) { // on degouline la liste de PATIENT
73 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
74 itStudy = ((*itPatient)->GetStudies()).begin();
75 while (itStudy != (*itPatient)->GetStudies().end() ) { // on degouline les STUDY de ce patient
76 std::cout << "--- "<< (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << std::endl; // Stdy Description
84 cout << std::endl << std::endl
85 << " = Liste des PATIENT/STUDY/SERIE =========================================="
86 << std::endl<< std::endl;
88 itPatient = e1->GetPatients().begin();
89 while ( itPatient != e1->GetPatients().end() ) { // on degouline la liste de PATIENT
90 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
91 itStudy = ((*itPatient)->GetStudies()).begin();
92 while (itStudy != (*itPatient)->GetStudies().end() ) { // on degouline les STUDY de ce patient
93 std::cout << "--- "<< (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << std::endl; // Study Description
94 itSerie = ((*itStudy)->GetSeries()).begin();
95 while (itSerie != (*itStudy)->GetSeries().end() ) { // on degouline les SERIES de cette study
96 std::cout << "--- --- "<< (*itSerie)->GetEntryByNumber(0x0008, 0x103e) << std::endl; // Serie Description
106 cout << std::endl << std::endl
107 << " = Liste des PATIENT/STUDY/SERIE/IMAGE ==================================="
108 << std::endl<< std::endl;
110 itPatient = e1->GetPatients().begin();
111 while ( itPatient != e1->GetPatients().end() ) { // on degouline la liste de PATIENT
112 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
113 itStudy = ((*itPatient)->GetStudies()).begin();
114 while (itStudy != (*itPatient)->GetStudies().end() ) { // on degouline les STUDY de ce patient
115 std::cout << "--- "<< (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << std::endl; // Study Description
116 itSerie = ((*itStudy)->GetSeries()).begin();
117 while (itSerie != (*itStudy)->GetSeries().end() ) { // on degouline les SERIES de cette study
118 std::cout << "--- --- "<< (*itSerie)->GetEntryByNumber(0x0008, 0x103e) << std::endl; // Serie Description
119 itImage = ((*itSerie)->GetImages()).begin();
120 while (itImage != (*itSerie)->GetImages().end() ) { // on degouline les SERIES de cette study
121 std::cout << "--- --- --- "<< (*itImage)->GetEntryByNumber(0x0004, 0x1500) << std::endl; // File name
135 //What about the META informations?
137 cout << std::endl << std::endl
138 << " = Contenu Complet du DICOMDIR =========================================="
139 << std::endl<< std::endl;
142 std::cout<<std::flush;