[Insight-users] setRequestRegion + ConnectedComponent filter

Miller, James V (Research) millerjv at crd.ge.com
Mon Jun 7 13:29:52 EDT 2004


ConnectedComponents needs the entire input inorder to ensure the
components within your initial requested region are properly labelled.
A component could leave your initial requested region and loop back
into the region on (perhaps) another boundary). In the process of
calculating
the region you request, the algorithm has to label every pixel in the
image anyway, so it just outputs everything.

If you only want to label objects within a region, and you are confident
that an object does not leave the region and re-enter, then you'll need
to use ExtractImageFilter or RegionOfInterestImageFilter prior to running
the connected components.

Jim



-----Original Message-----
From: jerome schmid [mailto:jerome.schmid at ircad.u-strasbg.fr]
Sent: Monday, June 07, 2004 6:56 AM
To: insight-users at itk.org
Subject: [Insight-users] setRequestRegion + ConnectedComponent filter


Hi everybody,


I have some trouble in setting an Region of interest( roi ) for connected
component filter. I don't know why but I set a requested region very small
and the filter works on all the image. I put a breakpoint in the
generateData() function of iktConnectedComponentImageFilter and the
requested region on the output is the whole image...I don't use correctly
roi? I test it with binaryThreshold and it works....

Here a piece of my code:

...
	typedef itk::ConnectedComponentImageFilter< InImageType, InImageType
>
CCFilterType;
	CCFilterType::Pointer ccFilter	= CCFilterType::New();

	// Plug with reader
	ccFilter->SetInput( reader->GetOutput() );

	InImageType::RegionType roi;

	InImageType::IndexType start;
	start[0]	= 305;
	start[1]	= 43;
	start[2]	= 21;

	InImageType::SizeType size;
	size[0]		= 42;
	size[1]		= 89;
	size[2]		= 10;

	roi.SetIndex( start );
	roi.SetSize( size );
	ccFilter->GetOutput()->SetRequestedRegion( roi ); // IS IT
RIGHT?????

	WriterType::Pointer	writer	= WriterType::New();
	writer->SetFileName( "CCimage.inr.gz" );
	writer->SetInput( ccFilter->GetOutput() );
	writer->Update();
...

A last thing, for Connected Component filter, if input image is binary, in
order to define background we set, in input image, intensity values to zero
and foreground values to a value different to zero, isnt'it???


Thanks a lot everybody!!!!!

Jerome

_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-users mailing list