]> Creatis software - clitk.git/blob - tools/clitkImageInfo.cxx
again
[clitk.git] / tools / clitkImageInfo.cxx
1 /*=========================================================================
2                                                                                 
3 Program:   clitk
4 Language:  C++
5
6 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
7 l'Image). All rights reserved. See Doc/License.txt or
8 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
9                                                                                 
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE.  See the above copyright notices for more information.
13                                                                              
14 =========================================================================*/
15
16 /**
17    =================================================
18    * @file   clitkImageInfo.cxx
19    * @author David Sarrut <david.sarrut@creatis.insa-lyon.fr>
20    * @date   02 Jul 2006
21    =================================================*/
22
23 // clitk include
24 #include "clitkImageInfo_ggo.h"
25 #include "clitkIO.h"
26
27 //====================================================================
28 int main(int argc, char * argv[]) {
29
30   // init command line
31   GGO(clitkImageInfo, args_info);
32   CLITK_INIT;
33
34   // check arg
35   if (args_info.inputs_num == 0) return 0;
36
37   // read Header 
38   for(unsigned int i=0; i<args_info.inputs_num; i++) {
39     itk::ImageIOBase::Pointer header = clitk::readImageHeader(args_info.inputs[i]);
40     if (header) {
41       if (args_info.name_flag) std::cout << "[" << args_info.inputs[i] << "]\t ";
42       if (args_info.long_given) {
43         //      std::cout << std::endl;
44         clitk::printImageHeader(header, std::cout, args_info.long_arg);
45       }
46       else {
47         if (args_info.verbose_flag) clitk::printImageHeader(header, std::cout, 1);
48         else {
49           clitk::printImageHeader(header, std::cout, 0);
50           std::cout << std::endl;
51         }
52       }
53     }  // heade null ; non fatal error
54       else {
55         std::cerr << "*** Warning : I could not read '" << args_info.inputs[i] << "' ***" << std::endl;
56       }
57   }
58
59   // this is the end my friend  
60   return 0;
61 }
62 //====================================================================