[vtkusers] How to construct the volume data using 2d bitmap
Suganthi
suganthi at softteam.com
Fri Apr 8 00:41:47 EDT 2005
Hi,
I am trying to construct a 3d volume from a series of bitmaps (ct-
slices) using the below code, but
the code crashes at " w->Render();"
Whether the following code flow is correct?
what should be the input for vtkVolumeRayCastMapper?
what are the parameters for SetDataExtent method?
Please help me......
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkVolume16Reader.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
#include "vtkOutlineFilter.h"
#include "vtkCamera.h"
#include "vtkProperty.h"
#include "vtkPolyDataNormals.h"
#include "vtkContourFilter.h"
#include "vtkBMPReader.h"
#include "vtkImageData.h"
#include "vtkImageActor.H"
#include "vtkVolumeMapper.h"
#include "vtkVolumeRayCastMapper.h"
#include "vtkDataSetMapper.H"
void main()
{
vtkRenderWindow *w=vtkRenderWindow::New();
vtkBMPReader *r=vtkBMPReader::New();
vtkVolumeRayCastMapper *vtm =
vtkVolumeRayCastMapper::New();
vtkRenderer *ren=vtkRenderer::New();
// vtkImageActor *a=vtkImageActor::New();
vtkVolume *a = vtkVolume::New();
vtkRenderWindowInteractor
*i=vtkRenderWindowInteractor::New();
//vtkVolume16Reader *v=vtkVolume16Reader::New();
//vtkDataSetMapper *m=vtkDataSetMapper::New();
i->SetRenderWindow(w);
r->SetFileDimensionality(2);
r->SetDataByteOrderToLittleEndian();
r->SetFilePrefix("new/Slice");
r->SetFilePattern("%s%d.bmp");
r->SetDataSpacing(3.0,2.0,3.0);
//r->SetDataExtent(0, 63, 0, 63,0,2); // 2
slices
r->SetDataExtent(0, 255, 0, 255,0,2); // 2
slices
vtm->SetInput(r->GetOutput());
a->SetMapper(vtm);
w->AddRenderer(ren);
ren->AddActor(a);
w->Render();
i->Start();
}
regards
SoftUsers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050408/96ca6c4a/attachment.htm>
More information about the vtkusers
mailing list