[Insight-users] Passing an image to NormalizedCorrelationImageFilter::SetTemplate

David Doria daviddoria at gmail.com
Thu Feb 3 15:18:00 EST 2011


On Thu, Feb 3, 2011 at 3:01 PM, Markus Neuner <neuner.markus at gmx.net> wrote:
> Hi,
>
> The kernel operator needs some caution.
> The extracted image should have a width of 2*radiusX+1 and a height of
> 2*radiusY+1.
>
> You set the radius of the operator to:
>
> kernelOperator.CreateToRadius(extractFilter->GetOutput()->GetLargestPossibleRegion().GetSize());
>
> The kernel is actually much larger than the provided image.
>
> When you set the image size of the ExtractImageFilter to:
>    FloatImageType::SizeType size;
>    size.Fill(101);
> and the radius to:
>    FloatImageType::SizeType radius =
> extractFilter->GetOutput()->GetLargestPossibleRegion().GetSize();
>    radius[0] = (radius[0]-1) / 2;
>    radius[1] = (radius[1]-1) / 2;
>    kernelOperator.CreateToRadius(radius);
> the provided image and the kernel are of the same size, which is
> important and produces the correct result:
>
> ./NormalizedCorrelationImageFilter Gourds.png
> Maximum: [100, 100]
> Minimum: [145, 15]
>
> The maximum is at 100, 100 because the center of the kernel (extracted
> image) is at 50+(101-1)/2.
>
>
> Markus

Excellent! Thanks for the help. I'll update the example soon.

David


More information about the Insight-users mailing list