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

index 06d5792566198e8888c753461f254de72775c595..1ea44362f08a6de6d35bb648df5d68279d73dcd9 100644 (file)
@@ -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);