[vtkusers] Rendering 16 Bit microscopy Data with one LUT and TF per channel into one volume with color mixing
j-P
cervellone at gmail.com
Tue Jul 10 07:08:31 EDT 2012
Here is the code btw
append = vtk.vtkImageAppendComponents()
append.SetInputConnection(red.GetOutputPort())
append.AddInputConnection(green.GetOutputPort())
append.AddInputConnection(blue.GetOutputPort())
append.Update()
mapper = vtk.vtkFixedPointVolumeRayCastMapper() #always look w which mappser
suits best
#mapper.SetInput(itk2vtk.GetOutput())
#mapper.SetInput(reader.GetOutput())
mapper.SetInput(append.GetOutput())
# volume properties
volprop = vtk.vtkVolumeProperty()
volprop.ShadeOn()
volprop.SetInterpolationTypeToLinear()
volprop.IndependentComponentsOn()
opacityTF = vtk.vtkPiecewiseFunction()
opacityTF.AddPoint( 0.0, 0.0 )
opacityTF.AddPoint( 1500.0, 0.0 )
opacityTF.AddPoint( 65535.0, 128.0 )
volprop.SetScalarOpacity(0,opacityTF)
colourTF = vtk.vtkColorTransferFunction()
colourTF.AddRGBPoint( 0.0, 0.0, 0.0, 0.0 )
colourTF.AddRGBPoint( 2000.0, 0.0, 0.0, 128.0 )
colourTF.AddRGBPoint( 65535.0, 0.0, 0.0, 256.0 )
volprop.SetColor(0,colourTF)
opacityTF = vtk.vtkPiecewiseFunction()
opacityTF.AddPoint( 0.0, 0.0 )
opacityTF.AddPoint( 1500.0, 0.0 )
opacityTF.AddPoint( 65535.0, 128.0 )
volprop.SetScalarOpacity(1,opacityTF)
# opacityTF = vtk.vtkPiecewiseFunction()
# opacityTF.AddPoint( 0.0, 0.0 )
# opacityTF.AddPoint( 1500.0, 0.0 )
# opacityTF.AddPoint( 65535.0, 180.0 )
# volprop.SetColor(1,opacityTF)
colourTF = vtk.vtkColorTransferFunction()
colourTF.AddRGBPoint( 0.0, 0.0, 0.0, 0.0 )
colourTF.AddRGBPoint( 2000.0, 0.0, 128.0, 0.0 )
colourTF.AddRGBPoint( 65535.0, 0.0, 256.0, 0.0 )
volprop.SetColor(1,colourTF)
opacityTF = vtk.vtkPiecewiseFunction()
opacityTF.AddPoint( 0.0, 0.0 )
opacityTF.AddPoint( 1500.0, 0.0 )
opacityTF.AddPoint( 65535.0, 128.0 )
volprop.SetScalarOpacity(2,opacityTF)
colourTF = vtk.vtkColorTransferFunction()
colourTF.AddRGBPoint( 0.0, 0.0, 0.0, 0.0 )
colourTF.AddRGBPoint( 2000.0, 128.0, 0.0, 0.0 )
colourTF.AddRGBPoint( 65535.0, 256.0, 0.0, 0.0 )
volprop.SetColor(2,colourTF)
# opacityTF = vtk.vtkPiecewiseFunction()
# opacityTF.AddPoint( 0.0, 0.0 )
# opacityTF.AddPoint( 128.0, 0.0 )
# opacityTF.AddPoint( 255.0, 255.0 )
# volprop.SetScalarOpacity(1,opacityTF)
# opacityTF = vtk.vtkPiecewiseFunction()
# opacityTF.AddPoint( 0.0, 0.0 )
# opacityTF.AddPoint( 128.0, 0.0 )
# opacityTF.AddPoint( 255.0, 255.0 )
# volprop.SetScalarOpacity(2,opacityTF)
# actor
volume = vtk.vtkVolume()
volume.SetProperty(volprop)
volume.SetMapper(mapper)
--
View this message in context: http://vtk.1045678.n5.nabble.com/Rendering-16-Bit-microscopy-Data-with-one-LUT-and-TF-per-channel-into-one-volume-with-color-mixing-tp5714589p5714590.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list