[vtk-developers] Incorrect color function in vtkImageMapToWindowLevelColors with lookupTable

David E DeMarle dave.demarle at kitware.com
Fri May 25 09:39:40 EDT 2018


Can you tell us more about the failure conditions?

I strongly suspect the code is correct. git blame indicates that it has
been doing this scaling and biasing with minor variations since 2000.

Try running the tests locally with your proposed change. Test failures
should indicate use cases of the existing code path.



David E DeMarle
Kitware, Inc.
Principal Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909

On Fri, May 25, 2018 at 6:27 AM, xVict <suharev at roentgenprom.ru> wrote:

> Hi All!
> When vtkImageMapToWindowLevelColors  using lookupTable,
> in the method:
> template <class T>
> void vtkImageMapToWindowLevelColorsExecute(
>   vtkImageMapToWindowLevelColors *self,
>   vtkImageData *inData, T *inPtr,
>   vtkImageData *outData,
>   unsigned char *outPtr,
>   int outExt[6], int id)
>
> in the condition ( line: 323 in master from (<42f7955511> 2018-05-23 [David
> E. DeMarle])):
>
> if ( lookupTable )
>       {
>         lookupTable->MapScalarsThroughTable2(
>           inPtr1,
>           static_cast<unsigned char *>(outPtr1),
>           dataType,extX,numberOfComponents,
>           outputFormat);
>
>         for (idxX = 0; idxX < extX; idxX++)
>
> the for-loop is not needed. It spoils the rgb values expected from the
> lookupTable.
> I don't understand:
>
>           *optr = static_cast<unsigned char>((*optr * ushort_val) >> 8);
>
> gray = linear conversion of values from the specified window level to range
> 0-255
>
> r_out = r * gray / 256
> g_out = g * gray / 256
> b_out = b * gray / 256
>
> I propose to remove this for-loop. I.e., lines: 331 - 367.
> After it for example user's lookuptable correctly applied for imageViwer2.
>
> Sincerely, Victor.
>
>
>
> --
> Sent from: http://vtk.1045678.n5.nabble.com/VTK-Dev-f1251487.html
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
> Follow this link to subscribe/unsubscribe:
> https://vtk.org/mailman/listinfo/vtk-developers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtk-developers/attachments/20180525/3a78ea98/attachment.html>


More information about the vtk-developers mailing list