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);