[ITK] Binary Dilate/Erode filter
Matt McCormick
matt.mccormick at kitware.com
Fri Jun 2 10:57:01 EDT 2017
Hi Jay,
Yes, outputRegion.IsInside(idx) means that we only are changing the region
we are processing.
HTH,
Matt
On Thu, Jun 1, 2017 at 7:26 AM, jay nanavati <jaysnanavati at hotmail.co.uk>
wrote:
> 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/20170602/e5d74c76/attachment-0001.html>
More information about the Community
mailing list