[vtkusers] Fwd: create a 3d volume form a series BMP file
liu
geniusdot at gmail.com
Tue Jul 17 00:17:40 EDT 2007
hello everyone
i'm new VTKer who can tell me create a 3d volume form a series BMP file.
Althought i have create one by follow 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"
#include "vtkVolumeMapper.h"
#include " vtkVolumeRayCastMapper.h"
#include "vtkVolumeRayCastCompositeFunction.h"
#include "vtkPiecewiseFunction.h"
#include "vtkVolumeProperty.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("slice/");
br->SetFilePattern("%simage%d.bmp");
br->SetFileNameSliceOffset(1);
br->SetFileNameSliceSpacing(1);
br->SetNumberOfScalarComponents(3);
br->SetDataSpacing(5.0,5.0,10);
br->SetDataOrigin(0,0,0);
br->SetDataExtent(0,255,0,255,0,63);
br->Update();
vtkFixedPointVolumeRayCastMapper *VolumeMapper =
vtkFixedPointVolumeRayCastMapper::New();
VolumeMapper->SetInput(br->GetOutput());
vtkVolume *volume = vtkVolume::New();
VolumeMapper->SetInput(br->GetOutput());
volume->SetMapper(VolumeMapper);
vtkCamera *aCamera = vtkCamera::New();
aCamera->SetViewUp (0, 0,-1);
aCamera->SetPosition (0, 1, 0);
aCamera->SetFocalPoint (0, 0, 0);
aCamera->ComputeViewPlaneNormal();
aRenderer->AddActor(volume);
aRenderer->SetActiveCamera(aCamera);
aRenderer->ResetCamera ();
aRenderer->SetBackground(1,1,1);
renWin->Render();
iren->Initialize();
iren->Start();
}
but it only a cube that sunface with BMP.It not a real 3d like the data
treat by marching cube or other
algorithm.So i want get a real 3D .who can tell me what shoud i do .Perhaps
i should use some filter(but i don't know which should i use)
someone who can help me thank you.....
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070717/dd5f8140/attachment.htm>
More information about the vtkusers
mailing list