<div dir="ltr"><div><div><div>Hi Ale,<br><br></div>I copied the .h and .cxx files for vtkImageMapToWindowLevelColors into a new<br>class, applied the patch, and added it to my application which links to VTK: no<br>need to alter VTK source or re-build.<br>
</div><br></div>Dean<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 18, 2013 at 4:43 AM, Alessandro <span dir="ltr"><<a href="mailto:notinmyhead@gmail.com" target="_blank">notinmyhead@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
thanks for the answer! So, if I'm not wrong, all I need to do is re-build the library applying the patch in advance?<br>
<br>
Do you think to submit this patch to vtk repository to include it in further vtk versions?<br>
<br>
Thank,<br>
Ale<br>
<br>
Il giorno 17/apr/2013, alle ore 15.01, Dean Inglis ha scritto:<br>
<div class="HOEnZb"><div class="h5"><br>
> Hi Alessandro,<br>
><br>
> for unsigned char 3 component images, I wrote a customized version of vtkImageMapToWindowLevelColors to work on multi-component images. In the unmodified<br>
> (vtk) version of this class, only the first component of multi-component images is modified, as described in the class documentation:<br>
><br>
> "The vtkImageMapToWindowLevelColors filter will take an input image of any valid scalar type, and map the first component of the image through a lookup table. This resulting color will be modulated with value obtained by a window / level operation. The result is an image of type VTK_UNSIGNED_CHAR. If the lookup table is not set, or is set to NULL, then the input data will be passed through if it is already of type UNSIGNED_CHAR."<br>
><br>
> here are the mods to lines 366 to 401 of vtkImageMapToWindowLevelColors.cxx in VTK 5.10<br>
><br>
> 364 else<br>
> 365 {<br>
> 366 for (idxX = 0; idxX < extX; idxX++)<br>
> 367 {<br>
> 368 for(int j = 0; j < numberOfComponents; ++j )<br>
> 369 {<br>
> 370 if( j == (numberOfComponents - 1 ) &&<br>
> 371 (outputFormat == VTK_LUMINANCE_ALPHA ||<br>
> 372 outputFormat == VTK_RGBA) )<br>
> 373 {<br>
> 374 *(optr) = 255;<br>
> 375 }<br>
> 376 else<br>
> 377 {<br>
> 378 if (*iptr <= lower)<br>
> 379 {<br>
> 380 result_val = lower_val;<br>
> 381 }<br>
> 382 else if (*iptr >= upper)<br>
> 383 {<br>
> 384 result_val = upper_val;<br>
> 385 }<br>
> 386 else<br>
> 387 {<br>
> 388 result_val = static_cast<unsigned char>((*iptr + shift)*scale);<br>
> 389 }<br>
> 390 *optr = result_val;<br>
> 391 }<br>
> 392 iptr++;<br>
> 393 optr++;<br>
> 394 }<br>
> 395 }<br>
> 396 }<br>
><br>
><br>
> regards,<br>
> Dean<br>
><br>
><br>
><br>
> On Tue, Apr 16, 2013 at 5:02 PM, Alessandro <<a href="mailto:notinmyhead@gmail.com">notinmyhead@gmail.com</a>> wrote:<br>
> Hi,<br>
><br>
> I'm trying to apply Brightness and Contrast to a blended image, created from a Grey Image and a Color one. I set brightness and contrast via vtkImageViewer2 SetColorWindow and SetColorLevel methods but it doesn't work on the blended one: as soon as I set one of them, the image becomes a Grey one.<br>
><br>
> Any suggestion?<br>
><br>
> Thanks,<br>
> Ale<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>
<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>
</div></div></blockquote></div><br></div>