Write 16bit TiFF with vtk

HI there,
I have a small question and require assistance. I am required to write a .tif file at the end of my image processing pipeline; how do I go about this with vtk ?
Currently, I am calling:
vtkTIFFWriter writer = vtkTIFFWriter.New();
writer.SetInput(colorMap.GetOutput());
writer.SetFileName(“testimage.tif”);
writer.Write();
The result is always 8 bit tiff. Anyone knows how I can write 16 bit tif ?

Thanks

GT

Are you sure that colorMap.GetOutput() is giving you 16-bit data? The TIFF writer needs a 16-bit input in order to produce a 16-bit file.

Also note that vtkLookupTable itself produces 8-bits per component, RGB or RGBA.

Hi David

Thanks for your response as always. Yes, I realized that vtkLookUIpTable produces 8-bits RGB. My data is grey-scale and the only way I could make the vtk TIFF writer to work was to pass it through a vtkImageMapToColors using the vtkLookupTable. Any idea How I can spit out 16-bit RGB instead ?

Thanks

GT

As far as I understand, vtkTIFFWriter should work fine with greyscale data. For 16-bit TIFF, the only requirement is that you convert your data to “unsigned short”. You can do this, for example, with vtkImageShiftScale.