<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"><<a href="mailto:mmroden@gmail.com">mmroden@gmail.com</a>></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'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's solved that by padding the<br>
image by a plane in either direction in z).<br>
<br>
The problem I'm having is that, somewhere along the way, the contours<br>
are being transformed from 'proper' 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't<br>
allowing me to see it. However, you can see the body mask from the<br>
contour image 'body lines.png' I've attached, and then from the second<br>
overlay image 'body with strange lines.png' 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'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 <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>> wrote:<br>
> My own experience is that vtkMarchingSquares is the best way to<br>
> contour a 2D image. It is the only 2D contouring filter I'm aware of<br>
> that correctly orients the contours, i.e. so that you can be sure what<br>
> is "inside" and what is "outside."<br>
><br>
> But vtkMarchingSquares generates open contours whenever the contour<br>
> reaches the bounds of the image... that might be the cause of the<br>
> failures that you are seeing. Because of this problem, I've written<br>
> my own version of marching squares that always produces closed<br>
> contours, you can find the code here:<br>
> <a href="https://github.com/dgobbi/ToolCursor/blob/master/vtkImageToROIContourData.cxx" target="_blank">https://github.com/dgobbi/ToolCursor/blob/master/vtkImageToROIContourData.cxx</a><br>
><br>
> - David<br>
><br>
><br>
> On Wed, Feb 29, 2012 at 4:43 PM, Mark Roden <<a href="mailto:mmroden@gmail.com">mmroden@gmail.com</a>> wrote:<br>
>> Hi all,<br>
>><br>
>> After a length conversation over on the developer list, I've now got a<br>
>> very fast way to convert 2D contours from DICOM rtstructs into binary<br>
>> data. Now I need to do the reverse. I already have a method, but<br>
>> this approach is failing for large images-- and by 'failing', I mean<br>
>> producing contours that do not look like the binary data.<br>
>><br>
>> I need contours in the xy, xz, and yz planes. It's also possible to<br>
>> have multiple contours in any given plane.<br>
>><br>
>> Right now, I'm using vtkMarchingSquares, but as I said, this is not<br>
>> working for larger contours, and produces spurious results.<br>
>><br>
>> I note that there's also vtkContourFilter, vtkMarchingContourFilter,<br>
>> vtkSliceCubes, vtkImageMarchingCubes, etc. Is there any reason to<br>
>> choose one of these over the other? What would I need for my<br>
>> particular case?<br>
>><br>
>> Thanks,<br>
>> 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>