3 #include "gdcmHeaderEntry.h"
4 #include "gdcmDicomDir.h"
8 int TestDicomDir(int argc, char* argv[])
11 ListTag::iterator deb , fin;
13 ListDicomDirPatient::iterator itPatient;
14 ListDicomDirStudy::iterator itStudy;
15 ListDicomDirSerie::iterator itSerie;
16 ListDicomDirImage::iterator itImage;
23 file += GDCM_DATA_ROOT;
27 e1 = new gdcmDicomDir(file.c_str());
29 int level = atoi(argv[2]);
30 e1->SetPrintLevel(level);
33 if(e1->GetDicomDirPatients().begin() == e1->GetDicomDirPatients().end() )
35 std::cout<<"Empty list"<<std::endl;
39 // Simple examples of structure exploitation
40 // DON'T REMOVE neither the folowing code, nor the commented out lines
43 cout << std::endl << std::endl
44 << " = Liste des PATIENT =========================================="
45 << std::endl<< std::endl;
48 itPatient = e1->GetDicomDirPatients().begin();
49 while ( itPatient != e1->GetDicomDirPatients().end() ) { // on degouline la liste de PATIENT
50 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
56 cout << std::endl << std::endl
57 << " = Liste des PATIENT/STUDY =========================================="
58 << std::endl<< std::endl;
60 itPatient = e1->GetDicomDirPatients().begin();
61 while ( itPatient != e1->GetDicomDirPatients().end() ) { // on degouline la liste de PATIENT
62 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
63 itStudy = ((*itPatient)->GetDicomDirStudies()).begin();
64 while (itStudy != (*itPatient)->GetDicomDirStudies().end() ) { // on degouline les STUDY de ce patient
65 std::cout << "--- "<< (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << std::endl; // Study Description
72 std::cout << std::endl << std::endl
73 << " = Liste des PATIENT/STUDY/SERIE =========================================="
74 << std::endl<< std::endl;
76 itPatient = e1->GetDicomDirPatients().begin();
77 while ( itPatient != e1->GetDicomDirPatients().end() ) { // on degouline la liste de PATIENT
78 // Patient's Name, Patient ID
79 std::cout << "Pat.Name:[" << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) <<"]";
80 std::cout << " Pat.ID:[";
81 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0020) << "]" << std::endl;
82 itStudy = ((*itPatient)->GetDicomDirStudies()).begin();
83 while (itStudy != (*itPatient)->GetDicomDirStudies().end() ) { // on degouline les STUDY de ce patient
84 std::cout << "--- Stud.descr:[" << (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << "]";// Study Description
85 std::cout << " Stud.ID:["<< (*itStudy)->GetEntryByNumber(0x0020, 0x0010); // Study ID
86 std::cout << "]" << std::endl;
87 itSerie = ((*itStudy)->GetDicomDirSeries()).begin();
88 while (itSerie != (*itStudy)->GetDicomDirSeries().end() ) { // on degouline les SERIES de cette study
89 std::cout << "--- --- Ser.Descr:["<< (*itSerie)->GetEntryByNumber(0x0008, 0x103e)<< "]";// Serie Description
90 std::cout << " Ser.nb:[" << (*itSerie)->GetEntryByNumber(0x0020, 0x0011); // Serie number
91 std::cout << "] Mod.:[" << (*itSerie)->GetEntryByNumber(0x0008, 0x0060) << "]"; // Modality
92 std::cout << std::endl;
102 cout << std::endl << std::endl
103 << " = Liste des PATIENT/STUDY/SERIE/IMAGE ==================================="
104 << std::endl<< std::endl;
106 itPatient = e1->GetDicomDirPatients().begin();
107 while ( itPatient != e1->GetDicomDirPatients().end() ) { // on degouline la liste de PATIENT
108 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
109 itStudy = ((*itPatient)->GetDicomDirStudies()).begin();
110 while (itStudy != (*itPatient)->GetDicomDirStudies().end() ) { // on degouline les STUDY de ce patient
111 std::cout << "--- "<< (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << std::endl; // Study Description
112 itSerie = ((*itStudy)->GetDicomDirSeries()).begin();
113 while (itSerie != (*itStudy)->GetDicomDirSeries().end() ) { // on degouline les SERIES de cette study
114 std::cout << "--- --- "<< (*itSerie)->GetEntryByNumber(0x0008, 0x103e) << std::endl; // Serie Description
115 itImage = ((*itSerie)->GetDicomDirImages()).begin();
116 while (itImage != (*itSerie)->GetDicomDirImages().end() ) { // on degouline les SERIES de cette study
117 std::cout << "--- --- --- "<< (*itImage)->GetEntryByNumber(0x0004, 0x1500) << std::endl; // File name
128 std::cout << std::endl << std::endl
129 << " = Contenu Complet du DICOMDIR =========================================="
130 << std::endl<< std::endl;
133 std::cout<<std::flush;