<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<div>Hi - Looking at <span>ITK\Modules\Filtering\BinaryMathematicalMorphology\include\itkBinaryErodeImageFilter.hxx, I am a bit confused with regards to the padding and cropping of the regions for example, in the snippet below:</span></div>
<div><span><br>
</span></div>
<div><span>
<pre style="font-family:Consolas;font-size:13;color:gainsboro;background:#1e1e1e;"><span style="color:#569cd6;">ypename</span> <span style="color:#4ec9b0;">TInputImage</span><span style="color:#b4b4b4;">::</span><span style="color:#4ec9b0;">RegionType</span> <span style="color:#c8c8c8;">tmpRequestedRegion</span> <span style="color:#b4b4b4;">=</span> <span style="color:#c8c8c8;">outputRegion</span><span style="color:#b4b4b4;">;</span>
<span style="color:#569cd6;">typename</span> <span style="color:#4ec9b0;">TInputImage</span><span style="color:#b4b4b4;">::</span><span style="color:#4ec9b0;">RegionType</span> <span style="color:#c8c8c8;">paddedInputRegion</span> <span style="color:#b4b4b4;">=</span>
<span style="color:#c8c8c8;">input</span><span style="color:#b4b4b4;">-></span>GetBufferedRegion<span style="color:#b4b4b4;">();</span>
<span style="color:#c8c8c8;">paddedInputRegion</span><span style="color:#b4b4b4;">.</span>PadByRadius<span style="color:#b4b4b4;">(</span><span style="color:#c8c8c8;">radius</span><span style="color:#b4b4b4;">);</span> <span style="color:#57a64a;">// to support boundary values</span>
<span style="color:#4ec9b0;">InputSizeType</span> <span style="color:#c8c8c8;">padBy</span> <span style="color:#b4b4b4;">=</span> <span style="color:#c8c8c8;">radius</span><span style="color:#b4b4b4;">;</span>
<span style="color:#569cd6;">for</span> <span style="color:#b4b4b4;">(</span> <span style="color:#c8c8c8;">i</span> <span style="color:#b4b4b4;">=</span> <span style="color:#b5cea8;">0</span><span style="color:#b4b4b4;">;</span> <span style="color:#c8c8c8;">i</span> <span style="color:#b4b4b4;"><</span> <span style="color:#c8c8c8;">KernelDimension</span><span style="color:#b4b4b4;">;</span> <span style="color:#b4b4b4;">++</span><span style="color:#c8c8c8;">i</span> <span style="color:#b4b4b4;">)</span>
<span style="color:#b4b4b4;">{</span>
<span style="color:#c8c8c8;">padBy</span><span style="color:#b4b4b4;">[</span><span style="color:#c8c8c8;">i</span><span style="color:#b4b4b4;">]</span> <span style="color:#b4b4b4;">=</span> <span style="color:#b4b4b4;">(</span> <span style="color:#c8c8c8;">padBy</span><span style="color:#b4b4b4;">[</span><span style="color:#c8c8c8;">i</span><span style="color:#b4b4b4;">]</span> <span style="color:#b4b4b4;">></span> <span style="color:#c8c8c8;">kernel</span><span style="color:#b4b4b4;">.</span>GetRadius<span style="color:#b4b4b4;">(</span><span style="color:#c8c8c8;">i</span><span style="color:#b4b4b4;">)</span> <span style="color:#b4b4b4;">?</span> <span style="color:#c8c8c8;">padBy</span><span style="color:#b4b4b4;">[</span><span style="color:#c8c8c8;">i</span><span style="color:#b4b4b4;">]</span> <span style="color:#b4b4b4;">:</span> <span style="color:#c8c8c8;">kernel</span><span style="color:#b4b4b4;">.</span>GetRadius<span style="color:#b4b4b4;">(</span><span style="color:#c8c8c8;">i</span><span style="color:#b4b4b4;">)</span> <span style="color:#b4b4b4;">);</span>
<span style="color:#b4b4b4;">}</span>
<span style="color:#c8c8c8;">tmpRequestedRegion</span><span style="color:#b4b4b4;">.</span>PadByRadius<span style="color:#b4b4b4;">(</span><span style="color:#c8c8c8;">padBy</span><span style="color:#b4b4b4;">);</span>
<span style="color:#c8c8c8;">tmpRequestedRegion</span><span style="color:#b4b4b4;">.</span>Crop<span style="color:#b4b4b4;">(</span><span style="color:#c8c8c8;">paddedInputRegion</span><span style="color:#b4b4b4;">);</span></pre>
</span></div>
<div><span>It appears that </span><b>tmpRequestedRegion </b>is padded but then immediately cropped, which means it will always be padded by a radius of 1 in each dimension anyways? Similar operations are performed when padding the
<span>inputRegionForThread</span>:</div>
<div><br>
</div>
<div>
<pre style="font-family:Consolas;font-size:13;color:gainsboro;background:#1e1e1e;"><span style="color:#57a64a;">// Pad the input region by the kernel</span>
<span style="color:#c8c8c8;">inputRegionForThread</span><span style="color:#b4b4b4;">.</span>PadByRadius<span style="color:#b4b4b4;">(</span> <span style="color:#c8c8c8;">kernel</span><span style="color:#b4b4b4;">.</span>GetRadius<span style="color:#b4b4b4;">()</span> <span style="color:#b4b4b4;">);</span>
<span style="color:#c8c8c8;">inputRegionForThread</span><span style="color:#b4b4b4;">.</span>Crop<span style="color:#b4b4b4;">(</span> <span style="color:#c8c8c8;">input</span><span style="color:#b4b4b4;">-></span>GetBufferedRegion<span style="color:#b4b4b4;">()</span> <span style="color:#b4b4b4;">);</span></pre>
</div>
<div><span>It would be great if someone could guide me on this. </span></div>
<span>
<div><br>
</div>
<div>Thanks,</div>
<div>Jay</div>
<div><br>
</div>
</span></div>
</body>
</html>