X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FPrintFile.cxx;h=7fb53f008fb111d0c1794af753f7e66b0301c2b3;hb=1fe34ecf6db1977790024ac1a0a4ce5be010b9d8;hp=45b1f89cbf2e690c4b67adb782e165819f053f2f;hpb=8670efa6c3fc51c51fe71c2f62af2297a19b07e2;p=gdcm.git diff --git a/Example/PrintFile.cxx b/Example/PrintFile.cxx index 45b1f89c..7fb53f00 100644 --- a/Example/PrintFile.cxx +++ b/Example/PrintFile.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: PrintFile.cxx,v $ Language: C++ - Date: $Date: 2005/02/01 10:34:59 $ - Version: $Revision: 1.27 $ + Date: $Date: 2005/05/02 17:28:15 $ + Version: $Revision: 1.34 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -21,34 +21,43 @@ #include -int main(int argc, char* argv[]) +int main(int argc, char *argv[]) { gdcm::File *e1; gdcm::FileHelper *f1; - std::string fileName; - if (argc != 2) + std::string fileName; + + if (argc == 1) { - std::cout << " usage : PrintDocument fileName printLevel debug" + std::cout << " usage : PrintFile fileName printLevel debug " + << "short (=NOSEQ + NOSHADOW)" << std::endl; + return 0; } + e1 = new gdcm::File(); + if (argc > 1) { fileName=argv[1]; } - else - { - fileName += GDCM_DATA_ROOT; - fileName += "/test.acr"; - } if (argc > 3) gdcm::Debug::DebugOn(); - - e1 = new gdcm::File( fileName.c_str() ); + + if (argc > 4) + e1->SetLoadMode(NO_SEQ | NO_SHADOW); + e1->Load( fileName.c_str() ); + + if ( !e1->IsReadable() ) + { + delete e1; + return 0; + } + f1 = new gdcm::FileHelper(e1); - if (argc > 2) + if (argc > 2) // keep it here (f1 needs to be constructed !) { int level = atoi(argv[2]); f1->SetPrintLevel(level); @@ -105,6 +114,7 @@ int main(int argc, char* argv[]) std::cout <