]> Creatis software - clitk.git/blob - tools/clitkImageInfo.cxx
Initial revision
[clitk.git] / tools / clitkImageInfo.cxx
1 /*=========================================================================
2                                                                                 
3 Program:   clitk
4 Module:    $RCSfile: clitkImageInfo.cxx,v $
5 Language:  C++
6 Date:      $Date: 2010/01/06 13:31:56 $
7 Version:   $Revision: 1.1 $
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
19 /**
20    =================================================
21    * @file   clitkImageInfo.cxx
22    * @author David Sarrut <david.sarrut@creatis.insa-lyon.fr>
23    * @date   02 Jul 2006
24    =================================================*/
25
26 // clitk include
27 #include "clitkImageInfo_ggo.h"
28 #include "clitkIO.h"
29
30 //====================================================================
31 int main(int argc, char * argv[]) {
32
33   // init command line
34   GGO(clitkImageInfo, args_info);
35   CLITK_INIT;
36
37   // check arg
38   if (args_info.inputs_num == 0) return 0;
39
40   // read Header 
41   for(unsigned int i=0; i<args_info.inputs_num; i++) {
42     itk::ImageIOBase::Pointer header = clitk::readImageHeader(args_info.inputs[i]);
43     if (header) {
44       if (args_info.name_flag) std::cout << "[" << args_info.inputs[i] << "]\t ";
45       if (args_info.long_given) {
46         //      std::cout << std::endl;
47         clitk::printImageHeader(header, std::cout, args_info.long_arg);
48       }
49       else {
50         if (args_info.verbose_flag) clitk::printImageHeader(header, std::cout, 1);
51         else {
52           clitk::printImageHeader(header, std::cout, 0);
53           std::cout << std::endl;
54         }
55       }
56     }  // heade null ; non fatal error
57       else {
58         std::cerr << "*** Warning : I could not read '" << args_info.inputs[i] << "' ***" << std::endl;
59       }
60   }
61
62   // this is the end my friend  
63   return 0;
64 }
65 //====================================================================