]> Creatis software - gdcm.git/blob - Testing/TestDicomDir.cxx
* FIX : amelioration of code
[gdcm.git] / Testing / TestDicomDir.cxx
1 #include <iostream>
2 #include "gdcm.h"
3 #include "gdcmHeaderEntry.h"
4 #include "gdcmDicomDir.h"
5
6 #include <fstream>
7 #ifdef GDCM_NO_ANSI_STRING_STREAM
8 #  include <strstream>
9 #  define  ostringstream ostrstream
10 # else
11 #  include <sstream>
12 #endif
13 #include <string>
14 #include <iostream>
15
16 #define  ostringstream ostrstream
17 //extern "C"
18
19 using namespace std;
20
21 int main(int argc, char* argv[])
22 {  
23    gdcmDicomDir *e1;
24    ListTag::iterator deb , fin;
25    ListPatient::iterator  itPatient;
26    ListStudy::iterator itStudy;
27    ListSerie::iterator itSerie;
28    ListImage::iterator itImage;
29    TSKey v;
30     
31    std::string file; 
32    if (argc > 1) 
33       file = argv[1];    
34    else 
35       file = "../gdcmData/DICOMDIR";
36       
37    e1 = new gdcmDicomDir(file.c_str());
38         if (argc > 2) {
39            int level = atoi(argv[2]);   
40            e1->SetPrintLevel(level);
41         }
42
43    if(e1->GetPatients().begin() == e1->GetPatients().end() )
44    {
45       std::cout<<"Empty list"<<std::endl;
46       return(1);
47    }
48
49 // DICOM DIR
50    cout << std::endl << std::endl  
51         << " = Contenu Complet du DICOMDIR ==========================================" 
52         << std::endl<< std::endl;       
53    e1->Print();
54    
55    std::cout<<std::flush;
56    delete e1;
57
58    return(0);
59 }