3 #include "gdcmDocument.h"
4 #include "gdcmDicomDir.h"
5 #include "gdcmValEntry.h"
11 int main(int argc, char* argv[])
15 ListDicomDirPatient::iterator itPatient;
16 ListDicomDirStudy::iterator itStudy;
17 ListDicomDirSerie::iterator itSerie;
18 ListDicomDirImage::iterator itImage;
25 file += GDCM_DATA_ROOT;
29 e1 = new gdcmDicomDir( file );
32 int level = atoi(argv[2]);
33 e1->SetPrintLevel(level);
36 if(e1->GetDicomDirPatients().begin() == e1->GetDicomDirPatients().end() )
38 std::cout<<"Empty list"<<std::endl;
42 // Structure use Examples
43 // DON'T REMOVE neither the following code, nor the commented out lines
46 cout << std::endl << std::endl
47 << " = PATIENT List =========================================="
48 << std::endl<< std::endl;
50 itPatient = e1->GetDicomDirPatients().begin();
51 while ( itPatient != e1->GetDicomDirPatients().end() ) { // on degouline la liste de PATIENT
52 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
58 cout << std::endl << std::endl
59 << " = PATIENT/STUDY List ======================================="
60 << std::endl<< std::endl;
62 itPatient = e1->GetDicomDirPatients().begin();
63 while ( itPatient != e1->GetDicomDirPatients().end() ) { // on degouline la liste de PATIENT
64 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
65 itStudy = ((*itPatient)->GetDicomDirStudies()).begin();
66 while (itStudy != (*itPatient)->GetDicomDirStudies().end() ) { // on degouline les STUDY de ce patient
67 std::cout << "--- "<< (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << std::endl; // Study Description
76 cout << std::endl << std::endl
77 << " = PATIENT/STUDY/SERIE List =================================="
78 << std::endl<< std::endl;
80 itPatient = e1->GetDicomDirPatients().begin();
81 while ( itPatient != e1->GetDicomDirPatients().end() ) { // on degouline la liste de PATIENT
82 // Patient's Name, Patient ID
83 std::cout << "Pat.Name:[" << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) <<"]"; // Patient's Name
84 std::cout << " Pat.ID:[";
85 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0020) << "]" << std::endl; // Patient ID
86 itStudy = ((*itPatient)->GetDicomDirStudies()).begin();
87 while (itStudy != (*itPatient)->GetDicomDirStudies().end() ) { // on degouline les STUDY de ce patient
88 std::cout << "--- Stud.descr:[" << (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << "]";// Study Description
89 std::cout << " Stud.ID:[" << (*itStudy)->GetEntryByNumber(0x0020, 0x0010); // Study ID
90 std::cout << "]" << std::endl;
91 itSerie = ((*itStudy)->GetDicomDirSeries()).begin();
92 while (itSerie != (*itStudy)->GetDicomDirSeries().end() ) { // on degouline les SERIES de cette study
93 std::cout << "--- --- Ser.Descr:["<< (*itSerie)->GetEntryByNumber(0x0008, 0x103e)<< "]"; // Series Description
94 std::cout << " Ser.nb:[" << (*itSerie)->GetEntryByNumber(0x0020, 0x0011); // Series number
95 std::cout << "] Mod.:[" << (*itSerie)->GetEntryByNumber(0x0008, 0x0060) << "]"; // Modality
96 std::cout << std::endl;
106 cout << std::endl << std::endl
107 << " = PATIENT/STUDY/SERIE/IMAGE List ============================"
108 << std::endl<< std::endl;
110 itPatient = e1->GetDicomDirPatients().begin();
111 while ( itPatient != e1->GetDicomDirPatients().end() ) { // on degouline la liste de PATIENT
112 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
113 itStudy = ((*itPatient)->GetDicomDirStudies()).begin();
114 while (itStudy != (*itPatient)->GetDicomDirStudies().end() ) { // on degouline les STUDY de ce patient
115 std::cout << "--- "<< (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << std::endl; // Study Description
116 itSerie = ((*itStudy)->GetDicomDirSeries()).begin();
117 while (itSerie != (*itStudy)->GetDicomDirSeries().end() ) { // on degouline les SERIES de cette study
118 std::cout << "--- --- "<< (*itSerie)->GetEntryByNumber(0x0008, 0x103e) << std::endl; // Serie Description
119 itImage = ((*itSerie)->GetDicomDirImages()).begin();
120 while (itImage != (*itSerie)->GetDicomDirImages().end() ) { // on degouline les SERIES de cette study
121 std::cout << "--- --- --- "<< (*itImage)->GetEntryByNumber(0x0004, 0x1500) << std::endl; // File name
133 // cout << std::endl << std::endl
134 // << " = DICOMDIR full content =========================================="
135 // << std::endl<< std::endl;
138 std::cout<<std::flush;