[ITK] Binary Dilate/Erode filter

jay nanavati jaysnanavati at hotmail.co.uk
Mon May 29 12:54:17 EDT 2017


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20170529/0db90cb2/attachment.html>


More information about the Community mailing list