[vtkusers] getting a blank volume when trying to perform an x-ray projection in Java
Mark Roden
mmroden at gmail.com
Mon Jan 3 16:09:52 EST 2011
Hi all,
Happy New Year :)
I'm trying to create an average intensity projection through a CT
volume using Java and vtk 5.6.1. I have the following function in my
panel class, with each vtk object defined as a member object just to
be on the safe side viz garbage collection:
//the following function will initialize a ray-cast volume to display.
//the result is stored in the vtkVolume in the class so it can be removed
//when the display is toggled off.
vtkVolume mVolumeViewProp = new vtkVolume();;
vtkVolumeRayCastCompositeFunction rayCastFunction = new
vtkVolumeRayCastCompositeFunction();
vtkVolumeRayCastMapper rayCastMapper = new vtkVolumeRayCastMapper();
vtkColorTransferFunction volumeColor = new vtkColorTransferFunction();
vtkPiecewiseFunction volumeScalarOpacity = new vtkPiecewiseFunction();
vtkPiecewiseFunction volumeGradientOpacity = new vtkPiecewiseFunction();
vtkVolumeProperty volumeProperty = new vtkVolumeProperty();
private void InitializeRayCasting(){
rayCastMapper.SetInput(imageData);
rayCastMapper.SetVolumeRayCastFunction(rayCastFunction);
volumeColor.AddRGBPoint(-1000, 0.0, 0.0, 0.0);
volumeColor.AddRGBPoint(-400, 1.0, 0.5, 0.3);
volumeColor.AddRGBPoint(300, 1.0, 0.5, 0.3);
volumeColor.AddRGBPoint(550, 1.0, 1.0, 0.9);
volumeScalarOpacity.AddPoint(-1000, 0.00);
volumeScalarOpacity.AddPoint(-400, 0.15);
volumeScalarOpacity.AddPoint(300, 0.15);
volumeScalarOpacity.AddPoint(550, 0.85);
volumeGradientOpacity.AddPoint(0, 0.0);
volumeGradientOpacity.AddPoint(90, 0.5);
volumeGradientOpacity.AddPoint(100, 1.0);
volumeProperty.SetColor(volumeColor);
volumeProperty.SetScalarOpacity(volumeScalarOpacity);
volumeProperty.SetGradientOpacity(volumeGradientOpacity);
volumeProperty.SetInterpolationTypeToLinear();
volumeProperty.ShadeOn();
volumeProperty.SetAmbient(0.4);
volumeProperty.SetDiffuse(0.6);
volumeProperty.SetSpecular(0.2);
mVolumeViewProp.SetMapper(rayCastMapper);
mVolumeViewProp.SetProperty(volumeProperty);
}
When the user hits the appropriate button, the following code is run
to initialize the display:
InitializeRayCasting();
renWin.GetRenderer().AddViewProp(mVolumeViewProp);
Render();
Right now, the displayed volume is blank. What can I do to track this
down? This code is the medical sample code, but changing the color
and opacity defaults there to something I estimate as being closer to
CT (which ranges in value from -1000 to 3000 in values). I would
expect something strange looking while I tweak those values, but I
wouldn't expect complete blankness.
There are other objects that get rendered into this same volume
(segmentations of organs)-- will the order of the actors matter when
adding props?
Thanks,
Mark
More information about the vtkusers
mailing list