Hi Prathamesh,<div><br></div><div>The range is set by SetDataExtent(), which you do.</div><div><br></div><div>But there are several unusual things about your application that you don&#39;t explain in your email.</div><div>

- Are the BMP files RGB or are they greyscale?</div><div>- Did you mean to make a vtkColorTransferFunction for your volume?</div><div>- Why only five slices?</div><div><br></div><div>  - David</div><div><br><div class="gmail_quote">

On Mon, Nov 29, 2010 at 11:57 AM, Prathamesh Kulkarni <span dir="ltr">&lt;<a href="mailto:prathameshmkulkarni@gmail.com">prathameshmkulkarni@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div dir="ltr">For that I used the SetFilePrefix() and SetFilePattern. Is there any other way of setting the range of files?<br><font color="#888888"><br>- Prathamesh</font><div><div></div><div class="h5"><br><br><div class="gmail_quote">

On Mon, Nov 29, 2010 at 12:50 PM, Darshan Pai <span dir="ltr">&lt;<a href="mailto:darshanpai@gmail.com" target="_blank">darshanpai@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">You probably need to set the range of the files <br><br><div class="gmail_quote"><div><div></div>


<div>On Mon, Nov 29, 2010 at 11:36 AM, Prathamesh Kulkarni <span dir="ltr">&lt;<a href="mailto:prathameshmkulkarni@gmail.com" target="_blank">prathameshmkulkarni@gmail.com</a>&gt;</span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><div><div></div><div><div dir="ltr"><div><br></div><div>Hello,</div>
<div><br></div><div>I am trying to render a series of BMP images as a volume using Ray Casting in vtk. However, what I see is only a single slice of image. </div>
<div><br></div>
<div>Please point me out to where I am doing a mistake. My code is attached below.</div><div><br></div><div><br></div><div>#................................................................................................#</div>




<div><br></div><div>import vtk</div><div>from vtk import *</div><div><br></div><div>bmp_reader = vtk.vtkBMPReader()</div><div><br></div><div>bmp_reader.SetFilePrefix(&#39;../sampleData/sample_&#39;)</div><div>bmp_reader.SetFilePattern(&#39;%s%d.bmp&#39;)</div>




<div><br></div><div>#print bmp_reader</div><div><br></div><div>height = 512</div><div>width = 496</div><div>depth = 5</div><div><br></div><div>#this is default behaviour anyways..</div><div>bmp_reader.SetFileNameSliceOffset(1)</div>




<div>bmp_reader.SetFileNameSliceSpacing(1)</div><div><br></div><div>#bmp_reader.SetNumberOfScalarComponents(3)</div><div>bmp_reader.SetDataSpacing(1, 1, 1)</div><div>bmp_reader.SetDataOrigin(0, 0, 0)</div><div>bmp_reader.SetDataExtent(0, width-1, 0, height-1, 0, depth-1)</div>




<div>bmp_reader.SetDataScalarTypeToUnsignedChar()</div><div><br></div><div>alpha_channel_function = vtk.vtkPiecewiseFunction()</div><div>alpha_channel_function.AddPoint(20, 0.1)</div><div>alpha_channel_function.AddPoint(100, 1.0)</div>




<div><br></div><div>volume_property = vtk.vtkVolumeProperty()</div><div>volume_property.SetScalarOpacity(alpha_channel_function)</div><div><br></div><div>composite_function = vtk.vtkVolumeRayCastCompositeFunction()</div>



<div>
#volume_mapper = vtk.vtkVolumeRayCastMapper()</div><div>volume_mapper = vtk.vtkFixedPointVolumeRayCastMapper()</div><div><br></div><div>#volume_mapper.SetVolumeRayCastFunction(composite_function)</div><div>volume_mapper.SetInput(bmp_reader.GetOutput())</div>




<div><br></div><div>volume = vtk.vtkVolume()</div><div>volume.SetMapper(volume_mapper)</div><div>volume.SetProperty(volume_property)</div><div><br></div><div>renderer = vtk.vtkRenderer()</div><div>render_window = vtk.vtkRenderWindow()</div>




<div>render_window_interactor = vtk.vtkRenderWindowInteractor()</div><div><br></div><div>render_window.AddRenderer(renderer)</div><div>render_window_interactor.SetRenderWindow(render_window)</div><div><br></div><div>renderer.AddVolume(volume)</div>




<div>renderer.SetBackground(1, 1, 1)</div><div>render_window.SetSize(500, 500)</div><div><br></div><div>render_window_interactor.Initialize()</div><div>render_window.Render()</div><div>render_window_interactor.Start()</div>




</div>
<br></div></div>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br>
</blockquote></div><br></div></div></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>