[Insight-users] Naively/smoothly interpolating a hole in a grayscale image
Richard Beare
richard.beare at gmail.com
Tue Jul 5 21:50:18 EDT 2011
The idea of the median is to chose a filter of sufficient size so that
the output can never be the value of the hole - hence the requirement
to have relatively small holes (or narrow - lines are OK).
Generic masking is hard - I've written a mask adaptor:
http://hdl.handle.net/1926/575
This only works for voxelwise operations - I wanted for histogram thresholds.
I've also written some masked median and mean filters (with Gaetan) -
MaskedRankImageFilter, MaskedMovingHistogramImageFilter (in review),
but the idea was a bit different - I only wanted output at mask
voxels, which isn't good for hole filling. However non mask voxels
were excluded from kernels, so you could use them as a base.
The tricky aspect of doing this well is the loss of performance - many
of useful kernel filters are using recursive and separable algorithms
and introducing "missing" pixels can be hard.
On Wed, Jul 6, 2011 at 11:20 AM, David Doria <daviddoria at gmail.com> wrote:
> On Tue, Jul 5, 2011 at 8:00 PM, Richard Beare <richard.beare at gmail.com> wrote:
>> Matlab has a function called roifill, which "smoothly interpolates
>> inward from the pixel values on the boundary of the polygon by solving
>> Laplace's equation". That is something that would be nice to add to
>> ITK.
>>
>> Another alternative if the holes are small is to create a median
>> filtered image and replace the holes with the filter output.
>
> Haha I see that roifill solves the Laplace equation. I actually did that here:
> http://www.insight-journal.org/browse/publication/791
>
> I was just hoping for a simpler, more "built-in" solution.
>
> The median filter idea is more of what I was looking for, but I would
> want to mask the image so that the median never ended up being the
> value of the hole. It seems like many filters could benefit from this
> "only operate on masked pixels" concept - some of them have it, but it
> seems like a SetMask should be added to ImageRegionIterator so that
> when filters use an iterator they could optionally only stop at pixels
> under the mask.
>
> David
>
More information about the Insight-users
mailing list