From 9f0023e9ebaf8ca646681282839175d35eea746b Mon Sep 17 00:00:00 2001 From: tbaudier Date: Wed, 9 Aug 2017 11:35:26 +0200 Subject: [PATCH] Add Direction options in clitkAffineTransform --- tools/clitkAffineTransform.ggo | 5 +---- tools/clitkAffineTransformGenericFilter.txx | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/tools/clitkAffineTransform.ggo b/tools/clitkAffineTransform.ggo index bb74448..8eaedd5 100644 --- a/tools/clitkAffineTransform.ggo +++ b/tools/clitkAffineTransform.ggo @@ -17,6 +17,7 @@ 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 "direction" - "New output direction 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 (combine if multiple)" string no option "rotate" r "Rotation to apply (radians)" double no multiple @@ -30,7 +31,3 @@ option "interpSF" - "Sampling factor if BLUT" int no default="20" option "interpVF" - "Interpolation: 0=NN, 1=Linear, 2=BSpline, 3=BLUT" int no default="1" option "interpVFOrder" - "Order if BLUT or BSpline (0-5)" int no default="3" option "interpVFSF" - "Sampling factor if BLUT" int no default="20" - - - - diff --git a/tools/clitkAffineTransformGenericFilter.txx b/tools/clitkAffineTransformGenericFilter.txx index 93d4357..15baf2d 100644 --- a/tools/clitkAffineTransformGenericFilter.txx +++ b/tools/clitkAffineTransformGenericFilter.txx @@ -281,10 +281,19 @@ namespace clitk outputOrigin[i]=m_ArgsInfo.origin_arg[i]; } else outputOrigin=input->GetOrigin(); + //Direction + typename OutputImageType::DirectionType outputDirection; + if (m_ArgsInfo.direction_given) { + for(unsigned int j=0; j< Dimension; j++) + for(unsigned int i=0; i< Dimension; i++) + outputDirection[j][i]=m_ArgsInfo.direction_arg[i+Dimension*j]; + } else outputDirection=input->GetDirection(); + // Set resampler->SetSize( outputSize ); resampler->SetOutputSpacing( outputSpacing ); resampler->SetOutputOrigin( outputOrigin ); + resampler->SetOutputDirection( outputDirection ); } @@ -315,6 +324,7 @@ namespace clitk std::cout << "Setting the output size to " << resampler->GetSize() << "..." << std::endl; std::cout << "Setting the output spacing to " << resampler->GetOutputSpacing() << "..." << std::endl; std::cout << "Setting the output origin to " << resampler->GetOutputOrigin() << "..." << std::endl; + std::cout << "Setting the output direction to " << resampler->GetOutputDirection() << "..." << std::endl; } resampler->SetInput( input ); @@ -438,6 +448,7 @@ namespace clitk resampler->SetSize( likeReader->GetOutput()->GetLargestPossibleRegion().GetSize() ); resampler->SetOutputSpacing( likeReader->GetOutput()->GetSpacing() ); resampler->SetOutputOrigin( likeReader->GetOutput()->GetOrigin() ); + resampler->SetOutputDirection( likeReader->GetOutput()->GetDirection() ); } else { //Size typename OutputImageType::SizeType outputSize; @@ -463,10 +474,20 @@ namespace clitk } else outputOrigin=input->GetOrigin(); std::cout<<"Setting the origin to "<GetDirection(); + std::cout<<"Setting the direction to "<SetSize( outputSize ); resampler->SetOutputSpacing( outputSpacing ); resampler->SetOutputOrigin( outputOrigin ); + resampler->SetOutputDirection( outputDirection ); } -- 2.47.1