<!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">
&nbsp;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>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkUnstructuredGrid usGrid = new vtkUnstructuredGrid();<br>
    <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Set up the Cell and Scalar arrays for use to display colour
information<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_Points = new vtkPoints();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_aCells = new vtkCellArray();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_aScalars = new vtkIntArray();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int ID = 0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int k=0; k&lt;m_iDimension_Z; k++)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i=0; i&lt;m_iDimension_Y; i++) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int j=0; j&lt;m_iDimension_X; j++) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_Points.InsertPoint( ID, i, j, k );<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_aScalars.InsertValue( ID, k);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_aCells.InsertNextCell(1);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_aCells.InsertCellPoint( ID );<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ID++;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; usGrid.SetPoints(m_Points);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; usGrid.GetPointData().SetScalars(m_aScalars);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Gaussian Splatter<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkGaussianSplatter popSplatter = new vtkGaussianSplatter();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; popSplatter.SetInput(usGrid);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
popSplatter.SetSampleDimensions(m_iDimension_X,m_iDimension_Y,m_iDimension_Z);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; popSplatter.SetRadius(0.01);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; popSplatter.ScalarWarpingOff();<br>
    <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkImageShiftScale readerSS = new vtkImageShiftScale();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; readerSS.SetInput(popSplatter.GetOutput());<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; readerSS.SetScale(1);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; readerSS.SetOutputScalarTypeToUnsignedChar();<br>
    <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; makeColourOpacityFilter();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Create a property for the volume and set the transfer
functions.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Turn shading on and use trilinear interpolation<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkVolumeProperty volumeProperty = new vtkVolumeProperty();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
volumeProperty.SetColor(cTFun);//colorTransferFunction);//cTFun);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
volumeProperty.SetScalarOpacity(opacityTransferFunction);//oTFun);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; volumeProperty.SetInterpolationTypeToLinear();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Create a ray function - this is a compositing ray function<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkVolumeRayCastCompositeFunction compositeFunction = new
vtkVolumeRayCastCompositeFunction();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Create the volume mapper and set the ray function and scalar
input<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkVolumeRayCastMapper volumeMapper = new
vtkVolumeRayCastMapper();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; volumeMapper.SetInput(readerSS.GetOutput());<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; volumeMapper.AutoAdjustSampleDistancesOn();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; volumeMapper.SetVolumeRayCastFunction(compositeFunction);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Create the volume and set the mapper and property<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkVolume volume = new vtkVolume();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; volume.SetMapper(volumeMapper);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; volume.SetProperty(volumeProperty);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Add this volume to the renderer and get a closer look<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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>