<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Cory,<div><br></div><div>Thank you for your reply.</div><div><br></div><div>However, you said I have to compute distance from each point to my plane, then use vtkContourFilter.</div><div>But I think it would be really heavy computation to compute distance from each point to the plane every time I move the plane, isn't it ?</div><div><br></div><div>I would like to be able to display the intersection while the plane is moving. If I have a polydata like a bone or a skull or something like that, it would be really long to compute this distance, isn't it ?</div><div><br></div><div>Thank you.<br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>-Laurent</div><div><br></div></div></span></div></span></div></span></div></span></div></span></span><br class="Apple-interchange-newline">
</div>
<br><div><div>On Jun 24, 2013, at 10:04 AM, Cory Quammen &lt;<a href="mailto:cquammen@cs.unc.edu">cquammen@cs.unc.edu</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">On Sun, Jun 23, 2013 at 12:41 PM, Laurent Chauvin<br>&lt;<a href="mailto:lchauvin@bwh.harvard.edu">lchauvin@bwh.harvard.edu</a>&gt; wrote:<br><blockquote type="cite">Hi Cory,<br><br>Thank you very much for your reply.<br>However, I'm not sure to understand what you mean.<br>Should I create a new polydata with all points at the same z coordinates ?<br></blockquote><br>Laurent,<br><br>You don't need to create a new polydata. Instead, you can add a new<br>vtkDataArray (likely a vtkFloatArray or vtkDataArray in this case) to<br>the point data of whatever polydata you already have by using<br>vtkPolyData::GetPointData()-&gt;AddArray(...).<br><br>For axis-aligned planes, this new array could simply contain the x, y,<br>or z coordinate of each of the points in your vtkPolyData. If you want<br>an intersection of your poly data with a plane spanning x and y, you<br>would add a point data array storing all the z values. You can then<br>use the vtkContourFilter to get the polydata consisting of line<br>segments that represents the intersection of your polydata with the<br>plane at a given z value by specifying that z value as the isolevel<br>for the contour filter. You have to make sure you tell the<br>vtkContourFilter to use your new coordinate array.<br><br>For an quick example of this concept, I've attached a simple ParaView<br>statefile showing how you can do this for a cylinder polydata. In this<br>example, I've specified my plane as spanning the x and y coordinates<br>with z value 0.2. In ParaView, I've used the Calculator to compute the<br>array consisting of the z coordinates of each point in the cylinder.<br>Forgive me if you don't have ParaView installed, we use it all the<br>time when prototyping visualizations.<br><br><blockquote type="cite">Does this work with some oblique planes ( not parallel to x,y, or z axis ) ?<br></blockquote><br>For the general case of an arbitrary plane, you would want to compute<br>the distance from each point your desired plan instead of creating a<br>new array containing the x, y, or z coordinates of each point. Then<br>you would set the vtkContourFilter isolevel to 0. The point plane<br>calculation is pretty simple:<br><a href="http://mathworld.wolfram.com/Point-PlaneDistance.html">http://mathworld.wolfram.com/Point-PlaneDistance.html</a><br><br>Does that make sense?<br><br><blockquote type="cite">Thank you.<br>-Laurent<br><br><br>On Sun, Jun 23, 2013 at 12:31 PM, Cory Quammen &lt;cquammen@cs.unc.edu&gt; wrote:<br><blockquote type="cite"><br>Laurent,<br><br>For this special case of computing the intersection between a polydata<br>and a plane, you can use a little trick. First, you can compute a new<br>point data set for your polydata with,say, the z coordinates of each<br>point in the polydata. Then, to get the intersection with an xy plane,<br>you then use the vtkContourFilter operating on this coordinate point<br>data and specify the z value that corresponds to your plane. The<br>result should be equivalent to the intersection of the polydata with<br>that plane.<br><br>It should be relatively fast to compute the contour, so you can<br>probably do this interactively.<br><br>Hope that helps,<br>Cory<br><br>On Sat, Jun 22, 2013 at 2:46 PM, Laurent Chauvin<br>&lt;lchauvin@bwh.harvard.edu&gt; wrote:<br><blockquote type="cite">Hello,<br><br>I'm working on Slicer, and I was trying to find a nice way to display<br>intersection between polydata and a plane.<br>I read we could use a vtkCutter, but the thing is, I would like to do<br>this<br>interactively. I want to be able to move the plane, and update the<br>intersection while moving the plane.<br>I'm not sure using vtkCutter for this purpose would work. I think<br>vtkCutter<br>will take some times to execute, then moving the plane will be slow.<br><br>I know this question has been asked before, but I would like if there<br>were<br>some update since then. New widgets or object that I could use for that<br>?<br><br>I was thinking using vtkImageReslice, get polydata of the plane and<br>compute<br>the intersection between the 2 polydata, but I think it would also be to<br>computing intensive to be able to do it smoothly with an interactive<br>plane.<br><br>Thank you.<br>-Laurent<br><br><br><br><br>_______________________________________________<br>Powered by www.kitware.com<br><br>Visit other Kitware open-source projects at<br>http://www.kitware.com/opensource/opensource.html<br><br>Please keep messages on-topic and check the VTK FAQ at:<br>http://www.vtk.org/Wiki/VTK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.vtk.org/mailman/listinfo/vtkusers<br><br></blockquote><br><br><br>--<br>Cory Quammen<br>Research Associate<br>Department of Computer Science<br>The University of North Carolina at Chapel Hill<br></blockquote><br><br><br><br>--<br>Laurent Chauvin, MS<br>Surgical Navigation and Robotics Laboratory, Radiology<br>Brigham And Women's Hospital, Harvard Medical School<br>http://wiki.ncigt.org/index.php/User:Lchauvin<br></blockquote><br><br><br>--<br>Cory Quammen<br>Research Associate<br>Department of Computer Science<br>The University of North Carolina at Chapel Hill<br><span>&lt;PlaneIntersectionExample.pvsm&gt;</span></blockquote></div><br></div></body></html>