[vtk-developers] Simple, efficent greyscale conversion
David Gobbi
david.gobbi at gmail.com
Fri Mar 25 22:41:46 EDT 2011
Hi Everyone,
A couple days ago I staged a patch for vtkScalarsToColors that makes
it into a concrete class that does a simple rescaling of the input scalars
rather than doing a color mapping. I haven't merged it yet, because I
thought I should ask the other developers first.
Rationale:
1) I hate always having to write out the several lines of code that
are needed to create a greyscale LookupTable. With this change
I can just do vtkScalarsToColors::New() and, voila, I have a
greyscale scalars-to-colors mapper.
2) By calling SetVectorModeToRGBColors(), which I added recently,
I can also have it convert RGB colors of any datatype to unsigned
char colors. Very useful when data uses floats for colors, or if I have
unsigned char colors that I want to window/level.
3) This avoids the NAN check and other expensive bits of the
code in vtkLookupTable, so it provides a more efficent way of
displaying greyscale images than vtkLookupTable. Though I
suspect the difference is slight.
Any thoughts?
- David
More information about the vtk-developers
mailing list