[ITK] Binary Dilate/Erode filter
jay nanavati
jaysnanavati at hotmail.co.uk
Thu Jun 1 07:26:17 EDT 2017
Hi Matt,
Thanks for the help on this, it makes sense now.
Also with regards to the following :
typename NeighborIndexContainer::const_iterator itIdx;
NeighborIndexContainer & idxDifferenceSet =
this->GetDifferenceSet(centerPixelCode);
for ( itIdx = idxDifferenceSet.begin();
itIdx != idxDifferenceSet.end();
++itIdx )
{
IndexType idx = tmpRegIndexIt.GetIndex() + *itIdx;
if ( outputRegion.IsInside(idx) )
{
output->SetPixel(idx, backgroundValue);
}
}
Am I correct in understanding that the entire SE is being painted? and is the reason why this is done at least one to take care of an edge case where the radius of the SE is bigger than the surface being painted, which means just painting the surface points wont actually be correct?
Thanks,
Jay
________________________________
From: Matt McCormick <matt.mccormick at kitware.com>
Sent: 29 May 2017 18:41:13
To: jay nanavati
Cc: community at itk.org
Subject: Re: [ITK] Binary Dilate/Erode filter
Hi Jay,
The region will be padded by the radius. The cropping will possibly
shrink the region at the input image's boundaries.
HTH,
Matt
On Mon, May 29, 2017 at 12:54 PM, jay nanavati
<jaysnanavati at hotmail.co.uk> wrote:
> Hi - Looking at
> 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:
>
> ypename TInputImage::RegionType tmpRequestedRegion = outputRegion;
> typename TInputImage::RegionType paddedInputRegion =
> input->GetBufferedRegion();
> paddedInputRegion.PadByRadius(radius); // to support boundary values
> InputSizeType padBy = radius;
> for ( i = 0; i < KernelDimension; ++i )
> {
> padBy[i] = ( padBy[i] > kernel.GetRadius(i) ? padBy[i] :
> kernel.GetRadius(i) );
> }
> tmpRequestedRegion.PadByRadius(padBy);
> tmpRequestedRegion.Crop(paddedInputRegion);
>
> It appears that tmpRequestedRegion 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
> inputRegionForThread:
>
> // Pad the input region by the kernel
> inputRegionForThread.PadByRadius( kernel.GetRadius() );
> inputRegionForThread.Crop( input->GetBufferedRegion() );
>
> It would be great if someone could guide me on this.
>
> Thanks,
> Jay
>
>
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/mailman/listinfo/community
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20170601/a9dcf872/attachment.html>
More information about the Community
mailing list