- vtkImageData *output = vtkImageData::New();
- output->SetExtent(target->GetWholeExtent());
- output->SetOrigin(target->GetOrigin());
- output->SetSpacing(target->GetSpacing());
- output->SetScalarTypeToFloat();
- output->AllocateScalars();
+ OutputImageType::Pointer output = OutputImageType::New();
+ {
+ OutputImageType::SizeType::SizeValueType output_array_size[2];
+ output_array_size[0] = target->GetDimensions()[0];
+ output_array_size[1] = target->GetDimensions()[1];
+ OutputImageType::SizeType output_size;
+ output_size.SetSize(output_array_size);
+ output->SetRegions(OutputImageType::RegionType(output_size));
+ output->SetOrigin(target->GetOrigin());
+ output->SetSpacing(target->GetSpacing());
+ output->Allocate();
+ }