[vtkusers] going from binary images to 2D contours
David Gobbi
david.gobbi at gmail.com
Wed Feb 29 19:10:17 EST 2012
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
More information about the vtkusers
mailing list