[Insight-users] ContourExtractor2DImageFilter in python
Rick Giuly
rgiuly at gmail.com
Thu Jul 2 23:51:45 EDT 2009
Hello All,
I'm trying to get a contour as a list of points from a binary image of a
blob. I'm assuming that ContourExtractor2DImageFilter is the easiest way
to do this, considering what filters are available in python.
extractor.GetOutputs() returns a DataObjectPointer, I'm not sure how to
access the individual elements of this in python. Could someone advise?
(I will need to access each of the contours and each of the points in
each contour.)
Thanks
-Rick
----
import itk
ImageType = itk.Image[itk.F, 2]
ReaderType = itk.ImageFileReader[ImageType]
reader = ReaderType.New(FileName = "data/A.tiff")
image = reader.GetOutput()
ExtractorType = itk.ContourExtractor2DImageFilter[ImageType]
extractor = ExtractorType.New()
extractor.SetInput(image)
extractor.SetContourValue(100.0)
extractor.Update()
print extractor.GetNumberOfOutputs()
print extractor.GetOutputs()
# how should I access individual contours?
More information about the Insight-users
mailing list