<!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 took my mind off the development over the weekend...and voila...I
solved the problem on monday morning!<br>
<br>
I created a vtkImageData to represent the 3D volume and to hold the
scalar values as well. This replaces the vtkPoints etc etc.<br>
<br>
here's a snapshot...<br>
<img alt="" src="cid:part1.07080001.06010701@bii.a-star.edu.sg"
height="251" width="360"><br>
<br>
Toh Da Jun<br>
<br>
<br>
<blockquote cite="mid42B63715.6050702@bii.a-star.edu.sg" type="cite">Toh
Da Jun wrote:
<blockquote cite="mid42B29E01.6080802@bii.a-star.edu.sg" type="cite">
<meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
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:part2.06030204.03090600@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:part3.02050105.01060607@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>
<pre wrap=""><hr size="4" width="90%">
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: <a
class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext"
href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>
</pre>
</blockquote>
</blockquote>
</body>
</html>