[vtkusers] faint png image

Alex Pletzer pletzer at txcorp.com
Sun Aug 10 19:42:42 EDT 2014


I found that adding the following lines 

mapper.SetColorWindow(255)
mapper.SetColorLevel(127.5)

produces the desired effect. 

--

import vtk

reader = vtk.vtkPNGReader()
magn = vtk.vtkImageResize()
mapper = vtk.vtkImageMapper()
actor = vtk.vtkActor2D()

mapper.SetColorWindow(255)
mapper.SetColorLevel(127.5)


reader.SetFileName('solarfs.png')
magn.SetInputConnection(reader.GetOutputPort())
magn.SetOutputDimensions(200, 100, 100)
magn.Update()
mapper.SetInputConnection(magn.GetOutputPort())
actor.SetMapper(mapper)
actor.GetPositionCoordinate().SetCoordinateSystemToNormalizedViewport()

ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
iren = vtk.vtkRenderWindowInteractor()

renWin.AddRenderer(ren)
iren.SetRenderWindow(renWin)
ren.SetBackground(1,1,1)
renWin.SetSize(640, 640)
actor.GetPositionCoordinate().SetValue(0.2, 0.3)
ren.AddActor(actor) # very faint picture

iren.Initialize()
renWin.Render()
iren.Start()






--
View this message in context: http://vtk.1045678.n5.nabble.com/faint-png-image-tp5728160p5728171.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list