<div dir="ltr">Will this help you<br><br><a href="http://www.insight-journal.org/browse/publication/316">http://www.insight-journal.org/browse/publication/316</a><br><br>Jothy<br><br><div class="gmail_quote">On Thu, Mar 1, 2012 at 4:17 AM, Mark Roden <span dir="ltr">&lt;<a href="mailto:mmroden@gmail.com">mmroden@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi David,<br>
<br>
Maybe I should just send you my data :)  I don&#39;t think that my problem<br>
has to do with being near boundaries, as my objects are away from the<br>
edges of the image (but not in z-- that&#39;s solved that by padding the<br>
image by a plane in either direction in z).<br>
<br>
The problem I&#39;m having is that, somewhere along the way, the contours<br>
are being transformed from &#39;proper&#39; contours, in the case of the<br>
larger mask, to ones with extra connections.<br>
<br>
The binarization is done via the process we discussed on the other<br>
thread; that is, the contour is binarized by first following that<br>
function to translate polygons to lines, then<br>
vtkPolyDataToImageStencil, then vtkImageStencil.  The reverse, from<br>
binary to contour (which actually appears on the image), is done by<br>
vtkMarchingCubes.  This output has extra lines.<br>
<br>
I would love to be able to intercept the binary mask in transit, but<br>
unfortunately, some way that I have vtkImageViewer2 set up isn&#39;t<br>
allowing me to see it.  However, you can see the body mask from the<br>
contour image &#39;body lines.png&#39; I&#39;ve attached, and then from the second<br>
overlay image &#39;body with strange lines.png&#39; the extra lines on a<br>
single plane when overlaid with the data.<br>
<br>
Have you seen this kind of behavior before in either method?  That<br>
this behavior appeared either when I ran the old extrusion method or<br>
with the new line-based method suggests to me that it&#39;s a problem with<br>
the marching squares approach.  Hence my original question.<br>
<br>
Thanks,<br>
<font color="#888888">Mark<br>
</font><div><div></div><div class="h5"><br>
On Wed, Feb 29, 2012 at 4:10 PM, David Gobbi &lt;<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>&gt; wrote:<br>
&gt; My own experience is that vtkMarchingSquares is the best way to<br>
&gt; contour a 2D image.  It is the only 2D contouring filter I&#39;m aware of<br>
&gt; that correctly orients the contours, i.e. so that you can be sure what<br>
&gt; is &quot;inside&quot; and what is &quot;outside.&quot;<br>
&gt;<br>
&gt; But vtkMarchingSquares generates open contours whenever the contour<br>
&gt; reaches the bounds of the image... that might be the cause of the<br>
&gt; failures that you are seeing.  Because of this problem, I&#39;ve written<br>
&gt; my own version of marching squares that always produces closed<br>
&gt; contours, you can find the code here:<br>
&gt; <a href="https://github.com/dgobbi/ToolCursor/blob/master/vtkImageToROIContourData.cxx" target="_blank">https://github.com/dgobbi/ToolCursor/blob/master/vtkImageToROIContourData.cxx</a><br>
&gt;<br>
&gt;  - David<br>
&gt;<br>
&gt;<br>
&gt; On Wed, Feb 29, 2012 at 4:43 PM, Mark Roden &lt;<a href="mailto:mmroden@gmail.com">mmroden@gmail.com</a>&gt; wrote:<br>
&gt;&gt; Hi all,<br>
&gt;&gt;<br>
&gt;&gt; After a length conversation over on the developer list, I&#39;ve now got a<br>
&gt;&gt; very fast way to convert 2D contours from DICOM rtstructs into binary<br>
&gt;&gt; data.  Now I need to do the reverse.  I already have a method, but<br>
&gt;&gt; this approach is failing for large images-- and by &#39;failing&#39;, I mean<br>
&gt;&gt; producing contours that do not look like the binary data.<br>
&gt;&gt;<br>
&gt;&gt; I need contours in the xy, xz, and yz planes.  It&#39;s also possible to<br>
&gt;&gt; have multiple contours in any given plane.<br>
&gt;&gt;<br>
&gt;&gt; Right now, I&#39;m using vtkMarchingSquares, but as I said, this is not<br>
&gt;&gt; working for larger contours, and produces spurious results.<br>
&gt;&gt;<br>
&gt;&gt; I note that there&#39;s also vtkContourFilter, vtkMarchingContourFilter,<br>
&gt;&gt; vtkSliceCubes, vtkImageMarchingCubes, etc.  Is there any reason to<br>
&gt;&gt; choose one of these over the other?  What would I need for my<br>
&gt;&gt; particular case?<br>
&gt;&gt;<br>
&gt;&gt; Thanks,<br>
&gt;&gt; Mark<br>
</div></div><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>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">Jothy<br></div><br>
</div>