<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( ) 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 "vtkRenderer.h"<br>#include "vtkRenderWindow.h"<br>#include "vtkRenderWindowInteractor.h"<br>#include "vtkBMPReader.h"<br>#include "vtkPolyDataMapper.h"<br>
#include "vtkActor.h"<br>#include "vtkActor2D.h"<br>#include "vtkImageActor.h"<br>#include "vtkOutlineFilter.h"<br>#include "vtkCamera.h"<br>#include "vtkProperty.h"
<br>#include "vtkPolyDataNormals.h"<br>#include "vtkContourFilter.h"<br>#include "vtkDataSetMapper.h"<br>#include "vtkImageMapper.h"<br>#include "vtkVolumeMapper.h"<br>#include "
vtkVolumeRayCastMapper.h"<br>#include "vtkVolumeRayCastCompositeFunction.h"</p>
<p><br>void main (void)<br>{<br> <br> vtkRenderer *aRenderer = vtkRenderer::New();<br> vtkRenderWindow *renWin = vtkRenderWindow::New();<br> <br> renWin->AddRenderer(aRenderer);<br> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
<br> iren->SetRenderWindow(renWin);</p>
<p> <br> //create an instance of the class vtkBMPReader<br> vtkBMPReader *br = vtkBMPReader::New();<br> <br> br->SetFilePrefix("C:\\Images\\conductivities\\slice"); <br> br->SetFilePattern("%s%d.bmp");
<br> br->SetFileNameSliceOffset(1);<br> br->SetFileNameSliceSpacing(1);<br> br->SetDataSpacing(1,1,1);<br> br->SetDataOrigin(0,0,0);<br> br->Update();<br> br->SetDataExtent(0,255,0,255,0,7);<br> <br> vtkVolumeRayCastMapper *VolumeMapper = vtkVolumeRayCastMapper::New();
<br> vtkVolumeRayCastCompositeFunction *RayCastFunction = vtkVolumeRayCastCompositeFunction::New();<br> VolumeMapper->SetVolumeRayCastFunction(RayCastFunction);<br> VolumeMapper->SetInput(br->GetOutput());
</p>
<p> vtkVolume *volume = vtkVolume::New();<br> <br> volume->SetMapper(VolumeMapper);</p>
<p> aRenderer->AddActor(volume);<br> aRenderer->SetBackground(1,1,1);<br> renWin->Render();<br> <br> iren->Initialize();<br> iren->Start(); </p>
<p><br> </p>
<p>}</p></div>
<div>Hoping someone can help me out.</div>
<div>Thanks </div>
<div>Sharwari<br><br> </div>
<div><span class="gmail_quote">On 8/15/06, <b class="gmail_sendername">Sharwari Mavalankar</b> <<a href="mailto:sharwari@gmail.com">sharwari@gmail.com</a>> 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> </div>
<div>
<p>#include "vtkRenderer.h"<br>#include "vtkRenderWindow.h"<br>#include "vtkRenderWindowInteractor.h"<br>#include "vtkBMPReader.h"<br>#include "vtkPolyDataMapper.h"<br>#include "
vtkActor.h"<br>#include "vtkActor2D.h"<br>#include "vtkImageActor.h"<br>#include "vtkOutlineFilter.h"<br>#include "vtkCamera.h"<br>#include "vtkProperty.h"<br>#include "
vtkPolyDataNormals.h"<br>#include "vtkContourFilter.h"<br>#include "vtkDataSetMapper.h"<br>#include "vtkImageMapper.h"</p>
<p><br>void main (void)<br>{<br> <br> vtkRenderer *aRenderer = vtkRenderer::New();<br> vtkRenderWindow *renWin = vtkRenderWindow::New();<br> <br> renWin->AddRenderer(aRenderer);<br> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
<br> iren->SetRenderWindow(renWin);</p>
<p> <br> //create an instance of the class vtkBMPReader<br> vtkBMPReader *br = vtkBMPReader::New();<br> <br> br->SetFilePrefix("C:\\Images\\conductivities\\slice"); <br> <br> <br> br->SetFilePattern("%s%d.
<span class="st" id="st" name="st">bmp</span>"); <br> <br> <br> br->SetFileNameSliceOffset(1);<br> br->SetFileNameSliceSpacing(1);<br> br->SetDataSpacing(1,1,0.1);<br> br->SetDataOrigin(0,0,0);<br> br->Update();
</p>
<p><br> vtkActor2D *Actor2D=vtkActor2D::New();<br> vtkImageMapper *ImageMapper = vtkImageMapper::New();</p>
<p> ImageMapper->SetInput(br->GetOutput());<br> Actor2D->SetMapper(ImageMapper);<br> <br> <br> aRenderer->AddActor(Actor2D);<br> aRenderer->SetBackground(1,1,1);<br> iren->Initialize();<br> iren->Start();
</p>
<p><br> </p>
<p>}</p>
<p>Hope to get some help here!</p>
<p>Thanks </p>
<p>Sharwari</p></div>
<div> </div></div></blockquote></div><br>