<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi Madhu</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Sorry I am newbie also in VTK but I will share my 
experience to you.</FONT></DIV>
<DIV><FONT face=Arial size=2>I did the same thing with you. I will give you the 
code if you need it :-)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Volume rendering is different with surface 
rendering. In volume rendering&nbsp;the volume doesn't need to be segmented 
before rendered. In my code you will find 4 modes of volume 
rendering:MIP,Composite,Isosurface and X-Ray&nbsp;like projection. For surface 
rendering, you can derive from medical1.cxx, medical2.cxx&nbsp;or medical.cxx 
examples&nbsp;or I can give you also the code.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>To use my code you must have the dataset where each 
voxel stored in unsigned char. If you have dicom data you can read by VolView 
and save as a series of PNG,BMP, or PNM (my code use PNG format). You can 
download VolView from internet. </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Cheers</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV>----- Original Message ----- </DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=madhu_lsu@yahoo.com href="mailto:madhu_lsu@yahoo.com">Madhusudhanan 
  Balasubramanian</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=vtkusers@vtk.org 
  href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, June 30, 2004 5:58 
  PM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> [vtkusers] Volume rendering with 
  ray casting</DIV>
  <DIV><BR></DIV>
  <DIV>Hi all,</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>I've a volume data that I tried to volume render with ray casting(which I 
  constructed from 5, 2D images).&nbsp; I've&nbsp;a couple of&nbsp;questions at 
  this time:</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>1.&nbsp;When I rotate the volume around, assuming that image slice 1 is 
  visible, I expect the see the structures in other slices; say if I rotate it 
  180 degrees around I'm expecting to see structures from image slice 5; but I 
  still see&nbsp;only the&nbsp;structures from slice 1.&nbsp; Am I missing 
  something while rendering?&nbsp; (I've verified the dimensions of the volume 
  dataset and it is correct).</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>2. Are there segmentation algorithms that are available with vtk that can 
  used on 2D images before being volume rendered?</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>3. With the volume built from 5 image slices, when I rotate the volume 
  around, the thickness of the volume (along z-axis) appears to be got just from 
  a single image.&nbsp; May be I'm doing something wrong in rendering.</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>Here are few fragments of my code that I used to volume render:</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>CVolRendererView::CVolRendererView()<BR>{<BR>&nbsp;this-&gt;color = 
  vtkPiecewiseFunction::New();<BR>&nbsp;this-&gt;color-&gt;AddPoint(0, 
  0.0);<BR>&nbsp;this-&gt;color-&gt;AddPoint(255, 1.0);</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;this-&gt;opacity = 
  vtkPiecewiseFunction::New();<BR>&nbsp;this-&gt;opacity-&gt;AddPoint(0, 
  0.0);<BR>&nbsp;this-&gt;opacity-&gt;AddPoint(130, 
  0.0);<BR>&nbsp;this-&gt;opacity-&gt;AddPoint(140, 
  1.0);<BR>&nbsp;this-&gt;opacity-&gt;AddPoint(255, 1.0);</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;this-&gt;gradOpacity = 
  vtkPiecewiseFunction::New();<BR>&nbsp;this-&gt;gradOpacity-&gt;AddPoint(0, 
  0.0);<BR>&nbsp;this-&gt;gradOpacity-&gt;AddPoint(3, 
  0.0);<BR>&nbsp;this-&gt;gradOpacity-&gt;AddPoint(6, 
  1.0);<BR>&nbsp;this-&gt;gradOpacity-&gt;AddPoint(255, 1.0);</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;this-&gt;property = 
  vtkVolumeProperty::New();<BR>&nbsp;this-&gt;property-&gt;SetColor(this-&gt;color);<BR>&nbsp;this-&gt;property-&gt;SetScalarOpacity(this-&gt;opacity);<BR>&nbsp;this-&gt;property-&gt;SetGradientOpacity(this-&gt;gradOpacity);</DIV>
  <DIV>&nbsp;this-&gt;property-&gt;ShadeOn();<BR>&nbsp;this-&gt;property-&gt;SetInterpolationTypeToLinear();</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;this-&gt;composite = 
  vtkVolumeRayCastCompositeFunction::New();<BR>&nbsp;this-&gt;composite-&gt;SetCompositeMethodToInterpolateFirst();</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;this-&gt;mapper = 
  vtkVolumeRayCastMapper::New();<BR>&nbsp;this-&gt;mapper-&gt;SetVolumeRayCastFunction(composite);</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;this-&gt;volume = 
  vtkVolume::New();<BR>&nbsp;this-&gt;volume-&gt;SetMapper(this-&gt;mapper);<BR>&nbsp;this-&gt;volume-&gt;SetProperty(this-&gt;property);</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;this-&gt;ren = 
  vtkRenderer::New();<BR>&nbsp;this-&gt;ren-&gt;AddVolume(volume);</DIV>
  <DIV>&nbsp;this-&gt;renWin = vtkWin32OpenGLRenderWindow::New();</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;this-&gt;iren = vtkRenderWindowInteractor::New();</DIV>
  <DIV><BR>&nbsp;this-&gt;imageAppend = 
  vtkImageAppend::New();<BR>&nbsp;this-&gt;imageAppend-&gt;SetAppendAxis(2);</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;this-&gt;renWin-&gt;AddRenderer(this-&gt;ren);<BR>&nbsp;this-&gt;iren-&gt;SetRenderWindow(this-&gt;renWin);<BR>&nbsp;this-&gt;iren-&gt;Start();<BR>}</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>//Updating the volume with new image slices</DIV>
  <DIV>this-&gt;imageAppend-&gt;AddInput(this-&gt;GetDocument()-&gt;reader-&gt;GetOutput());<BR>this-&gt;imageAppend-&gt;UpdateWholeExtent();<BR></DIV>
  <DIV>//Rendering</DIV>
  <DIV>this-&gt;mapper-&gt;SetInput((vtkImageData*)this-&gt;imageAppend-&gt;GetOutput());<BR>this-&gt;ren-&gt;ResetCamera();<BR>this-&gt;renWin-&gt;Render();<BR></DIV>
  <DIV>I would appreciate your inputs on this.</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>Thanks,</DIV>
  <DIV>Madhu.</DIV>
  <P>__________________________________________________<BR>Do You 
  Yahoo!?<BR>Tired of spam? Yahoo! Mail has the best spam protection around 
  <BR>http://mail.yahoo.com 
  <P>
  <HR>

  <P></P>_______________________________________________<BR>This is the private 
  VTK discussion list. <BR>Please keep messages on-topic. Check the FAQ at: 
  &lt;http://public.kitware.com/cgi-bin/vtkfaq&gt;<BR>Follow this link to 
  subscribe/unsubscribe:<BR>http://www.vtk.org/mailman/listinfo/vtkusers<BR></BLOCKQUOTE></BODY></HTML>