[Insight-users] compare images

Bill Lorensen bill.lorensen at gmail.com
Fri Aug 3 16:40:47 EDT 2012


If you are using itkv4, look at
Modules/Core/TestKernel/include/itkTestingComparisonImageFilter.h. It's
what itk uses for regression testing.


On Fri, Aug 3, 2012 at 4:21 PM, Gerenrot, Mikhail <
mikhail.gerenrot at stryker.com> wrote:

> Hi Team,****
>
> ** **
>
> We need to check if images are equal, and we wrote a method that uses
> iterators and compares pixels:****
>
> bool AreImagesEqual(const ImageType::Pointer & image1, constImageType::Pointer & image2)
> ****
>
> {****
>
>   itk::ImageSliceConstIteratorWithIndex<ImageType> it1( image1,
> image1->GetRequestedRegion() );****
>
>   itk::ImageSliceConstIteratorWithIndex<ImageType> it2( image2,
> image2->GetRequestedRegion() );****
>
> ** **
>
>   PixelType p1;****
>
>   PixelType p2;****
>
> ** **
>
> // loop starts****
>
> …****
>
>   p1 = it1.Get();****
>
>   p2 = it2.Get();****
>
>   if(p1 != p2)****
>
>   {****
>
>     return false;****
>
>   }****
>
> …****
>
> // loop ends****
>
> return true;****
>
> }****
>
> ** **
>
> Is there any better way?****
>
> Any input will be greatly appreciated.****
>
> ** **
>
> Thank you all in advance,****
>
> ** **
>
> Your Mike Gerenrot****
>
> Stryker Corp.****
>
> ** **
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>


-- 
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120803/801e3f2f/attachment.htm>


More information about the Insight-users mailing list