<br><br><div class="gmail_quote">On Wed, Dec 22, 2010 at 4:34 AM, Dean Inglis <span dir="ltr"><<a href="mailto:dean.inglis@camris.ca">dean.inglis@camris.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Mark,<br>
<br>
here are some possible solutions to 1 for now:<div class="im"><br>
<br>
1) the ability to determine if one polydata is entirely contained<br>
within another (I don't think that this is trivial, given how<br>
contorted these polydata can be)<br>
<br></div>
- a first rejection test: form bounding boxes (see vtkBoundingBox) and<br>
do simple range inclusion tests:<br>
   myvtkBoundingBox.AddBounds(myvtkPolyData.GetBounds())<br>
   myvtkBoundingBox.Contains( anothervtkBoundingBox )<br>
- triangulate the outer polygon and then do point inclusion tests<br>
against the resulting triangles with the inner polygon vertices<br></blockquote><div><br>IMHO this step may be harder than stated for non-convex polygons. Last I checked (few years ago) constrained triangulation using vtkDelaunay2D produced an output with holes.<br>
<br>Alternatively vtkPolygon::PointInPolygon test for each of the inner vertices against the outer polygon should work, although it would be slower.<br><br>Thanks<br>--<br>karthik<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

- perform edge intersection tests<br>
<br>
the last two options could be made somewhat efficient if you<br>
make use of appropriate vtkLocator subclasses.<div class="im"><br>
<br>
Dean<br>
<br>
----- Original Message ----- From: "Mark Roden" <<a href="mailto:mmroden@gmail.com" target="_blank">mmroden@gmail.com</a>><br></div>
To: "Dean Inglis" <<a href="mailto:dean.inglis@camris.ca" target="_blank">dean.inglis@camris.ca</a>><br>
Cc: <<a href="mailto:vtk-developers@vtk.org" target="_blank">vtk-developers@vtk.org</a>><br>
Sent: Tuesday, December 21, 2010 11:29 AM<br>
Subject: Re: [vtk-developers] Problem writing out 'hollow' contours inrtstructs<div><div></div><div class="h5"><br>
<br>
<br>
Hi Dean,<br>
<br>
Yes, this is it exactly, and how Eclipse handles this case.  As to how<br>
they do it, as far as I know, their source is not opened.<br>
<br>
One possible solution is to identify those two polygons and look for<br>
the 'leftmost' or 'topmost' points in each (ie, the point with the<br>
lowest x value or the lowest y value), but that assumes that the two<br>
polygons have been sampled identically-- if one were drawn such that<br>
the underlying points were spaced 10 pixels apart, and the other 2,<br>
then the 'leftmost' or 'topmost' might not line up.  If there were a<br>
way to arbitrarily resample a polydata to ensure single-pixel spacing,<br>
then that sampling issue would be solved.<br>
<br>
Another possible problem is folds in the outer polygon.  If the outer<br>
polygon has a 'ripple' near the leftmost/topmost point, then the<br>
keyhole shouldn't be opened with the leftmost point in the polygon,<br>
but with the closest point.<br>
<br>
So, with that in mind, I'd need two functions:<br>
1) the ability to determine if one polydata is entirely contained<br>
within another (I don't think that this is trivial, given how<br>
contorted these polydata can be)<br>
2) Joining two polydata with a keyhole, using the 'topmost' point of<br>
the inner polydata to the closest point on the outer polydata<br>
<br>
Thanks,<br>
Mark<br>
<br>
On Mon, Dec 20, 2010 at 5:34 PM, Dean Inglis <<a href="mailto:dean.inglis@camris.ca" target="_blank">dean.inglis@camris.ca</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Mark,<br>
<br>
I think if you have a donut for example, and want<br>
to encode it you would have to form the donut<br>
by bringing the free ends of a "C" arbitrarily close<br>
together so that you really only have one vtkPolyData<br>
object. I think if this example of a rectangle with a hole<br>
reproduces correctly in the list archive, you'll see what I<br>
mean:<br>
<br>
0----------1<br>
| 5---4 |<br>
| | | |<br>
| | 3---2<br>
| | 8---9<br>
| | | |<br>
| 6---7 |<br>
11---------10<br>
<br>
<br>
points 3, 8 and 2, 9 are coincident and form the keyhole.<br>
I this how Eclipse accomplishes this? The problem still<br>
remains how to cut arbitrary polydata automatically:<br>
maybe by finding the inner polygon centroid and<br>
emanating a radial outward?<br>
<br>
Dean<br>
<br>
----- Original Message ----- From: "Mark Roden" <<a href="mailto:mmroden@gmail.com" target="_blank">mmroden@gmail.com</a>><br>
To: <<a href="mailto:vtk-developers@vtk.org" target="_blank">vtk-developers@vtk.org</a>><br>
Sent: Monday, December 20, 2010 7:25 PM<br>
Subject: [vtk-developers] Problem writing out 'hollow' contours in rtstructs<br>
<br>
<br>
Hi all,<br>
<br>
I've got a problem writing out RTStruct objects using GDCM. The<br>
problem isn't with GDCM or VTK as they stand now, but rather with a<br>
particular section of the DICOM standard (3.3-2009 C 8.8.6.3). The<br>
problem has to do with a 'hollow' contour, or a polygon entirely<br>
encompassed within another polygon.<br>
<br>
To quote:<br>
When a single ROI describes an excluded inner volume, this can be<br>
encoded with a single contour, using a “keyhole” technique. In this<br>
method, an arbitrarily narrow channel is used to connect the outer<br>
contour to the inner contour, so that it is drawn as a single contour.<br>
An example of such a structure is shown in Figure C.8.8.6-1.<br>
<br>
If I have a set of vtkPolyData objects on a particular plane, is there<br>
an easy way to accomplish the above functionality?<br>
<br>
As I understand it, vtkPolyData are (or can be) oriented glyphs that<br>
indicate how a polygon should be drawn. If I were to just connect any<br>
two polydata objects, I'd imagine that would would need to be<br>
reversed. Is that understanding correct?<br>
<br>
Or if I made a binary representation of the mask that had a hollow in<br>
it, is there a way to indicate to the marching cubes to use the<br>
keyhole to join the inner and outer polygons?<br>
<br>
Part of the problem of this keyhole technique is the use of the words<br>
'can be encoded'-- so while it's possible that other schemes could be<br>
used, this scheme is the only one suggested by the standard and is the<br>
one supported by Eclipse (and as far as I know, Eclipse's<br>
implementation is the one to match at the moment).<br>
<br>
Thanks,<br>
Mark<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
<br>
</blockquote>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
</div></div></blockquote></div><br>