]> Creatis software - clitk.git/commitdiff
Debut the creatio of the output in clitkNVectorImageTo4DImage tool
authortbaudier <thomas.baudier@creatis.insa-lyon.fr>
Wed, 14 Sep 2016 10:05:35 +0000 (12:05 +0200)
committertbaudier <thomas.baudier@creatis.insa-lyon.fr>
Wed, 14 Sep 2016 10:05:35 +0000 (12:05 +0200)
tools/clitkNVectorImageTo4DImageGenericFilter.txx

index f85b374ac670780501b29b5162791bc06fd553f2..932b9acba309a223107b3595f686ca9ab317760b 100644 (file)
@@ -99,15 +99,23 @@ namespace clitk
     typename OutputImageType::IndexType index;
     index.Fill(0);
     typename OutputImageType::SizeType size;
-    for (unsigned int pixelDim=0; pixelDim<input->GetNumberOfComponentsPerPixel(); ++pixelDim)
+    size.Fill(input->GetNumberOfComponentsPerPixel());
+    typename OutputImageType::SpacingType spacing;
+    spacing.Fill(1);
+    typename OutputImageType::PointType origin;
+    origin.Fill(0);
+    for (unsigned int pixelDim=0; pixelDim<Dimension; ++pixelDim)
     {
-      size[pixelDim]=input->GetLargestPossibleRegion().GetSize(pixelDim);
+      size[pixelDim]=adaptor->GetLargestPossibleRegion().GetSize(pixelDim);
+      spacing[pixelDim]=input->GetSpacing()[pixelDim];
+      origin[pixelDim]=input->GetOrigin()[pixelDim];
     }
-    size[Dimension]=input->GetNumberOfComponentsPerPixel();
     typename OutputImageType::RegionType region;
     region.SetSize(size);
     region.SetIndex(index);    
     output->SetRegions(region);
+    output->SetOrigin(origin);
+    output->SetSpacing(spacing);
     output->Allocate();
     writer->SetInput(output);