<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.6944.0">
<TITLE>RE: [Insight-users] fast binary dilate image filter</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<BR>
<BR>

<P><FONT SIZE=2>Hi Gaetan,<BR>
<BR>
Happy to see that you find time to work on it, from my side is it still quite difficult T_T<BR>
<BR>
Anyway the part you are mentionning is directly taken from the paper quotated in the source. In fact this part take in account the translation required in case of structuring element which are *not* centered. Try to use this kind of SE:<BR>
<BR>
00001<BR>
00001<BR>
00001<BR>
00001<BR>
00000<BR>
<BR>
this is a 5x5 SE not centered, i.e. center not on. This kind of SE will produce a kind of &quot;shift&quot;. In your case I suppose that your SE is a standard SE, i.e. an ellipsoid or something similar that is centered. Is it true that in many case we use centered SE. Try with this SE with and without the code part and see the difference. Use another lib or a pencil and paper to check the result. If it doesn't change nothing I will try to find the time to look at my code.<BR>
<BR>
BTW are do you know if the threading porting of the filter is on the way?<BR>
<BR>
Thanks.<BR>
<BR>
Best Regards,<BR>
<BR>
Jerome Schmid<BR>
<BR>
---------------------------------------------<BR>
Jerome SCHMID<BR>
Project Manager / Engineer<BR>
Augmented and Virtual Reality<BR>
Minimally Invasive Surgical Skills Center (MIS)<BR>
<A HREF="http://www.hkmisc.org.hk/">http://www.hkmisc.org.hk/</A><BR>
Prince of Wales Hospital<BR>
Chinese University Of Hong-Kong<BR>
----------------------------------------------<BR>
<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: Gaetan Lehmann [<A HREF="mailto:gaetan.lehmann@jouy.inra.fr">mailto:gaetan.lehmann@jouy.inra.fr</A>]<BR>
Sent: Fri 2/3/2006 4:58 AM<BR>
To: SCHMID, Jerome<BR>
Cc: insight-users@itk.org<BR>
Subject: Re: [Insight-users] fast binary dilate image filter<BR>
<BR>
<BR>
Hi Jerome,<BR>
<BR>
I'm again working on binary dilate filter.<BR>
<BR>
I don't understand what the last part of the code is for.<BR>
<BR>
&nbsp; while( !ouRegIndexIt.IsAtEnd() )<BR>
&nbsp;&nbsp;&nbsp; {<BR>
&nbsp;&nbsp;&nbsp; // Retrieve index of current output pixel<BR>
&nbsp;&nbsp;&nbsp; IndexType currentIndex&nbsp; = ouRegIndexIt.GetIndex();<BR>
&nbsp;&nbsp;&nbsp; for( vecIt = vecBeginIt; vecIt != vecEndIt; ++vecIt )<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Translate<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IndexType translatedIndex = currentIndex - *vecIt;<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // translated index now is an index in input image in the<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // output requested region padded. Theoretically, this translated<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // index must be inside the padded region.<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // If the pixel in the input image at the translated index<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // has a value equal to the dilate one, this means<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // that the output pixel at currentIndex will be on in the output.<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if( inputRegionForThread.IsInside( translatedIndex ) &amp;&amp;<BR>
input-&gt;GetPixel( translatedIndex ) == foregroundValue )<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ouRegIndexIt.Set( foregroundValue );<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break; // Do not need to examine other offsets because at least one<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // input pixel has been translated on current output pixel.<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>
<BR>
&nbsp;&nbsp;&nbsp; ++ouRegIndexIt;<BR>
&nbsp;&nbsp;&nbsp; progress.CompletedPixel();<BR>
&nbsp;&nbsp;&nbsp; }<BR>
<BR>
<BR>
<BR>
In fact, if I drop this part, I get the same output image. Can you explain me<BR>
the role of this code ?<BR>
<BR>
Thanks,<BR>
<BR>
Gaetan<BR>
<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>