]> Creatis software - gdcm.git/blob - Example/PrintDocument.cxx
* Test/TestWriteRead.cxx and TestReadWrite.cxx merged (because of
[gdcm.git] / Example / PrintDocument.cxx
1 #include <iostream>
2
3 #include "gdcmException.h"
4 #include "gdcmCommon.h"
5
6 #include "gdcmDictEntry.h"
7 #include "gdcmDict.h"
8 #include "gdcmDictSet.h"
9 #include "gdcmHeader.h"
10 #include "gdcmUtil.h"
11 #include "gdcmBinEntry.h"  
12 #include "gdcmDocEntry.h" 
13 #include "gdcmDocEntrySet.h"           
14 #include "gdcmDocument.h"          
15 #include "gdcmElementSet.h"        
16 #include "gdcmSeqEntry.h" 
17 #include "gdcmSQItem.h" 
18 #include "gdcmValEntry.h" 
19
20 int main(int argc, char* argv[])
21 {
22  
23    gdcmHeader *e1;
24    std::string fileName;   
25
26    if (argc != 2) {
27       std::cout << " Usage : " << argv[0] 
28                 << " filename." << std::endl;
29    }
30
31    if (argc > 1) {
32       fileName=argv[1];
33    } else {
34       fileName += GDCM_DATA_ROOT;
35       fileName += "/test.acr";
36    }
37    
38    e1= new gdcmHeader 
39       (fileName.c_str(),false, true);
40
41    e1->SetPrintLevel(2);
42    
43    e1->Print();
44       
45    std::cout << "\n\n" << std::endl;        
46    
47    if(e1->IsReadable())
48       std::cout <<std::endl<<fileName<<" is Readable"<<std::endl;
49    else
50       std::cout <<std::endl<<fileName<<" is NOT Readable"<<std::endl;
51    std::cout<<std::flush;
52    delete e1;
53
54    return 0;
55    
56 }