From fc10e8a922cae3f068031f18337c7eb9cd4cd334 Mon Sep 17 00:00:00 2001 From: tbaudier Date: Wed, 14 Sep 2016 12:05:35 +0200 Subject: [PATCH] Debut the creatio of the output in clitkNVectorImageTo4DImage tool --- tools/clitkNVectorImageTo4DImageGenericFilter.txx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/clitkNVectorImageTo4DImageGenericFilter.txx b/tools/clitkNVectorImageTo4DImageGenericFilter.txx index f85b374..932b9ac 100644 --- a/tools/clitkNVectorImageTo4DImageGenericFilter.txx +++ b/tools/clitkNVectorImageTo4DImageGenericFilter.txx @@ -99,15 +99,23 @@ namespace clitk typename OutputImageType::IndexType index; index.Fill(0); typename OutputImageType::SizeType size; - for (unsigned int pixelDim=0; pixelDimGetNumberOfComponentsPerPixel(); ++pixelDim) + size.Fill(input->GetNumberOfComponentsPerPixel()); + typename OutputImageType::SpacingType spacing; + spacing.Fill(1); + typename OutputImageType::PointType origin; + origin.Fill(0); + for (unsigned int pixelDim=0; pixelDimGetLargestPossibleRegion().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); -- 2.47.1