MantisBT - VTK
View Issue Details
0003579VTK(No Category)public2006-08-03 11:102016-08-12 09:54
Mathieu Malaterre 
Dave DeMarle 
lowminoralways
closedmoved 
 
 
0003579: vtkLookupTable + vtkStructuredPointsWriter
Hi all,

    In case someone already knows the answer I am posting this. Anyway here
is a python script(*) that reproduce the bug. The faulty line is:

    writer.SetFileTypeToBinary()

if a vtkImageData is saved with a vtkLookupTable in binary mode
everything is ok, but when saved as ASCII then the LUT can't be reread
properly. I'll try to find a patch ASAP.

    BTW, does anyone knows why I should explicitely set the TableRange ?

    lut.SetTableRange( 0, 255)

Thanks,
mathieu

##################################################
(*)
import vtk
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()

reader = vtk.vtkBMPReader()
reader.SetFileName( VTK_DATA_ROOT + '/Data/masonry.bmp' )
reader.Allow8BitBMPOn ()
reader.Update()

#construct an image data with a lookup table
image = reader.GetOutput()
image.GetPointData().GetScalars().SetLookupTable( reader.GetLookupTable() )

writer = vtk.vtkStructuredPointsWriter()
writer.SetInput( image )
writer.SetFileName( 'demolut.vtk' )
#writer.SetFileTypeToBinary() #culprit !!!
writer.Write()

reader2 = vtk.vtkStructuredPointsReader()
reader2.SetFileName( 'demolut.vtk' )
reader2.UpdateWholeExtent()

lut = reader2.GetOutput().GetPointData().GetScalars().GetLookupTable()
lut.SetTableRange( 0, 255) #trick ??

map2 = vtk.vtkImageMapToColors ()
map2.SetInput (reader2.GetOutput())
map2.SetLookupTable ( lut )
map2.SetOutputFormatToRGB()

iren = vtk.vtkRenderWindowInteractor();

viewer = vtk.vtkImageViewer2()
viewer.SetInput (map2.GetOutput())
viewer.SetupInteractor (iren)

#make interface
iren.Initialize()
iren.Start()
##################################################
No tags attached.
Issue History
2008-11-30 09:09Mathieu MalaterreAssigned ToMathieu Malaterre => David Cole
2011-01-19 09:54David ColeAssigned ToDavid Cole =>
2011-06-16 13:11Zack GalbreathCategory => (No Category)
2013-06-05 17:57Jean-Christophe Fillion-RobinNote Added: 0030955
2013-06-06 02:51Mathieu MalaterreNote Added: 0030964
2013-07-22 19:21Dave DeMarleNote Added: 0031223
2013-07-22 19:21Dave DeMarleStatusbacklog => expired
2013-07-22 19:21Dave DeMarleAssigned To => Dave DeMarle
2016-08-12 09:54Kitware RobotNote Added: 0036882
2016-08-12 09:54Kitware RobotStatusexpired => closed
2016-08-12 09:54Kitware RobotResolutionopen => moved

Notes
(0030955)
Jean-Christophe Fillion-Robin   
2013-06-05 17:57   
Does the problem still occur with VTK 5.10 ? VTK 6 ?
(0030964)
Mathieu Malaterre   
2013-06-06 02:51   
Steps still reproduce error here. What did you do on your side to avoid the issue ?
(0031223)
Dave DeMarle   
2013-07-22 19:21   
If the bug persists in 6.0.0, please reopen.
(0036882)
Kitware Robot   
2016-08-12 09:54   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current VTK Issues page linked in the banner at the top of this page.