]> Creatis software - clitk.git/commitdiff
Copy transform matrix in clitk4DImageToNVectorImage tool
authortbaudier <thomas.baudier@creatis.insa-lyon.fr>
Thu, 16 Feb 2017 10:34:38 +0000 (11:34 +0100)
committertbaudier <thomas.baudier@creatis.insa-lyon.fr>
Thu, 16 Feb 2017 10:34:38 +0000 (11:34 +0100)
tools/clitk4DImageToNVectorImageGenericFilter.txx

index 554cec75ca33945d80ae6696eda94fab6bccc24c..1f8f3ebaee1408b9652c373658030b666cf4ff53 100644 (file)
@@ -97,9 +97,15 @@ namespace clitk
 
     extractFilter->SetInput(input);
     typename InputImageType::SizeType size;
+    typename OutputImageType::DirectionType direction;
+    direction.SetIdentity();
     for (unsigned int nbDimension=0; nbDimension<Dimension-1; ++nbDimension)
     {
         size[nbDimension] = input->GetLargestPossibleRegion().GetSize(nbDimension);
+        for (unsigned int pixelDim2=0; pixelDim2<Dimension-1; ++pixelDim2)
+        {
+          direction[nbDimension][pixelDim2]=input->GetDirection()[nbDimension][pixelDim2];
+        }
     }
     size[Dimension-1] = 0;
     typename MedianImageType::Pointer tempImage = MedianImageType::New();
@@ -124,7 +130,10 @@ namespace clitk
 
     imageToVectorImageFilter->Update();
 
-    // Output
+    // Copy transform matrix
+    imageToVectorImageFilter->GetOutput()->SetDirection(direction);
+
+    //Output
     writer->SetInput(imageToVectorImageFilter->GetOutput());
     writer->SetFileName(fileName);
     writer->Update();