<div>hi all, </div>
<div>This is with reference to my earlier mail about creating a volume out of 2D BMP slices.</div>
<div>As suggested I included SetDataExtent( )&nbsp; and vtkVolume in my program.</div>
<div>However now the output cannot be seen at all.</div>
<div>The program just exits giving me an access violation error at runtime.</div>
<div>Why does this error come?</div>
<div>Here is my code :</div>
<div>
<p>//This program reads a single BMP file and plots it as an image.<br>//The same program will be extended to read multiple images and create a 3D volume out of 2D slices.</p>
<p><br>#include &quot;vtkRenderer.h&quot;<br>#include &quot;vtkRenderWindow.h&quot;<br>#include &quot;vtkRenderWindowInteractor.h&quot;<br>#include &quot;vtkBMPReader.h&quot;<br>#include &quot;vtkPolyDataMapper.h&quot;<br>
#include &quot;vtkActor.h&quot;<br>#include &quot;vtkActor2D.h&quot;<br>#include &quot;vtkImageActor.h&quot;<br>#include &quot;vtkOutlineFilter.h&quot;<br>#include &quot;vtkCamera.h&quot;<br>#include &quot;vtkProperty.h&quot;
<br>#include &quot;vtkPolyDataNormals.h&quot;<br>#include &quot;vtkContourFilter.h&quot;<br>#include &quot;vtkDataSetMapper.h&quot;<br>#include &quot;vtkImageMapper.h&quot;<br>#include &quot;vtkVolumeMapper.h&quot;<br>#include &quot;
vtkVolumeRayCastMapper.h&quot;<br>#include &quot;vtkVolumeRayCastCompositeFunction.h&quot;</p>
<p><br>void main (void)<br>{<br>&nbsp;<br>&nbsp;vtkRenderer *aRenderer = vtkRenderer::New();<br>&nbsp;&nbsp;&nbsp; vtkRenderWindow *renWin = vtkRenderWindow::New();<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;renWin-&gt;AddRenderer(aRenderer);<br>&nbsp;&nbsp;&nbsp; vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
<br>&nbsp;&nbsp;&nbsp; iren-&gt;SetRenderWindow(renWin);</p>
<p>&nbsp;<br>&nbsp;//create an instance of the class vtkBMPReader<br>&nbsp;vtkBMPReader *br = vtkBMPReader::New();<br>&nbsp;<br>&nbsp;br-&gt;SetFilePrefix(&quot;C:\\Images\\conductivities\\slice&quot;); <br>&nbsp;br-&gt;SetFilePattern(&quot;%s%d.bmp&quot;);
<br>&nbsp;br-&gt;SetFileNameSliceOffset(1);<br>&nbsp;br-&gt;SetFileNameSliceSpacing(1);<br>&nbsp;br-&gt;SetDataSpacing(1,1,1);<br>&nbsp;br-&gt;SetDataOrigin(0,0,0);<br>&nbsp;br-&gt;Update();<br>&nbsp;br-&gt;SetDataExtent(0,255,0,255,0,7);<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp; vtkVolumeRayCastMapper *VolumeMapper = vtkVolumeRayCastMapper::New();
<br>&nbsp;&nbsp;&nbsp; vtkVolumeRayCastCompositeFunction *RayCastFunction = vtkVolumeRayCastCompositeFunction::New();<br>&nbsp;&nbsp;&nbsp; VolumeMapper-&gt;SetVolumeRayCastFunction(RayCastFunction);<br>&nbsp;&nbsp;&nbsp; VolumeMapper-&gt;SetInput(br-&gt;GetOutput());
</p>
<p>&nbsp;&nbsp;&nbsp; vtkVolume *volume = vtkVolume::New();<br>&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp; volume-&gt;SetMapper(VolumeMapper);</p>
<p>&nbsp;aRenderer-&gt;AddActor(volume);<br>&nbsp;aRenderer-&gt;SetBackground(1,1,1);<br>&nbsp;renWin-&gt;Render();<br>&nbsp;<br>&nbsp;iren-&gt;Initialize();<br>&nbsp;&nbsp;&nbsp; iren-&gt;Start(); </p>
<p><br>&nbsp;</p>
<p>}</p></div>
<div>Hoping someone can help me out.</div>
<div>Thanks </div>
<div>Sharwari<br><br>&nbsp;</div>
<div><span class="gmail_quote">On 8/15/06, <b class="gmail_sendername">Sharwari Mavalankar</b> &lt;<a href="mailto:sharwari@gmail.com">sharwari@gmail.com</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>
<div>hi all, </div>
<div>I am trying to create a 3D volume out of 2D <span class="st" id="st" name="st">Bmp</span> slices.</div>
<div>I believe that the <span class="st" id="st" name="st">BMP</span> files are being read because the outputis a 2D image which I cannot render.</div>
<div>The output does not look like a volume but just a 2D image.</div>
<div>Here is my code.</div>
<div>&nbsp;</div>
<div>
<p>#include &quot;vtkRenderer.h&quot;<br>#include &quot;vtkRenderWindow.h&quot;<br>#include &quot;vtkRenderWindowInteractor.h&quot;<br>#include &quot;vtkBMPReader.h&quot;<br>#include &quot;vtkPolyDataMapper.h&quot;<br>#include &quot; 
vtkActor.h&quot;<br>#include &quot;vtkActor2D.h&quot;<br>#include &quot;vtkImageActor.h&quot;<br>#include &quot;vtkOutlineFilter.h&quot;<br>#include &quot;vtkCamera.h&quot;<br>#include &quot;vtkProperty.h&quot;<br>#include &quot; 
vtkPolyDataNormals.h&quot;<br>#include &quot;vtkContourFilter.h&quot;<br>#include &quot;vtkDataSetMapper.h&quot;<br>#include &quot;vtkImageMapper.h&quot;</p>
<p><br>void main (void)<br>{<br>&nbsp;<br>&nbsp;vtkRenderer *aRenderer = vtkRenderer::New();<br>&nbsp;&nbsp;&nbsp; vtkRenderWindow *renWin = vtkRenderWindow::New();<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;renWin-&gt;AddRenderer(aRenderer);<br>&nbsp;&nbsp;&nbsp; vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New(); 
<br>&nbsp;&nbsp;&nbsp; iren-&gt;SetRenderWindow(renWin);</p>
<p>&nbsp;<br>&nbsp;//create an instance of the class vtkBMPReader<br>&nbsp;vtkBMPReader *br = vtkBMPReader::New();<br>&nbsp;<br>&nbsp;br-&gt;SetFilePrefix(&quot;C:\\Images\\conductivities\\slice&quot;); <br>&nbsp;<br>&nbsp;<br>&nbsp;br-&gt;SetFilePattern(&quot;%s%d.
<span class="st" id="st" name="st">bmp</span>&quot;); <br>&nbsp;<br>&nbsp;<br>&nbsp;br-&gt;SetFileNameSliceOffset(1);<br>&nbsp;br-&gt;SetFileNameSliceSpacing(1);<br>&nbsp;br-&gt;SetDataSpacing(1,1,0.1);<br>&nbsp;br-&gt;SetDataOrigin(0,0,0);<br>&nbsp;br-&gt;Update();
</p>
<p><br>&nbsp;vtkActor2D *Actor2D=vtkActor2D::New();<br>&nbsp;vtkImageMapper *ImageMapper = vtkImageMapper::New();</p>
<p>&nbsp;ImageMapper-&gt;SetInput(br-&gt;GetOutput());<br>&nbsp;Actor2D-&gt;SetMapper(ImageMapper);<br>&nbsp;<br>&nbsp;<br>&nbsp;aRenderer-&gt;AddActor(Actor2D);<br>&nbsp;aRenderer-&gt;SetBackground(1,1,1);<br>&nbsp;iren-&gt;Initialize();<br>&nbsp;&nbsp;&nbsp; iren-&gt;Start(); 
</p>
<p><br>&nbsp;</p>
<p>}</p>
<p>Hope to get some help here!</p>
<p>Thanks </p>
<p>Sharwari</p></div>
<div>&nbsp;</div></div></blockquote></div><br>