]> Creatis software - gdcm.git/blob - Example/PrintDocument.cxx
User may now choose whether he wants to load Shadow Groups and Sequences or not
[gdcm.git] / Example / PrintDocument.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: PrintDocument.cxx,v $
5   Language:  C++
6   Date:      $Date: 2005/04/05 10:28:59 $
7   Version:   $Revision: 1.12 $
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 "gdcmFile.h"
19 #include "gdcmDebug.h"
20
21 #include <iostream>
22
23 int main(int argc, char *argv[])
24 {
25  
26    gdcm::File *e1= new gdcm::File();;
27    std::string fileName;   
28
29    if (argc == 1) {
30       std::cout << " Usage : "
31                 << argv[0] 
32                 << " filename"
33                 << " printLevel debug "
34                 << "short (=NOSEQ + NOSHADOW)" 
35                 << std::endl;
36        return 0;
37    }
38
39    if (argc > 1) {
40       fileName=argv[1];
41    } else {
42       fileName += GDCM_DATA_ROOT;
43       fileName += "/test.acr";
44    }
45
46    if (argc > 2) 
47    {
48       int level = atoi(argv[2]);   
49       e1->SetPrintLevel(level);
50    }
51
52    if (argc > 3)
53       gdcm::Debug::DebugOn(); 
54
55    if (argc > 4)
56       e1->SetLoadMode(NO_SEQ | NO_SHADOW);
57
58    e1->Load( fileName.c_str() );
59
60    e1->Print();
61       
62    std::cout << "\n\n" << std::endl;        
63    
64    if(e1->IsReadable())
65       std::cout <<std::endl<<fileName<<" is Readable"<<std::endl;
66    else
67       std::cout <<std::endl<<fileName<<" is NOT Readable"<<std::endl;
68    std::cout<<std::flush;
69    delete e1;
70
71    return 0;
72    
73 }