]> Creatis software - clitk.git/blobdiff - tools/clitkImageInfo.cxx
Increase number of decimal for fusion and overlay
[clitk.git] / tools / clitkImageInfo.cxx
index c02e819ad5ae2843e33b03c1dc6ff9a1b8993df0..33d80cbf3551bdaae3af0b0934411d9df8e06aa6 100644 (file)
@@ -1,21 +1,20 @@
 /*=========================================================================
-                                                                                
-Program:   clitk
-Module:    $RCSfile: clitkImageInfo.cxx,v $
-Language:  C++
-Date:      $Date: 2010/01/06 13:31:56 $
-Version:   $Revision: 1.1 $
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
 
-Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
-l'Image). All rights reserved. See Doc/License.txt or
-http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
-                                                                                
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE.  See the above copyright notices for more information.
-                                                                             
-=========================================================================*/
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.fr/
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
+  - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
 
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
 /**
    =================================================
    * @file   clitkImageInfo.cxx
@@ -23,12 +22,19 @@ PURPOSE.  See the above copyright notices for more information.
    * @date   02 Jul 2006
    =================================================*/
 
+// itk include
+#include "itkImageIOBase.h"
+
 // clitk include
 #include "clitkImageInfo_ggo.h"
 #include "clitkIO.h"
+#include "clitkImageCommon.h"
+#include "clitkCommon.h"
+#include "vvImageReader.h"
 
 //====================================================================
-int main(int argc, char * argv[]) {
+int main(int argc, char * argv[])
+{
 
   // init command line
   GGO(clitkImageInfo, args_info);
@@ -37,29 +43,50 @@ int main(int argc, char * argv[]) {
   // check arg
   if (args_info.inputs_num == 0) return 0;
 
-  // read Header 
+  // read Header
   for(unsigned int i=0; i<args_info.inputs_num; i++) {
     itk::ImageIOBase::Pointer header = clitk::readImageHeader(args_info.inputs[i]);
     if (header) {
       if (args_info.name_flag) std::cout << "[" << args_info.inputs[i] << "]\t ";
       if (args_info.long_given) {
-       //      std::cout << std::endl;
-       clitk::printImageHeader(header, std::cout, args_info.long_arg);
-      }
-      else {
-       if (args_info.verbose_flag) clitk::printImageHeader(header, std::cout, 1);
-       else {
-         clitk::printImageHeader(header, std::cout, 0);
-         std::cout << std::endl;
-       }
+        //     std::cout << std::endl;
+        clitk::printImageHeader(header, std::cout, args_info.long_arg);
+      } else {
+        if (args_info.verbose_flag) clitk::printImageHeader(header, std::cout, 1);
+        else {
+          clitk::printImageHeader(header, std::cout, 0);
+          std::cout << std::endl;
+        }
       }
     }  // heade null ; non fatal error
-      else {
-       std::cerr << "*** Warning : I could not read '" << args_info.inputs[i] << "' ***" << std::endl;
+    else {
+      std::cerr << "*** Warning : I could not read '" << args_info.inputs[i] << "' ***" << std::endl;
+    }
+
+    if (args_info.matrix_flag) {
+      vvImageReader::Pointer r = vvImageReader::New();
+      r->SetInputFilename(args_info.inputs[i]);
+      r->Update(vvImageReader::IMAGE);
+      vtkMatrix4x4 * m = r->GetOutput()->GetTransform()[0]->GetMatrix();
+      for(int i=0; i<4; i++) {
+        for(int j=0; j<4; j++)
+          std::cout << m->GetElement(i,j) << " ";
+        std::cout << std::endl;
       }
-  }
 
-  // this is the end my friend  
+      // inverse
+      m->Invert();
+      for(int i=0; i<4; i++) {
+        for(int j=0; j<4; j++)
+          std::cout << m->GetElement(i,j) << " ";
+        std::cout << std::endl;
+      }
+
+    }
+  } // end for
+
+
+  // this is the end my friend
   return 0;
 }
 //====================================================================