[vtkusers] Creating a Volume from 2D BMP files.
Sharwari Mavalankar
sharwari at gmail.com
Tue Aug 15 18:49:54 EDT 2006
hi all,
I am trying to create a 3D volume out of 2D Bmp slices.
I believe that the BMP files are being read because the outputis a 2D image
which I cannot render.
The output does not look like a volume but just a 2D image.
Here is my code.
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkBMPReader.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
#include "vtkActor2D.h"
#include "vtkImageActor.h"
#include "vtkOutlineFilter.h"
#include "vtkCamera.h"
#include "vtkProperty.h"
#include "vtkPolyDataNormals.h"
#include "vtkContourFilter.h"
#include "vtkDataSetMapper.h"
#include "vtkImageMapper.h"
void main (void)
{
vtkRenderer *aRenderer = vtkRenderer::New();
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(aRenderer);
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
//create an instance of the class vtkBMPReader
vtkBMPReader *br = vtkBMPReader::New();
br->SetFilePrefix("C:\\Images\\conductivities\\slice");
br->SetFilePattern("%s%d.bmp");
br->SetFileNameSliceOffset(1);
br->SetFileNameSliceSpacing(1);
br->SetDataSpacing(1,1,0.1);
br->SetDataOrigin(0,0,0);
br->Update();
vtkActor2D *Actor2D=vtkActor2D::New();
vtkImageMapper *ImageMapper = vtkImageMapper::New();
ImageMapper->SetInput(br->GetOutput());
Actor2D->SetMapper(ImageMapper);
aRenderer->AddActor(Actor2D);
aRenderer->SetBackground(1,1,1);
iren->Initialize();
iren->Start();
}
Hope to get some help here!
Thanks
Sharwari
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060815/d61afc3a/attachment.htm>
More information about the vtkusers
mailing list