[vtkusers] vtkPolyDataToImageStencil

Frank Gao gao at mdimaging.com
Wed May 23 17:40:06 EDT 2007


Hi David,

Thanks for the prompt reply. I will try to work out a solution.

Regards,

Frank

-----Original Message-----
From: David Gobbi [mailto:dgobbi at atamai.com]
Sent: Wednesday, May 23, 2007 2:28 PM
To: gao at mdimaging.com
Cc: Vtkusers at Vtk.Org
Subject: Re: [vtkusers] vtkPolyDataToImageStencil

Hi Frank,

I didn't state things very well in that last paragraph.

If you triangularize the polyline contour from your
spline (fill the contour with triangles), then you could
extrude the resulting polydata and that would
provide the data that is needed to create the caps.

As far as I know, there is no filter in VTK to create
a triangularization from a contour (except Delaunay
which requires a convex contour), so you would
have to research a suitable algorithm and write the code.

 - David


Frank Gao wrote:
> David,
>
> Thanks for your reply. Now I understand the problem. However, when the
> spline is on YZ plane, vtkLinearExtrusionFilter just does not have any
cell
> data to create cap faces, so the capping option is actually ignored. Could
> you elaborate what you said here " This would involve adding a contour
> triangularization algorithm to the code"?
>
> Thanks again,
>
> Frank
>
> -----Original Message-----
> From: David Gobbi [mailto:dgobbi at atamai.com]
> Sent: Wednesday, May 23, 2007 1:45 PM
> To: gao at mdimaging.com
> Cc: Vtkusers at Vtk.Org
> Subject: Re: [vtkusers] vtkPolyDataToImageStencil
>
> Hi Frank,
>
> The algorithm in the class that I emailed to you
> (vtkAtamaiPolyDataToImageStencil2) works by cutting the
> polydata with the XY planes of the image slices to create
> a series of polygons, and then it rasterizes each of these
> polygons.    There is some logic that it uses close any
> polygons that aren't closed, but there is some ambiguity
> and you are never 100% safe unless your polydata is
> closed.
>
> The vtkPolyDataToImageStencil in VTK does not do
> anything to try to close the polydata.  Instead, it rasterizes
> the 3D surface directly, one X row at a time.  So if the
> original contour is in the YZ plane, then extruding it
> along X will give you tube that all of the raster lines will
> pass through without ever intersecting with any polygons.
> The result is no output volume.
>
> You could try adding a "capping" option to
> vtkLinearExtrusionFilter.  This would involve adding
> a contour triangularization algorithm to the code.
> (Delaunay won't work since the contour might not
> be convex).
>
>  - David
>
>
> Frank Gao wrote:
>
>> Hi David, All,
>>
>> It works well for me, but would you please shed some light on a problem I
>>
> am
>
>> having with both old and new versions?
>>
>> What I am trying to do is to draw a closed profile and use it to cut a 3D
>> image. I have a closed spline on a plane, extrude it in the normal
>>
> direction
>
>> by vtkLinearExtrusionFilter with capping on. (Unfortunately, this
>>
> extrusion
>
>> filter does not generate capping surfaces for this case.) Then I use
>> vtkPolyDataToImageStencil to convert the extruded vtkPolyData into image
>> stencil like a cookie cutter, and use vtkImageStencil to cut the dataset.
>> What I expected here is vtkPolyDataToImageStencil can give me a volume,
so
>> that I can get the inside or outside part of my dataset by
>>
> vtkImageStencil.
>
>> This works very well except when the spline is on YZ plane and the
extrude
>> direction is X axis, where I only get points on the surface instead of a
>> volume. Does this have anything to do with the raterization algorithm in
>> vtkPolyDataToImageStencil? If vtkPolyDataToImageStencil raterizes the
>> extrusion along X Axis, I do not get a volume?
>>
>> Your help is greatly appreciated!
>>
>> Thanks,
>>
>> Frank
>>
>> -----Original Message-----
>> From: David Gobbi [mailto:dgobbi at atamai.com]
>> Sent: Tuesday, May 22, 2007 5:09 PM
>> To: gao at mdimaging.com
>> Cc: Vtkusers at Vtk.Org
>> Subject: Re: [vtkusers] Possible Bug in vtkPolyDataToImageStencil
>>
>> Hi Frank,
>>
>> Sure thing.   Let me know how it works for you.
>>
>>  - David
>>
>>
>>
>> Frank Gao wrote:
>>
>>
>>> Hi David,
>>>
>>> I am using vtkPolyDataToImageStencil, and saw an earlier email thread as
>>>
>>>
>> below.
>>
>>
>>> Most of the time I am getting good results but have same issue as Jesus.
>>>
>>>
>> Would it be possible for you to send me a copy of another
>> vtkPolyDataToImageStencil class you mentioned in your post?
>>
>>
>>> Thanks in advance,
>>>
>>> Frank Gao
>>>
>>>
> --
> Internal Virus Database is out-of-date.
> Checked by AVG Free Edition.
> Version: 7.5.446 / Virus Database: 268.18.26/748 - Release Date: 4/5/2007
> 3:33 PM
>
> --
> Internal Virus Database is out-of-date.
> Checked by AVG Free Edition.
> Version: 7.5.446 / Virus Database: 268.18.26/748 - Release Date: 4/5/2007
> 3:33 PM
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>

--
Internal Virus Database is out-of-date.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.26/748 - Release Date: 4/5/2007
3:33 PM

--
Internal Virus Database is out-of-date.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.26/748 - Release Date: 4/5/2007
3:33 PM





More information about the vtkusers mailing list