From: David Sarrut Date: Fri, 3 Feb 2012 06:57:12 +0000 (+0100) Subject: Add option "spacinglike" X-Git-Tag: v1.4.0~235 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=9259ccb7138d0a678a677c8fccd283563154036e;p=clitk.git Add option "spacinglike" --- diff --git a/tools/clitkAffineTransform.ggo b/tools/clitkAffineTransform.ggo index ff2b196..dc64bff 100644 --- a/tools/clitkAffineTransform.ggo +++ b/tools/clitkAffineTransform.ggo @@ -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 diff --git a/tools/clitkAffineTransformGenericFilter.txx b/tools/clitkAffineTransformGenericFilter.txx index 621dfd0..dc4d362 100644 --- a/tools/clitkAffineTransformGenericFilter.txx +++ b/tools/clitkAffineTransformGenericFilter.txx @@ -214,7 +214,7 @@ namespace clitk typename itk::Matrix invMatrix( matrix.GetInverse() ); typename itk::Matrix invRotMatrix( clitk::GetRotationalPartMatrix(invMatrix) ); typename itk::Vector 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;