3 #include "gdcmHeaderEntry.h"
4 #include "gdcmDicomDir.h"
5 #include "gdcmConfigure.h"
8 #ifdef GDCM_NO_ANSI_STRING_STREAM
10 # define ostringstream ostrstream
17 #define ostringstream ostrstream
21 int testDicomDir(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 += GDCM_DATA_ROOT;
40 e1 = new gdcmDicomDir(file.c_str());
42 int level = atoi(argv[2]);
43 e1->SetPrintLevel(level);
46 if(e1->GetDicomDirPatients().begin() == e1->GetDicomDirPatients().end() )
48 std::cout<<"Empty list"<<std::endl;
52 // Exemples exploitation de la structure
53 // DON'T REMOVE neither the folowing code, nor the commented out lines
56 cout << std::endl << std::endl
57 << " = Liste des PATIENT =========================================="
58 << std::endl<< std::endl;
61 itPatient = e1->GetDicomDirPatients().begin();
62 while ( itPatient != e1->GetDicomDirPatients().end() ) { // on degouline la liste de PATIENT
63 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
69 cout << std::endl << std::endl
70 << " = Liste des PATIENT/STUDY =========================================="
71 << std::endl<< std::endl;
73 itPatient = e1->GetDicomDirPatients().begin();
74 while ( itPatient != e1->GetDicomDirPatients().end() ) { // on degouline la liste de PATIENT
75 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
76 itStudy = ((*itPatient)->GetDicomDirStudies()).begin();
77 while (itStudy != (*itPatient)->GetDicomDirStudies().end() ) { // on degouline les STUDY de ce patient
78 std::cout << "--- "<< (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << std::endl; // Study Description
85 std::cout << std::endl << std::endl
86 << " = Liste des PATIENT/STUDY/SERIE =========================================="
87 << std::endl<< std::endl;
89 itPatient = e1->GetDicomDirPatients().begin();
90 while ( itPatient != e1->GetDicomDirPatients().end() ) { // on degouline la liste de PATIENT
91 // Patient's Name, Patient ID
92 std::cout << "Pat.Name:[" << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) <<"]";
93 std::cout << " Pat.ID:[";
94 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0020) << "]" << std::endl;
95 itStudy = ((*itPatient)->GetDicomDirStudies()).begin();
96 while (itStudy != (*itPatient)->GetDicomDirStudies().end() ) { // on degouline les STUDY de ce patient
97 std::cout << "--- Stud.descr:[" << (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << "]";// Study Description
98 std::cout << " Stud.ID:["<< (*itStudy)->GetEntryByNumber(0x0020, 0x0010); // Study ID
99 std::cout << "]" << std::endl;
100 itSerie = ((*itStudy)->GetDicomDirSeries()).begin();
101 while (itSerie != (*itStudy)->GetDicomDirSeries().end() ) { // on degouline les SERIES de cette study
102 std::cout << "--- --- Ser.Descr:["<< (*itSerie)->GetEntryByNumber(0x0008, 0x103e)<< "]";// Serie Description
103 std::cout << " Ser.nb:[" << (*itSerie)->GetEntryByNumber(0x0020, 0x0011); // Serie number
104 std::cout << "] Mod.:[" << (*itSerie)->GetEntryByNumber(0x0008, 0x0060) << "]"; // Modality
105 std::cout << std::endl;
115 cout << std::endl << std::endl
116 << " = Liste des PATIENT/STUDY/SERIE/IMAGE ==================================="
117 << std::endl<< std::endl;
119 itPatient = e1->GetDicomDirPatients().begin();
120 while ( itPatient != e1->GetDicomDirPatients().end() ) { // on degouline la liste de PATIENT
121 std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
122 itStudy = ((*itPatient)->GetDicomDirStudies()).begin();
123 while (itStudy != (*itPatient)->GetDicomDirStudies().end() ) { // on degouline les STUDY de ce patient
124 std::cout << "--- "<< (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << std::endl; // Study Description
125 itSerie = ((*itStudy)->GetDicomDirSeries()).begin();
126 while (itSerie != (*itStudy)->GetDicomDirSeries().end() ) { // on degouline les SERIES de cette study
127 std::cout << "--- --- "<< (*itSerie)->GetEntryByNumber(0x0008, 0x103e) << std::endl; // Serie Description
128 itImage = ((*itSerie)->GetDicomDirImages()).begin();
129 while (itImage != (*itSerie)->GetDicomDirImages().end() ) { // on degouline les SERIES de cette study
130 std::cout << "--- --- --- "<< (*itImage)->GetEntryByNumber(0x0004, 0x1500) << std::endl; // File name
141 std::cout << std::endl << std::endl
142 << " = Contenu Complet du DICOMDIR =========================================="
143 << std::endl<< std::endl;
146 std::cout<<std::flush;