<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
Thanks Sergiy for your precious help.<br><br>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 :)...).<br><br>I'm trying to compile my code with the lines that you send me, but I have a problem. The output is:<br><br>Floating point exception<br><br>The process isn't aborted but in output I don't have the image Dfinal... :(<br>I don't understand where is the problem... it could be that my images are DICOM and so there are problem with float operation?<br><br>Thanks,<br>Daniela<br><br><br>> Date: Fri, 6 Aug 2010 07:15:48 -0700<br>> From: volkovych@gmail.com<br>> To: insight-users@itk.org<br>> Subject: Re: [Insight-users] itkDifferenceImageFilter: Comparison between        two images<br>> <br>> <br>> Hi, Daniela.<br>> <br>> I would use iterators for your purpose.<br>> <br>> It might be something like this (if all your images are of type ImageType<br>> and Dfinal, Daverage and D are pointers to this images):<br>> <br>> typedef itk::ImageRegionIterator<ImageType> IteratorType;<br>> typedef itk::ImageRegionConstIterator<ImageType> ConstIteratorType;<br>> <br>> IteratorType DfinalIt (Dfinal, Dfinal->GetRequestedRegion());<br>> ConstIteratorType DaverageIt (Daverage, Daverage->GetRequestedRegion());<br>> ConstIteratorType DIt (D , D->GetRequestedRegion());<br>> <br>> for (DfinalIt.GoToBegin(), DaverageIt.GoToBegin(), DIt.GoToBegin();<br>> !DaverageIt.IsAtEnd(); ++DfinalIt, ++DaverageIt, ++DIt)<br>> DfinalIt.Set(DaverageIt.Get() < DIt.Get() - 0.5 ? 1 : 0);<br>> <br>> After this code Dfinal image will have "1" value at voxels where Daverage <<br>> D - 0.5.<br>> <br>> If you have only images Daverage and D, before applying this code you should<br>> create Dfinal by yourself like this:<br>> <br>> ImageType::Pointer Dfinal = ImageType::New();<br>> Dfinal->SetBufferedRegion( Dfinal->GetRequestedRegion() );<br>> Dfinal->Allocate();<br>> <br>> Good luck :)<br>> -- <br>> View this message in context: http://itk-insight-users.2283740.n2.nabble.com/itkDifferenceImageFilter-Comparison-between-two-images-tp5380586p5380719.html<br>> Sent from the ITK Insight Users mailing list archive at Nabble.com.<br>> _____________________________________<br>> Powered by www.kitware.com<br>> <br>> Visit other Kitware open-source projects at<br>> http://www.kitware.com/opensource/opensource.html<br>> <br>> Kitware offers ITK Training Courses, for more information visit:<br>> http://www.kitware.com/products/protraining.html<br>> <br>> Please keep messages on-topic and check the ITK FAQ at:<br>> http://www.itk.org/Wiki/ITK_FAQ<br>> <br>> Follow this link to subscribe/unsubscribe:<br>> http://www.itk.org/mailman/listinfo/insight-users<br>                                            </body>
</html>