[Insight-users] setRequestRegion + ConnectedComponent filter
jerome schmid
jerome.schmid at ircad.u-strasbg.fr
Mon Jun 7 06:55:38 EDT 2004
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
More information about the Insight-users
mailing list