From 3586f5e20dd15a903fa43f40c5827364d27d1851 Mon Sep 17 00:00:00 2001 From: David Sarrut Date: Tue, 14 Jan 2014 08:09:55 +0100 Subject: [PATCH] Add display matrix option --- tools/clitkImageInfo.cxx | 25 ++++++++++++++++++++++++- tools/clitkImageInfo.ggo | 2 +- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/tools/clitkImageInfo.cxx b/tools/clitkImageInfo.cxx index a7c7079..33d80cb 100644 --- a/tools/clitkImageInfo.cxx +++ b/tools/clitkImageInfo.cxx @@ -30,6 +30,7 @@ #include "clitkIO.h" #include "clitkImageCommon.h" #include "clitkCommon.h" +#include "vvImageReader.h" //==================================================================== int main(int argc, char * argv[]) @@ -61,7 +62,29 @@ int main(int argc, char * argv[]) 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; + } + + // 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; diff --git a/tools/clitkImageInfo.ggo b/tools/clitkImageInfo.ggo index 53bdc05..36283d1 100644 --- a/tools/clitkImageInfo.ggo +++ b/tools/clitkImageInfo.ggo @@ -7,4 +7,4 @@ option "config" - "Config file" string no option "long" l "Long line output (1 or 2)" int default = "1" no option "verbose" v "Same as -l 1" flag off option "name" n "Display filename" flag off - +option "matrix" m "Display matrix" flag off -- 2.47.1