]> Creatis software - clitk.git/commitdiff
Add option "spacinglike"
authorDavid Sarrut <david.sarrut@gmail.com>
Fri, 3 Feb 2012 06:57:12 +0000 (07:57 +0100)
committerDavid Sarrut <david.sarrut@creatis.insa-lyon.fr>
Mon, 8 Apr 2013 08:03:56 +0000 (10:03 +0200)
tools/clitkAffineTransform.ggo
tools/clitkAffineTransformGenericFilter.txx

index ff2b19645f0c2da57709af572dcc7cc31fad26bf..dc64bffbb9c1df25d36d2c43beb062825aef317b 100644 (file)
@@ -15,6 +15,7 @@ option "transform_grid" -       "Apply affine transform to input grid for output
 section "Options"
 option "size"          -       "New output size if different from input"       int     no      multiple
 option "spacing"       -       "New output spacing if different from input"    double  no      multiple
+option "spacinglike"   -       "New output spacing like this image"            string  no
 option "origin"                -       "New output origin if different from input"     double  no      multiple
 option "matrix"                m       "Affine matrix (homogene) filename"             string  no
 option "elastix"       e       "Read EulerTransform from elastix output file"  string  no
index 621dfd0eae1b1796bf8decefc988ca282650fd07..dc4d362dd0e50a0c83a4a2d73f4844de5c14cddb 100644 (file)
@@ -214,7 +214,7 @@ namespace clitk
       typename itk::Matrix<double, Dimension+1, Dimension+1> invMatrix( matrix.GetInverse() );
       typename itk::Matrix<double, Dimension, Dimension> invRotMatrix( clitk::GetRotationalPartMatrix(invMatrix) );
       typename itk::Vector<double,Dimension> invTrans =  clitk::GetTranslationPartMatrix(invMatrix);
-
+      
       // Display warning
       if (m_ArgsInfo.spacing_given)
         std::cout << "Warning --spacing ignored (because --transform_grid_flag)" << std::endl;
@@ -285,6 +285,13 @@ namespace clitk
 
     }
 
+    if (m_ArgsInfo.spacinglike_given) {
+      typename InputReaderType::Pointer likeReader=InputReaderType::New();
+      likeReader->SetFileName(m_ArgsInfo.spacinglike_arg);
+      likeReader->Update(); 
+      resampler->SetOutputSpacing( likeReader->GetOutput()->GetSpacing() );
+    }
+
     if (m_ArgsInfo.verbose_flag) {
       std::cout << "Setting the output size to " << resampler->GetSize() << "..." << std::endl;
       std::cout << "Setting the output spacing to " << resampler->GetOutputSpacing() << "..." << std::endl;