[Insight-users] Problems with voxelization using VTK

shi yuan shiyuan001 at hotmail.com
Sat Jun 9 04:34:52 EDT 2007


Hi all,
I’m a beginner to VTK, I have requirements as follows;
1)Rasterizing a polygonal mesh object to a model represents as voxel, and 
the voxelized model is not “hollow”;
2)Getting infomation from the voxelized model such as the position of 
voxel-cube (x,y,z);

>From this mail list, vtkImplicitModeller and vtkVoxelModeller seems useful 
to me, and I made a test program, but it doesn’t match my need, because 
the program produce a triangular mesh model which seems “hollow”, I mean 
the model should be “accumulated” by many voxel which has the same size. 
I am not very familiar with the VTK, maybe I use wrong method. Besides the 
problem mentioned above, I have some problems as follows:

1)Whether VTK has ability to Voxelize/Rasterize a geometry or not? (The 
voxelized model must be “accumulated” by the same unit voxel). In the 
other words, should I apply certain voxelization algorithm to program? 
Whether VTK only plays the role of visualization or not? 

2)If VTK has ability to Voxelize a geometry, which class(es) should I use? 
vtkImplicitModeller and vtkVoxelModeller doesn’t work well for my need 
(code segments listed as attachment). And which method(s) should I use for 
Getting infomation from the voxelized model.

Dose anyone give me some hints? I would be grateful for any help!

Best wishes,
Shiyuan

--------------------------------------------------------------------------------------------

Code Segments:
vtkSmartPointer<vtkCubeSource> cube = 
vtkSmartPointer<vtkCubeSource>::New();
cube->SetCenter(0,0,0);
cube->SetXLength(20);
cube->SetYLength(20);
cube->SetZLength(20);

vtkSmartPointer<vtkVoxelModeller> voxel = 
vtkSmartPointer<vtkVoxelModeller>::New();
voxel->SetInputConnection(cube->GetOutputPort());
voxel->SetSampleDimensions(8,8,8);
voxel->SetModelBounds(-10,10,-10,10,-10,10);

vtkSmartPointer<vtkContourFilter> contour = 
vtkSmartPointer<vtkContourFilter>::New();
contour->SetInputConnection(voxel->GetOutputPort());
contour->SetValue(0,1);

vtkSmartPointer<vtkPolyDataMapper> voxelMapper = 
vtkSmartPointer<vtkPolyDataMapper>::New();
voxelMapper ->SetInputConnection(contour->GetOutputPort());

vtkSmartPointer<vtkActor> voxelActor = vtkSmartPointer<vtkActor>::New();
voxelActor ->SetMapper(voxelMapper);
voxelActor ->GetProperty()->SetColor(0,0,1);
voxelActor ->GetProperty()->SetOpacity(0.5);
voxelActor ->GetProperty()->SetRepresentationToWireframe();

_________________________________________________________________
享用世界上最大的电子邮件系统― MSN Hotmail。  http://www.hotmail.com  



More information about the Insight-users mailing list