[vtkusers] going from binary images to 2D contours

Jothybasu Selvaraj jothybasu at gmail.com
Thu Mar 1 04:33:07 EST 2012


Will this help you

http://www.insight-journal.org/browse/publication/316

Jothy

On Thu, Mar 1, 2012 at 4:17 AM, Mark Roden <mmroden at gmail.com> wrote:

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


-- 
Jothy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120301/f4fe7c91/attachment.htm>


More information about the vtkusers mailing list