[Insight-users] itkDifferenceImageFilter: Comparison between two images

Daniela Sacchetto danysunflower at hotmail.it
Fri Aug 6 11:24:26 EDT 2010


Thanks Sergiy for your precious help.

I did what you suggested me (yes, you are right, the iterators seem to be very useful and it'll be good if I 'll learn to use them very well :)...).

I'm trying to compile my code with the lines that you send me, but I have a problem. The output is:

Floating point exception

The process isn't aborted but in output I don't have the image Dfinal... :(
I don't understand where is the problem... it could be that my images are DICOM and so there are problem with float operation?

Thanks,
Daniela


> Date: Fri, 6 Aug 2010 07:15:48 -0700
> From: volkovych at gmail.com
> To: insight-users at itk.org
> Subject: Re: [Insight-users] itkDifferenceImageFilter: Comparison between	two images
> 
> 
> 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.
> _____________________________________
> 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.html
> 
> 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
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100806/a2764f4c/attachment.htm>


More information about the Insight-users mailing list