[vtkusers] Export resultant image of vtkFixedPointVolumeRayCastMapper as byte array and display it in an html page?
abhishek
abhishek at meddiff.com
Wed Nov 14 00:21:24 EST 2012
Dear Users,
I want to export resultant image of vtkFixedPointVolumeRayCastMapper as byte
array and display it in an html page. On reading documentation of
vtkFixedPointVolumeRayCastMapper, I found that there is a class called
"vtkFixedPointRayCastImage" and method "GetRayCastImage" in
"vtkFixedPointVolumeRayCastMapper". But this returns a *null* image.
Here's the code that I am using.
-----------------------------------------
#!/usr/bin/env python
import vtk
dcmReader = vtk.vtkDICOMImageReader()
dcmReader.SetDirectoryName( "D:\\DicomDataset\\CT\\Head" )
dcmReader.Update()
mapper = vtk.vtkFixedPointVolumeRayCastMapper()
mapper.SetInput(dcmReader.GetOutput())
colorFunc = vtk.vtkColorTransferFunction()
opacityFunc = vtk.vtkPiecewiseFunction()
#// BONE WINDOW
colorFunc.AddRGBPoint( -3024, 0, 0, 0, 0.5, 0.0 )
colorFunc.AddRGBPoint( -16, 0.75, 0.5, 0.0, 0.49, .61 )
colorFunc.AddRGBPoint( 641, 1, 1, .5, .5, 0.0 )
colorFunc.AddRGBPoint( 3071, 1, 1, 1, .5, 0.0 )
opacityFunc.AddPoint(-3024, 0, 0.5, 0.0 )
opacityFunc.AddPoint(-16, 0, .49, .61 )
opacityFunc.AddPoint(641, .72, .5, 0.0 )
opacityFunc.AddPoint(3071, .71, 0.5, 0.0)
mapper.SetBlendModeToComposite()
volumeProperty = vtk.vtkVolumeProperty()
volumeProperty.SetIndependentComponents(True)
volumeProperty.SetScalarOpacity(opacityFunc)
volumeProperty.SetColor(colorFunc)
volumeProperty.SetInterpolationTypeToLinear()
volumeProperty.ShadeOn()
volumeProperty.SetDiffuse(.9)
volumeProperty.SetAmbient(0.08)
volumeProperty.SetScalarOpacityUnitDistance(0.8919)
volume = vtk.vtkVolume()
volume.SetMapper(mapper)
volume.SetProperty(volumeProperty)
volume.RotateX(90)
volume.RotateY(90)
mapper.Update()
volume.Update()
image = mapper.GetRayCastImage()
print image
-----------------------------------------
P.S. What am I doing wrong here?
Regards
Abhishek.
--
View this message in context: http://vtk.1045678.n5.nabble.com/Export-resultant-image-of-vtkFixedPointVolumeRayCastMapper-as-byte-array-and-display-it-in-an-html-p-tp5717120.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list