[Insight-users] filter a requested region
Anna Vignati
vignati at isi.it
Thu Mar 20 11:34:41 EDT 2008
Hi all,
i'm trying to process only a subregion (B) of an inputImage (A) and then
having an outputImage being the inputImage A with the subregion B
filtered.
In 2003, someone propose to solve the same problem doing:
someFilter->SetInput( someReader->GetOutput() );
someFilter->GetOutput()->SetRequestedRegion( bRegion );
someFilter->Update();
to obtain an image with the dimension of the subregion, containing the
subregion filtered, and then use pasteFilter to obtain as output the
inputRegion (A) with the subregion B filtered.
In my case, the filter I'm using is the BinaryThresholdingImageFilter. The
problem is that, when i'm doing:
binaryThresholdFilter->SetInput( someReader->GetOutput() );
binaryThresholdFilter->GetOutput()->SetRequestedRegion( bRegion );
binaryThresholdFilter->Update();
I obtain as output the whole input image filtered!!
I know how to set the requested region, but I don't know how to tell a
filter to work only on that requested region!
At the moment, I solve the problem using the RegionOfInterestImageFilter
in combination with PasteImageFilter in the following way:
regionOfInterestFilter->SetInput(reader->GetOutput());
regionOfInterestFilter->SetRegionOfInterest( region );
regionOfInterestFilter ->Update();
binaryThresholdFilter->SetInput( regionOfInterestFilter ->GetOutput() );
binaryThresholdFilter->Update();
pasteFilter->SetInput(reader->GetOutput());
pasteFilter ->SetSourceImage(binaryThresholdFilter->GetOutput());
pasteFilter ->
SetSourceRegion(binaryThresholdFilter->GetOutput()->GetLargestPossibleRegion());
pasteFilter ->SetDestinationImage(reader->GetOutput());
pasteFilter ->SetDestinationIndex(startIndex) ;
pasteFilter ->Update();
writer->SetInput(paste Filter->GetOutput() );
Thanks in advance.
Anna
More information about the Insight-users
mailing list