Yes, correlation could be negative. But to be honest, I didn&#39;t dig into the vtkImageCorrelation filter, so I don&#39;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.<br>
<br>I am glad to help!<br>Jerome<br><br><div class="gmail_quote">2010/2/7 David Doria <span dir="ltr">&lt;<a href="mailto:daviddoria%2Bvtk@gmail.com">daviddoria+vtk@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="gmail_quote"><div class="im">On Sun, Feb 7, 2010 at 2:49 PM, Jérôme <span dir="ltr">&lt;<a href="mailto:jerome.velut@gmail.com" target="_blank">jerome.velut@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Hi David,<br><br>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.<br>



<br>I printed the correlation output scalar range and noted that max = 5.202e+06. I fixed the pipeline and changed the wiki accordingly.<br><br>Jerome<br><br></blockquote><div class="gmail_quote"><br></div></div>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 &quot;real&quot; images like these, but if your ImageData represents some data other than pixel values it could be the case)</div>

<div class="gmail_quote"><br clear="all">Thanks Jerome,<br><font color="#888888"><br><div>David</div></font></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br>