[vtkusers] How to avoid model splatting on a ImageData
arturo_caissut at tiscali.it
Wed Mar 11 20:00:13 EDT 2009
I think you're right, it doesn't seem as easy as I thought. I'm tryin'
to make a "manual threshold" with some itk pixel and some fantasy, I
hope to get something good but I'm not very optimistic about that.
Maybe I could export vtkImplicitModeller output to a ITK image, then
create a large itk image whit (let's say) a grey background and paste in
some way my impliciy donut in the center of the larger image.
Then I could write this image as a MetaImage.
I'll look for something in Insight mailing list archives, I think.
Thank you for your time,
Eric E. Monson ha scritto:
> Hey Arturo,
> I don't really know anything about the MetaImage format, except what
> I've read on one of the ITK pages, but it looks like you would have
> the same problem saving the flying donut data as a MetaImage file as
> you do with representing it in VTK as vtkImageData: These image data
> formats can only represent a regular structured grid, which is defined
> by its origin, the spacing between pixels or nodes in each direction,
> and the number of pixels or nodes in each direction. This would be a
> rectangular solid in 3D. Your flying donut is stored as a
> vtkUnstructuredGrid in VTK because that data structure can represent
> irregular solids with gaps in 3D space, and to do that, it needs more
> information than just origin, spacing and dimensions. If you really
> need to save this thing as a MetaImage file, it will need to be the
> whole original rectangular solid that you got after the
> vtkImplicitModeller filter, but processed in some way to give scalar
> values of zero outside your donut and some other value inside (i.e. no
> "empty space").
> On Mar 11, 2009, at 10:26 AM, Arturo Caissut wrote:
>> 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?
>> 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
>>> 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 E Monson
>>> Duke Visualization Technology Group
>>> On Mar 9, 2009, at 5:46 PM, Arturo Caissut wrote:
>>>> 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();
>>>> vtkImplicitModeller *implicit = vtkImplicitModeller::New();
>>>> implicit->SetMaximumDistance(1); //I don't want my donut to
>>>> be too large
>>>> implicit->SetSampleDimensions(50, 50, 50); //Is this correct?
>>>> vtkImageData *image = vtkImageData::New();
>>>> image->SetDimensions(50, 50, 50);
>>>> image->SetOrigin(0.0, 0.0, 0.0);
>>>> image = implicit->GetOutput();
>>>> vtkMetaImageWriter *miwriter = vtkMetaImageWriter::New();
>>>> But this doesn't work.
>>>> Can you find any error?
>>>> Thank you,
>>>> Powered by www.kitware.com <http://www.kitware.com>
>>>> Visit other Kitware open-source projects at
>>>> Please keep messages on-topic and check the VTK FAQ at:
>>>> Follow this link to subscribe/unsubscribe:
>> Powered by www.kitware.com
>> Visit other Kitware open-source projects at
>> Please keep messages on-topic and check the VTK FAQ at:
>> Follow this link to subscribe/unsubscribe:
More information about the vtkusers