[Insight-users] Complementary Image: is there something in itk
Sergiy Volkovych
volkovych at gmail.com
Fri Aug 6 10:23:19 EDT 2010
Suppose your current image pointer is CurrentImage. Then to obtain it's
complementary image you may use code like this:
ImageType::Pointer ComplementaryImage = ImageType::New();
ComplementaryImage->SetBufferedRegion(ComplementaryImage
->GetRequestedRegion());
ComplementaryImage->Allocate();
typedef itk::ImageRegionIterator<ImageType> IteratorType;
typedef itk::ImageRegionConstIterator<ImageType> ConstIteratorType;
IteratorType ComplementaryImageIt (ComplementaryImage,
ComplementaryImage->GetRequestedRegion());
ConstIteratorType CurrentImageIt (CurrentImage,
CurrentImage->GetRequestedRegion());
for (ComplementaryImageIt.GoToBegin(), CurrentImageIt.GoToBegin();
!CurrentImageIt.IsAtEnd(); ++ComplementaryImageIt, ++CurrentImageIt)
ComplementaryImageIt.Set(1 - CurrentImageIt.Get());
Feel yourself free to use iterators - it gives you possibility to do
anything you want :)
--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Complementary-Image-is-there-something-in-itk-tp5380665p5380739.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.
More information about the Insight-users
mailing list