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;
26 ListDicomDirPatient::iterator itPatient;
27 ListDicomDirStudy::iterator itStudy;
28 ListDicomDirSerie::iterator itSerie;
29 ListDicomDirImage::iterator itImage;
36 file = "../gdcmData/DICOMDIR";
38 e1 = new gdcmDicomDir(file.c_str());
40 int level = atoi(argv[2]);
41 e1->SetPrintLevel(level);
44 if(e1->GetDicomDirPatients().begin() == e1->GetDicomDirPatients().end() )
46 std::cout<<"Empty list"<<std::endl;
50 // Exemples exploitation de la structure
51 // DON'T REMOVE neither the folowing code, nor the commented out lines
54 cout << std::endl << std::endl
55 << " = Liste des PATIENT =========================================="
56 << std::endl<< std::endl;
59 itPatient = e1->GetDicomDirPatients().begin();
60 while ( itPatient != e1->GetDicomDirPatients().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->GetDicomDirPatients().begin();
72 while ( itPatient != e1->GetDicomDirPatients().end() ) { // on degouline la liste de PATIENT
73 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
74 itStudy = ((*itPatient)->GetDicomDirStudies()).begin();
75 while (itStudy != (*itPatient)->GetDicomDirStudies().end() ) { // on degouline les STUDY de ce patient
76 std::cout << "--- "<< (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << std::endl; // Study Description
83 cout << std::endl << std::endl
84 << " = Liste des PATIENT/STUDY/SERIE =========================================="
85 << std::endl<< std::endl;
87 itPatient = e1->GetDicomDirPatients().begin();
88 while ( itPatient != e1->GetDicomDirPatients().end() ) { // on degouline la liste de PATIENT
89 // Patient's Name, Patient ID
90 std::cout << "Pat.Name:[" << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) <<"]";
91 std::cout << " Pat.ID:[";
92 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0020) << "]" << std::endl;
93 itStudy = ((*itPatient)->GetDicomDirStudies()).begin();
94 while (itStudy != (*itPatient)->GetDicomDirStudies().end() ) { // on degouline les STUDY de ce patient
95 std::cout << "--- Stud.descr:[" << (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << "]";// Study Description
96 std::cout << " Stud.ID:["<< (*itStudy)->GetEntryByNumber(0x0020, 0x0010); // Study ID
97 std::cout << "]" << std::endl;
98 itSerie = ((*itStudy)->GetDicomDirSeries()).begin();
99 while (itSerie != (*itStudy)->GetDicomDirSeries().end() ) { // on degouline les SERIES de cette study
100 std::cout << "--- --- Ser.Descr:["<< (*itSerie)->GetEntryByNumber(0x0008, 0x103e)<< "]";// Serie Description
101 std::cout << " Ser.nb:[" << (*itSerie)->GetEntryByNumber(0x0020, 0x0011); // Serie number
102 std::cout << "] Mod.:[" << (*itSerie)->GetEntryByNumber(0x0008, 0x0060) << "]"; // Modality
103 std::cout << std::endl;
113 cout << std::endl << std::endl
114 << " = Liste des PATIENT/STUDY/SERIE/IMAGE ==================================="
115 << std::endl<< std::endl;
117 itPatient = e1->GetDicomDirPatients().begin();
118 while ( itPatient != e1->GetDicomDirPatients().end() ) { // on degouline la liste de PATIENT
119 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
120 itStudy = ((*itPatient)->GetDicomDirStudies()).begin();
121 while (itStudy != (*itPatient)->GetDicomDirStudies().end() ) { // on degouline les STUDY de ce patient
122 std::cout << "--- "<< (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << std::endl; // Study Description
123 itSerie = ((*itStudy)->GetDicomDirSeries()).begin();
124 while (itSerie != (*itStudy)->GetDicomDirSeries().end() ) { // on degouline les SERIES de cette study
125 std::cout << "--- --- "<< (*itSerie)->GetEntryByNumber(0x0008, 0x103e) << std::endl; // Serie Description
126 itImage = ((*itSerie)->GetDicomDirImages()).begin();
127 while (itImage != (*itSerie)->GetDicomDirImages().end() ) { // on degouline les SERIES de cette study
128 std::cout << "--- --- --- "<< (*itImage)->GetEntryByNumber(0x0004, 0x1500) << std::endl; // File name
139 cout << std::endl << std::endl
140 << " = Contenu Complet du DICOMDIR =========================================="
141 << std::endl<< std::endl;
144 std::cout<<std::flush;