From: tbaudier <thomas.baudier@creatis.insa-lyon.fr>
Date: Thu, 16 Feb 2017 10:24:32 +0000 (+0100)
Subject: Copy transform matrix in clitkNVectorImageTo4DImage tool
X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=b4850f17d2a4a88dcb3541ec5fd789075652b6fe;p=clitk.git

Copy transform matrix in clitkNVectorImageTo4DImage tool
---

diff --git a/tools/clitkNVectorImageTo4DImageGenericFilter.txx b/tools/clitkNVectorImageTo4DImageGenericFilter.txx
index 06d5792..1ea4436 100644
--- a/tools/clitkNVectorImageTo4DImageGenericFilter.txx
+++ b/tools/clitkNVectorImageTo4DImageGenericFilter.txx
@@ -103,17 +103,24 @@ namespace clitk
     spacing.Fill(1);
     typename OutputImageType::PointType origin;
     origin.Fill(0);
+    typename OutputImageType::DirectionType direction;
+    direction.SetIdentity();
     for (unsigned int pixelDim=0; pixelDim<Dimension; ++pixelDim)
     {
       size[pixelDim]=adaptor->GetLargestPossibleRegion().GetSize(pixelDim);
       spacing[pixelDim]=input->GetSpacing()[pixelDim];
       origin[pixelDim]=input->GetOrigin()[pixelDim];
+      for (unsigned int pixelDim2=0; pixelDim2<Dimension; ++pixelDim2)
+      {
+        direction[pixelDim][pixelDim2]=input->GetDirection()[pixelDim][pixelDim2];
+      }
     }
     typename OutputImageType::RegionType region;
     region.SetSize(size);
     region.SetIndex(index);    
     output->SetRegions(region);
     output->SetOrigin(origin);
+    output->SetDirection(direction);
     output->SetSpacing(spacing);
     output->Allocate();
     writer->SetInput(output);