[MINC-users] median filter

Alex Zijdenbos zijdenbos at gmail.com
Mon Jan 31 21:54:54 EST 2011


Hi Andrew,

I'm a bit puzzled by your suggestion - the mincmorph kernel you
describe is a mean filter, not a median filter, right? AFAIK you can't
implement a median filter by convolution (because you need to sort).

That said, it still seems that mincmorph would be the most natural
place for adding a median filter; it seems like all the ingredients
are there. It seems like it would only be a minor modification of the
median dilate option it already provides?

-- A

On Sun, Jan 30, 2011 at 9:04 AM, Andrew Janke <a.janke at gmail.com> wrote:
> Hi Francois,
>
> On 29 January 2011 01:16, francois hebert <francois.hebert007 at gmail.com> wrote:
>> I wuld like to know if there is a median filter in the minc tool or if
>> somebody have it?
>> I know that we can specified kernel with mincmoprh but i'm not sure I can
>> use mincmorph to perform the median filtering.
>
> I see a bunch of others have thrown all sorts of code at you already
> but I'd hate to be left out of this little game so here goes..
>
> There is a median _dilate_ option in mincmorph (dilates by the median
> of the values in the structuring element) but from other replies I
> think you want to do a median filter on the whole volume?
>
> mincmorph certainly won't be the quickest option but ti will do it via
> a convolution kernel. If you want to do a simple 3x3 6-connected
> filtering (8 neighbours) I'd do this:
>
> First make a kernel file (file.kern):
>
> ---
> MNI Morphology Kernel File
> %
> % 3D 6-connectivity ie: (in 2D)
> %
> %     1
> %   1 0 1
> %     1
> %
> % 0 - center voxel
> % Format:  vector for voxel in 5 dimensions (x,y,z,t,v) then multiplier.
>
> Kernel_Type = Normal_Kernel;
> Kernel =
> %    x    y    z    t    v     coeff
> % -----------------------------------
>   1.0  0.0  0.0  0.0  0.0     0.166666
>  -1.0  0.0  0.0  0.0  0.0     0.166666
>   0.0  1.0  0.0  0.0  0.0     0.166666
>   0.0 -1.0  0.0  0.0  0.0     0.166666
>   0.0  0.0  1.0  0.0  0.0     0.166666
>   0.0  0.0 -1.0  0.0  0.0     0.166666;
> ----
>
> Then use it (note that for each of the 6 neighbors 1/6 of their value
> is added to the result).
>
>   $ mincmorph -kernel file.kern input.mnc out.mnc
>
> At least it will work with sufficient speed to see if it works for
> you.  As you go to larger elements/filters it will slow down.
>
> have fun.
>
>
>
> Andrew
> _______________________________________________
> MINC-users at bic.mni.mcgill.ca
> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
>
>


More information about the MINC-users mailing list