support for Sigmoid VOI-LUT Function

Hi every one, I am quite new to VTK and the forum.
I am working on building a dicom viewer UI for mammograms (2D xray image of breast) based on VTK and got stucked on a problem of displaying a image with sigmoid voi-lut function (VOI LUT Function (0028,1056) set to ‘SIGMOID’ instead of ‘LINEAR’), which is described in dicom standard
The VOI-LUT is defined as: y = out_range/(1+exp(-4*(x-wc)/ww)), where wc and ww are window center and window width which can be adjusted by users, input x and output y are uint16 numbers between 0-65535. But I failed in finding native support for sigmoid windowing in VTK.
Note that the mammogram images are quite large (~4000*3000 pix) so that I can not iterate through pixels and apply the function. Instead I have to generate an array of length 65536 and apply the LUT to each pixel.
Could anyone give me a hint on how to implement this in VTK? An example with be very helpful.
Thanks very much!

I’m not exactly sure what you are asking but here goes: If you are asking about implementing for performance, then this looks like a simple application of a vtkSMPTools functor (or vtk-m if it’s important to use an accelerator). The array[65536] could be generated and passed as const, applied by each invocation of the functor on the input pixel to produce the output pixel value. Use templated array dispatch for maximum performance.

If this seems too daunting, write a serial version and the community can help you thread it.

If you are using vtk-dicom, its vtkDICOMApplyPalette filter will apply a sigmoid mapping if the VOILUTFunction in the metadata has a value of SIGMOID. This is a multi-threaded filter, so it will take advantage of all the CPU cores in your system. The TestDICOMDisplay example applies this filter to its input image.

Thinking about this some more, the ideal place for a Sigmoid mapping function is vtkLookupTable. It already has a Log10 mapping, and a Sigmoid mapping could be added in much the same way. This would touch several VTK classes (not only the lookup tables, but also the color transfer functions) but the bonus is that there are already VTK filters that can perform a lookup-table mapping with SMP.