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

xVict suharev at roentgenprom.ru
Fri May 25 06:27:30 EDT 2018


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


More information about the vtk-developers mailing list