[Insight-users] Passing an image to NormalizedCorrelationImageFilter::SetTemplate
Markus Neuner
neuner.markus at gmx.net
Thu Feb 3 15:01:24 EST 2011
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
On 03.02.2011 17:14, David Doria wrote:
> On Thu, Feb 3, 2011 at 9:52 AM, Markus Neuner <neuner.markus at gmx.net> wrote:
>
>> Hi David,
>>
>> You need to generate the kernel image before passing it to the operator
>> with:
>> extractFilter->Update();
>> and you must generate the kernel with:
>> UnsignedCharImageType::SizeType radius;
>> radius[0] = 10;
>> radius[1] = 10;
>> kernelOperator.CreateToRadius(radius);
>> Then it should work.
>> NOTE: The radius should match your extracted image, here it is chosen to be
>> 10 as an example.
>>
>> Attached is a working example where the VTK stuff was stripped.
>>
>> Cheers, Markus
>>
> Hi Markus,
>
> Thank you for addressing this long standing issue! That seems to have
> helped - the output is no longer blank - but I'm having trouble
> interpreting it.
>
> I ran this:
> http://www.vtk.org/Wiki/ITK/Examples/Broken/Images/NormalizedCorrelationImageFilter
>
> with the Gourd image:
> http://gitorious.org/itkwikiexamples/itkwikiexamples/blobs/master/Testing/Data/Gourds.png
>
> Since I extracted the 100x100 patch from location (50,50), I expected
> the maximum (or minimum?) of the correlation filter output to be
> (50,50) (or at least (100,100) if it did some centering or something).
>
> Instead, the output was:
> Maximum: [639, 479]
> Minimum: [633, 265]
>
> Any thoughts?
>
> Thanks,
>
> David
>
>
More information about the Insight-users
mailing list