3 #include "gdcmHeaderEntry.h"
4 #include "gdcmDICOMDIR.h"
7 #ifdef GDCM_NO_ANSI_STRING_STREAM
9 # define ostringstream ostrstream
16 #define ostringstream ostrstream
22 void aff(ListTag::iterator deb, ListTag::iterator fin, int nbFFFE)
25 for (ListTag::iterator i= deb; i!= fin; i++)
27 if( (*i)->GetGroup() == 0xfffe)
30 if (count == nbFFFE) break;
32 (*i)->SetPrintLevel(0);
38 int main(int argc, char* argv[])
41 ListTag::iterator deb , fin;
42 ListPatient::iterator itPatient;
43 ListStudy::iterator itStudy;
44 ListSerie::iterator itSerie;
45 ListImage::iterator itImage;
52 file = "../gdcmData/DICOMDIR";
54 e1 = new gdcmDicomDir(file);
56 int level = atoi(argv[2]);
57 e1->SetPrintLevel(level);
60 if(e1->GetPatients().begin() == e1->GetPatients().end() )
62 std::cout<<"Empty list"<<std::endl;
66 // Exemples exploitation de la structure
68 /* cout << std::endl << std::endl
69 << " = Liste des PATIENT =========================================="
70 << std::endl<< std::endl;
73 itPatient = e1->GetPatients().begin();
74 while ( itPatient != e1->GetPatients().end() ) { // on degouline la liste de PATIENT
75 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
80 cout << std::endl << std::endl
81 << " = Liste des PATIENT/STUDY =========================================="
82 << std::endl<< std::endl;
84 itPatient = e1->GetPatients().begin();
85 while ( itPatient != e1->GetPatients().end() ) { // on degouline la liste de PATIENT
86 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
87 itStudy = ((*itPatient)->GetStudies()).begin();
88 while (itStudy != (*itPatient)->GetStudies().end() ) { // on degouline les STUDY de ce patient
89 std::cout << "--- "<< (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << std::endl; // Stdy Description
96 cout << std::endl << std::endl
97 << " = Liste des PATIENT/STUDY/SERIE =========================================="
98 << std::endl<< std::endl;
100 itPatient = e1->GetPatients().begin();
101 while ( itPatient != e1->GetPatients().end() ) { // on degouline la liste de PATIENT
102 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
103 itStudy = ((*itPatient)->GetStudies()).begin();
104 while (itStudy != (*itPatient)->GetStudies().end() ) { // on degouline les STUDY de ce patient
105 std::cout << "--- "<< (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << std::endl; // Study Description
106 itSerie = ((*itStudy)->GetSeries()).begin();
107 while (itSerie != (*itStudy)->GetSeries().end() ) { // on degouline les SERIES de cette study
108 std::cout << "--- --- "<< (*itSerie)->GetEntryByNumber(0x0008, 0x103e) << std::endl; // Serie Description
117 cout << std::endl << std::endl
118 << " = Liste des PATIENT/STUDY/SERIE/IMAGE ==================================="
119 << std::endl<< std::endl;
121 itPatient = e1->GetPatients().begin();
122 while ( itPatient != e1->GetPatients().end() ) { // on degouline la liste de PATIENT
123 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
124 itStudy = ((*itPatient)->GetStudies()).begin();
125 while (itStudy != (*itPatient)->GetStudies().end() ) { // on degouline les STUDY de ce patient
126 std::cout << "--- "<< (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << std::endl; // Study Description
127 itSerie = ((*itStudy)->GetSeries()).begin();
128 while (itSerie != (*itStudy)->GetSeries().end() ) { // on degouline les SERIES de cette study
129 std::cout << "--- --- "<< (*itSerie)->GetEntryByNumber(0x0008, 0x103e) << std::endl; // Serie Description
130 itImage = ((*itSerie)->GetImages()).begin();
131 while (itImage != (*itSerie)->GetImages().end() ) { // on degouline les SERIES de cette study
132 std::cout << "--- --- --- "<< (*itImage)->GetEntryByNumber(0x0004, 0x1500) << std::endl; // File name
143 cout << std::endl << std::endl
144 << " = Contenu Complet du DICOMDIR =========================================="
145 << std::endl<< std::endl;
149 /* itPatient = e1->GetPatients().begin();
150 while ( itPatient != e1->GetPatients().end() ) { // on degouline la liste de PATIENT
151 cout << " = PATIENT ==========================================" << std::endl;
152 deb = (*itPatient)->beginObj;
153 fin = (*((*itPatient)->GetStudies()).begin())->beginObj;
154 e1->SetPrintLevel(2);
157 itStudy = ((*itPatient)->GetStudies()).begin();
158 while (itStudy != (*itPatient)->GetStudies().end() ) { // on degouline les STUDY de ce patient
159 std::cout << " ==== STUDY ==========================================" <<std::endl;
160 deb = (*itStudy)->beginObj;
161 fin = (*((*itStudy)->GetSeries()).begin())->beginObj;
162 //e1->SetPrintLevel(2);
165 itSerie = ((*itStudy)->GetSeries()).begin();
166 while (itSerie != (*itStudy)->GetSeries().end() ) { // on degouline les SERIES de cette study
167 cout << " ======= SERIES ==========================================" << std::endl;
168 deb = (*itSerie)->beginObj;
169 fin = (*((*itSerie)->GetImages()).begin())->beginObj;
170 //e1->SetPrintLevel(2);
173 itImage = ((*itSerie)->GetImages()).begin();
174 while (itImage != (*itSerie)->GetImages().end() ) { // on degouline les IMAGE de cette serie
175 cout << " ========== IMAGE ==========================================" << std::endl;
176 std::cout << "--- --- --- File Name: "<< (*itImage)->GetEntryByNumber(0x0004, 0x1500) << std::endl; // Referenced File