[Insight-users] Using ScaleTransform to stretch an image

David Doria daviddoria at gmail.com
Tue Nov 8 15:04:11 EST 2011


On Tue, Nov 8, 2011 at 2:43 PM, Dan Mueller <dan.muel at gmail.com> wrote:
> Hi David,
>
> I think you forgot to set the center of the transform. Try something
> like the following:
>
>  typedef itk::ScaleTransform<double, 2> TransformType;
>  TransformType::Pointer scaleTransform = TransformType::New();
>  itk::FixedArray<float, 2> scale;
>  scale[0] = 1.5;
>  scale[1] = 1.5;
>  scaleTransform->SetScale(scale);
>  TransformType::PointType center;
>  // NOTE: The below code assumes no offset/origin and unity spacing
>  center[0] = image->GetLargestPossibleRegion().GetSize()[0] / 2;
>  center[1] = image->GetLargestPossibleRegion().GetSize()[1] / 2;
>  scaleTransform->SetCenter(center);
>
> HTH
>
> Cheers, Dan

Hm, that makes sense, but it didn't fix it.

Updated code: http://www.itk.org/Wiki/ITK/Examples/WishList/ImageProcessing/ScaleTransform

David


More information about the Insight-users mailing list