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
50 // DON'T REMOVE neither the folowing code, nor the commented out lines
53 cout << std::endl << std::endl
54 << " = Liste des PATIENT =========================================="
55 << std::endl<< std::endl;
58 itPatient = e1->GetPatients().begin();
59 while ( itPatient != e1->GetPatients().end() ) { // on degouline la liste de PATIENT
60 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
66 cout << std::endl << std::endl
67 << " = Liste des PATIENT/STUDY =========================================="
68 << std::endl<< std::endl;
70 itPatient = e1->GetPatients().begin();
71 while ( itPatient != e1->GetPatients().end() ) { // on degouline la liste de PATIENT
72 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
73 itStudy = ((*itPatient)->GetStudies()).begin();
74 while (itStudy != (*itPatient)->GetStudies().end() ) { // on degouline les STUDY de ce patient
75 std::cout << "--- "<< (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << std::endl; // Stdy Description
82 cout << std::endl << std::endl
83 << " = Liste des PATIENT/STUDY/SERIE =========================================="
84 << std::endl<< std::endl;
86 itPatient = e1->GetPatients().begin();
87 while ( itPatient != e1->GetPatients().end() ) { // on degouline la liste de PATIENT
88 // Patient's Name, Patient ID
89 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) ;
90 std::cout << " ID : ";
91 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0020) << std::endl;
92 itStudy = ((*itPatient)->GetStudies()).begin();
93 while (itStudy != (*itPatient)->GetStudies().end() ) { // on degouline les STUDY de ce patient
94 std::cout << "--- " << (*itStudy)->GetEntryByNumber(0x0008, 0x1030); // Study Description
95 std::cout << " Stud ID: ["<< (*itStudy)->GetEntryByNumber(0x0020, 0x0010); // Study ID
96 std::cout << "]" << std::endl;
97 itSerie = ((*itStudy)->GetSeries()).begin();
98 while (itSerie != (*itStudy)->GetSeries().end() ) { // on degouline les SERIES de cette study
99 std::cout << "--- --- "<< (*itSerie)->GetEntryByNumber(0x0008, 0x103e); // Serie Description
100 std::cout << " Ser nb: [" << (*itSerie)->GetEntryByNumber(0x0020, 0x0011) ; // Serie number
101 std::cout << "] Mod : " << (*itSerie)->GetEntryByNumber(0x0008, 0x0060) << std::endl; // Modality
112 cout << std::endl << std::endl
113 << " = Liste des PATIENT/STUDY/SERIE/IMAGE ==================================="
114 << std::endl<< std::endl;
116 itPatient = e1->GetPatients().begin();
117 while ( itPatient != e1->GetPatients().end() ) { // on degouline la liste de PATIENT
118 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
119 itStudy = ((*itPatient)->GetStudies()).begin();
120 while (itStudy != (*itPatient)->GetStudies().end() ) { // on degouline les STUDY de ce patient
121 std::cout << "--- "<< (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << std::endl; // Study Description
122 itSerie = ((*itStudy)->GetSeries()).begin();
123 while (itSerie != (*itStudy)->GetSeries().end() ) { // on degouline les SERIES de cette study
124 std::cout << "--- --- "<< (*itSerie)->GetEntryByNumber(0x0008, 0x103e) << std::endl; // Serie Description
125 itImage = ((*itSerie)->GetImages()).begin();
126 while (itImage != (*itSerie)->GetImages().end() ) { // on degouline les SERIES de cette study
127 std::cout << "--- --- --- "<< (*itImage)->GetEntryByNumber(0x0004, 0x1500) << std::endl; // File name
138 cout << std::endl << std::endl
139 << " = Contenu Complet du DICOMDIR =========================================="
140 << std::endl<< std::endl;
143 std::cout<<std::flush;