]> Creatis software - gdcm.git/blob - Example/PrintDocument.cxx
ENH: Add license to examples since they belong to gdcm
[gdcm.git] / Example / PrintDocument.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: PrintDocument.cxx,v $
5   Language:  C++
6   Date:      $Date: 2004/11/16 04:26:17 $
7   Version:   $Revision: 1.8 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*/
18 #include <iostream>
19 #include "gdcm.h"
20
21 int main(int argc, char* argv[])
22 {
23  
24    gdcm::Header *e1;
25    std::string fileName;   
26
27    if (argc != 2) {
28       std::cout << " Usage : "
29                 << argv[0] 
30                 << " filename."
31                 << std::endl;
32    }
33
34    if (argc > 1) {
35       fileName=argv[1];
36    } else {
37       fileName += GDCM_DATA_ROOT;
38       fileName += "/test.acr";
39    }
40    
41    e1= new gdcm::Header( fileName.c_str() );
42
43    e1->SetPrintLevel(2);
44    
45    e1->Print();
46       
47    std::cout << "\n\n" << std::endl;        
48    
49    if(e1->IsReadable())
50       std::cout <<std::endl<<fileName<<" is Readable"<<std::endl;
51    else
52       std::cout <<std::endl<<fileName<<" is NOT Readable"<<std::endl;
53    std::cout<<std::flush;
54    delete e1;
55
56    return 0;
57    
58 }