<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi all!<br>
<br>
I'm trying to volumerender a 3D volume. This volume is simply a
rectangular box, somewhat like the one shown in
"/VTK/IO/Tesing/Tcl/gaussian.tcl".<br>
I need to be able to alter the colour display of the 3D Volume.
Therefore, I use a set of 3D points to represent the volume, where I
can change the scalar values and the colour display is altered.<br>
<br>
The problem is that the display does not reflect the changes. <br>
<br>
<img alt="" src="cid:part1.09070405.06080605@bii.a-star.edu.sg"
height="286" width="410"><br>
<u><b><br>
</b></u>But when I alter the values in "m4_TotalDensity.cube" and run
gaussian.tcl...the changes are correctly displayed (notice the red
portions).<br>
<img alt="" src="cid:part2.06020207.06040301@bii.a-star.edu.sg"
height="286" width="410"><br>
<br>
<u><b><br>
here's a copy of my Java codes.</b></u><br>
<br>
public void create() {<br>
vtkUnstructuredGrid usGrid = new vtkUnstructuredGrid();<br>
<br>
// Set up the Cell and Scalar arrays for use to display colour
information<br>
m_Points = new vtkPoints();<br>
m_aCells = new vtkCellArray();<br>
m_aScalars = new vtkIntArray();<br>
<br>
int ID = 0;<br>
for (int k=0; k<m_iDimension_Z; k++)<br>
for (int i=0; i<m_iDimension_Y; i++) {<br>
for (int j=0; j<m_iDimension_X; j++) {<br>
m_Points.InsertPoint( ID, i, j, k );<br>
m_aScalars.InsertValue( ID, k);<br>
m_aCells.InsertNextCell(1);<br>
m_aCells.InsertCellPoint( ID );<br>
ID++;<br>
}<br>
}<br>
<br>
usGrid.SetPoints(m_Points);<br>
usGrid.GetPointData().SetScalars(m_aScalars);<br>
<br>
// Gaussian Splatter<br>
vtkGaussianSplatter popSplatter = new vtkGaussianSplatter();<br>
popSplatter.SetInput(usGrid);<br>
popSplatter.SetSampleDimensions(m_iDimension_X,m_iDimension_Y,m_iDimension_Z);<br>
popSplatter.SetRadius(0.01);<br>
popSplatter.ScalarWarpingOff();<br>
<br>
vtkImageShiftScale readerSS = new vtkImageShiftScale();<br>
readerSS.SetInput(popSplatter.GetOutput());<br>
readerSS.SetScale(1);<br>
readerSS.SetOutputScalarTypeToUnsignedChar();<br>
<br>
makeColourOpacityFilter();<br>
<br>
// Create a property for the volume and set the transfer
functions.<br>
// Turn shading on and use trilinear interpolation<br>
vtkVolumeProperty volumeProperty = new vtkVolumeProperty();<br>
volumeProperty.SetColor(cTFun);//colorTransferFunction);//cTFun);<br>
volumeProperty.SetScalarOpacity(opacityTransferFunction);//oTFun);<br>
volumeProperty.SetInterpolationTypeToLinear();<br>
<br>
// Create a ray function - this is a compositing ray function<br>
vtkVolumeRayCastCompositeFunction compositeFunction = new
vtkVolumeRayCastCompositeFunction();<br>
<br>
// Create the volume mapper and set the ray function and scalar
input<br>
vtkVolumeRayCastMapper volumeMapper = new
vtkVolumeRayCastMapper();<br>
volumeMapper.SetInput(readerSS.GetOutput());<br>
volumeMapper.AutoAdjustSampleDistancesOn();<br>
volumeMapper.SetVolumeRayCastFunction(compositeFunction);<br>
<br>
// Create the volume and set the mapper and property<br>
vtkVolume volume = new vtkVolume();<br>
volume.SetMapper(volumeMapper);<br>
volume.SetProperty(volumeProperty);<br>
<br>
// Add this volume to the renderer and get a closer look<br>
m_Renderer.AddVolume(volume);<br>
}<br>
<br>
<br>
PLEASE HELP!!!<br>
<br>
<br>
Toh Da Jun<br>
<br>
</body>
</html>