[Insight-users] itkDifferenceImageFilter: Comparison between two images
Sergiy Volkovych
volkovych at gmail.com
Fri Aug 6 10:15:48 EDT 2010
Hi, Daniela.
I would use iterators for your purpose.
It might be something like this (if all your images are of type ImageType
and Dfinal, Daverage and D are pointers to this images):
typedef itk::ImageRegionIterator<ImageType> IteratorType;
typedef itk::ImageRegionConstIterator<ImageType> ConstIteratorType;
IteratorType DfinalIt (Dfinal, Dfinal->GetRequestedRegion());
ConstIteratorType DaverageIt (Daverage, Daverage->GetRequestedRegion());
ConstIteratorType DIt (D , D->GetRequestedRegion());
for (DfinalIt.GoToBegin(), DaverageIt.GoToBegin(), DIt.GoToBegin();
!DaverageIt.IsAtEnd(); ++DfinalIt, ++DaverageIt, ++DIt)
DfinalIt.Set(DaverageIt.Get() < DIt.Get() - 0.5 ? 1 : 0);
After this code Dfinal image will have "1" value at voxels where Daverage <
D - 0.5.
If you have only images Daverage and D, before applying this code you should
create Dfinal by yourself like this:
ImageType::Pointer Dfinal = ImageType::New();
Dfinal->SetBufferedRegion( Dfinal->GetRequestedRegion() );
Dfinal->Allocate();
Good luck :)
--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/itkDifferenceImageFilter-Comparison-between-two-images-tp5380586p5380719.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.
More information about the Insight-users
mailing list