[vtkusers] How to avoid model splatting on a ImageData

Arturo Caissut arturo_caissut at tiscali.it
Mon Mar 9 17:46:45 EDT 2009


Hi,
I need to read a PolyData 3D model, pass it through two filters 
(implicit modeller & image threshold) and then save the resulting image 
on a ImageData.
My problem is that I don't want the resulting model image to be 
"splatted" all over the ImageData extension (with a deformation as a 
collateral result), but I cannot avoid this.
Maybe I'm making some confusion between implicit modeller 
SetSampleDimensions and SetModelBounds, but I'm not sure.

I'll try to explain myself with an example: let's say I have a radius=4 
circle stored into a polydata. My aim is to create a 50x50x50 MetaImage 
file whit a radius 4 " donut"on the center, and a lot of "free space" 
all around. I think I should procede with something like:
|
vtkPolydataReader *reader = vtkPolyDataReader::New();
reader->SetFileName("something.vtk");

vtkImplicitModeller *implicit = vtkImplicitModeller::New();
implicit->SetInput(reader->GetOutput());
implicit->SetMaximumDistance(1);         //I don't want my donut to be 
too large
implicit->SetSampleDimensions(50, 50, 50);    //Is this correct?
implicit->SetModelBounds(reader->GetOutput()->GetBounds());
implicit->Update();

vtkImageData *image = vtkImageData::New();
image->SetDimensions(50, 50, 50);
image->SetOrigin(0.0, 0.0, 0.0);
image->SetSpacing(1,1,1);
image = implicit->GetOutput();
image->Update();

vtkMetaImageWriter *miwriter = vtkMetaImageWriter::New();
miwriter->SetInput(image);
miwriter->SetFileName("something_else.mhd");
miwriter->Write();|


But this doesn't work.
Can you find any error?


Thank you,
Arturo




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090309/cabc645f/attachment.htm>


More information about the vtkusers mailing list