<br><font size=2 face="sans-serif">Paul, vtkImageReader doesn't read VTK format data files....try using vtkStructurePointsReader ....john</font>
<br>
<br>
<br>
<table>
<tr valign=top>
<td><font size=6 color=red face="Times New Roman"><b>Internet Mail Message</b></font>
<br><font size=2 color=red face="sans-serif">Received from host: </font><font size=2 face="sans-serif"><b>public.kitware.com [24.97.130.19]</b></font>
<td></table>
<br>
<table width=100%>
<tr valign=top>
<td>
<td><font size=1 face="sans-serif"><b>Paul McGuinness <mcguinpg@maths.tcd.ie></b></font>
<br><font size=1 face="sans-serif">Sent by: vtkusers-admin@vtk.org</font>
<p><font size=1 face="sans-serif">07/04/2003 10:10 AM</font>
<br>
<td><font size=1 face="Arial"> </font>
<br><font size=1 face="sans-serif"> To: vtkusers@vtk.org</font>
<br><font size=1 face="sans-serif"> cc: (bcc: John Anast-JM/PGI)</font>
<br><font size=1 face="sans-serif"> Subject: [vtkusers] volume rendering problem!</font></table>
<br>
<br>
<br><font size=2 face="Courier New"><br>
Hi All,<br>
<br>
I am having a problem displaying the volume rendering of ironProt.vtk. The<br>
code compiles, and the display window appears but there is no rendering in<br>
the window, the window is just empty. Can someone please help me, I am<br>
reading in the file using vtkImageReader and using vtkImageCast to convert<br>
it to unsigned-short. Then vtkVolumeRayCastMapper sets its input to the<br>
vtkImageCast object's output, see below. I am using vtk4.2.2.<br>
Please can someone help,<br>
Happy 4th July,<br>
Paul.<br>
<br>
<br>
int main( int argc, char *argv[] )<br>
{<br>
vtkRenderer *ren1 =vtkRenderer::New();<br>
vtkRenderWindow *renWin=vtkRenderWindow::New();<br>
renWin->AddRenderer(ren1);<br>
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br>
iren->SetRenderWindow(renWin);<br>
<br>
vtkImageReader *reader =vtkImageReader::New();<br>
reader->SetFileName("ironProt.vtk");<br>
<br>
<br>
vtkImageCast *imgcas = vtkImageCast::New();<br>
imgcas->SetInput(reader->GetOutput());<br>
imgcas->SetOutputScalarTypeToUnsignedShort();<br>
<br>
<br>
vtkPiecewiseFunction *opacityTransferFunction =<br>
vtkPiecewiseFunction::New();<br>
opacityTransferFunction->AddPoint(20, 0.0);<br>
opacityTransferFunction->AddPoint(255, 0.2);<br>
<br>
vtkColorTransferFunction *colorTransferFunction =<br>
vtkColorTransferFunction::New();<br>
colorTransferFunction->AddRGBPoint( 0.0, 0.0, 0.0, 0.0);<br>
colorTransferFunction->AddRGBPoint(64.0, 1.0, 0.0, 0.0);<br>
colorTransferFunction->AddRGBPoint(128.0, 0.0, 0.0, 1.0);<br>
colorTransferFunction->AddRGBPoint(192.0, 0.0, 1.0, 0.0);<br>
colorTransferFunction->AddRGBPoint(255.0, 0.0, 0.2, 0.0);<br>
<br>
vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();<br>
volumeProperty->SetColor(colorTransferFunction);<br>
volumeProperty->SetScalarOpacity(opacityTransferFunction);<br>
volumeProperty->ShadeOn();<br>
volumeProperty->SetInterpolationTypeToLinear();<br>
<br>
vtkVolumeRayCastCompositeFunction *compositeFunction=<br>
vtkVolumeRayCastCompositeFunction::New();<br>
vtkVolumeRayCastMapper *volumeMapper = vtkVolumeRayCastMapper::New();<br>
volumeMapper->SetVolumeRayCastFunction(compositeFunction);<br>
volumeMapper->SetInput(imgcas->GetOutput());<br>
<br>
vtkVolume *volume = vtkVolume::New();<br>
volume->SetMapper(volumeMapper);<br>
volume->SetProperty(volumeProperty);<br>
<br>
ren1->AddVolume(volume);<br>
ren1->SetBackground(1, 1 ,1);<br>
renWin->SetSize(600, 600);<br>
renWin->Render();<br>
iren->Start();<br>
<br>
}<br>
<br>
<br>
<br>
_______________________________________________<br>
This is the private VTK discussion list. <br>
Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq><br>
Follow this link to subscribe/unsubscribe:<br>
http://www.vtk.org/mailman/listinfo/vtkusers<br>
</font>
<br>
<br>