[vtkusers] Image correlation

Jérôme jerome.velut at gmail.com
Sun Feb 7 16:01:08 EST 2010


Yes, correlation could be negative. But to be honest, I didn't dig into the
vtkImageCorrelation filter, so I don't know exactly how it expresses
correlation... Anyway, if you want to be more generic and handle negative
values, you just have to SetShift( - scalarRange[0] ) before scaling. It
will set the min to zero, then you can scale to max = 255 as I wrote in the
code.

I am glad to help!
Jerome

2010/2/7 David Doria <daviddoria+vtk at gmail.com <daviddoria%2Bvtk at gmail.com>>

> On Sun, Feb 7, 2010 at 2:49 PM, Jérôme <jerome.velut at gmail.com> wrote:
>
>> Hi David,
>>
>> When I change the type of the scalar data -eg. from double to uchar for
>> writing jpeg-, I rather use vtkImageShiftScale. You can set a primary shift
>> (eg. set min to zero) and then scale (eg. set max to 255). I think it has
>> been designed especially for that because it includes a cast-like behaviour:
>> SetOutputScalarTypeToXxxx.
>>
>> I printed the correlation output scalar range and noted that max =
>> 5.202e+06. I fixed the pipeline and changed the wiki accordingly.
>>
>> Jerome
>>
>>
> Beautiful, exactly what I was looking for. I guess my assumption that the
> output was between 0 and 1 was wrong. Also, you mentioned that it is
> assuming the minimum correlation is zero, but that is not true if the pixels
> have negative values, correct? (which would not be the case for "real"
> images like these, but if your ImageData represents some data other than
> pixel values it could be the case)
>
> Thanks Jerome,
>
> David
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100207/ce9106f0/attachment.htm>


More information about the vtkusers mailing list