[ITK] [ITK-users] Extract points from BinaryContourImageFilter

gruizz ruiz1.gabriel at gmail.com
Sat May 9 19:54:57 EDT 2015


Hello,

I use BinaryContourImageFilter and it works great, but I want to be able to
extract the points in the contour(s) it finds.

For the time being, I have to iterate through the output of the filter and
find the pixels that are in the foreground (the contour) in order to get the
pixel coordinates.

Here's a sample of what I am currently doing:

binaryContourImageFilterType::Pointer binaryContourFilter
			= binaryContourImageFilterType::New();
		binaryContourFilter->SetInput(someFilter->GetOutput());
		binaryContourFilter->Update();

		ImageType::Pointer im = binaryContourFilter->GetOutput();
		ImageType::RegionType region = im->GetBufferedRegion();
		
		ImageType::SizeType size = region.GetSize();

		itk::ImageRegionConstIterator<ImageType> it(im, region);

		it.GoToBegin();

		for (scroll through the region vertically ++)
		{
			for (scroll through the region horizontally ++)
			{
				if (it.Get() == 255)
				{
						points.append( this point(x,y) );
				}
				++it;
			}
		}
//where points is a vector i used to store the points of the contour

So, is there a way to get these points directly from
BinaryContourImageFilter?

Thank you for your time!



--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Extract-points-from-BinaryContourImageFilter-tp7587330.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list