[vtkusers] How to avoid model splatting on a ImageData

Arturo Caissut arturo_caissut at tiscali.it
Wed Mar 11 10:26:42 EDT 2009


Dear Eric,

ok, I think it worked.
Now my problem is to save the figure (a flyin' donut surrounded by free 
space) as a MetaImage file. Maybe I shall use some ITK method?

Arturo


Eric E. Monson wrote:
> Hey Arturo,
>
> You can do what you want, but to get "free space" around your donut, 
> the output will need to be an Unstructured Grid rather than ImageData 
> (which is just defined in a cube, all filled with points). 
>
> I think you have the right idea about the vtkImplicitModeller methods: 
> SetSampleDimensions sets the number of grid points in each direction, 
> while the SetModelBounds specifies the extent of the output in the 
> coordinate space of your data. You can try setting it manually to (-5, 
> 5, -5, 5, -1, 1) if you want. The output of vtkImplicitModeller is a 
> vtkImageData, so I don't think you have to create that new "image", 
> just grab the output and pipe it in to your writer.
>
> If you put a threshold filter after the implicit modeller, you'll get 
> an unstructured grid with "free space" around your donut. (I just 
> tried it in ParaView, so I don't have VTK code handy.) If you really 
> need ImageData out, then there may be a way to "zero out" the values 
> over a certain threshold, but there will still be points all 
> throughout the rectangular solid space.
>
> If this doesn't answer your questions, you may have to clarify in what 
> way this is "not working" and what you mean by not wanting the data 
> splatted all over the volume (maybe the "free space" issue?).
>
> Talk to you later,
> -Eric
>
> ------------------------------------------------------
> Eric E Monson
> Duke Visualization Technology Group
>
>
> On Mar 9, 2009, at 5:46 PM, Arturo Caissut wrote:
>
>> 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
>>
>>
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com <http://www.kitware.com>
>>
>> Visit other Kitware open-source projects at 
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at: 
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>




More information about the vtkusers mailing list