grayscale morph with unconventional kernels

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

grayscale morph with unconventional kernels

Christian Tischer
Hello,

i'd like to replace the value of each pixel with the maximum value that is
found in a certain neighborhood, but in contrast to the normal
grayscale-dilation which (i guess) uses a circular kernel for this, i'd
like to use more free-style kernels, like for instance a ring shaped
kernel, e.g.

000000000
000111000
001000100
001000100
001000100
000111000
000000000

my question is what you think is the easiest way to implement this?
or, i guess in other words, which java-code could i start from to get to
this?

thanks a lot!
Tischi

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: grayscale morph with unconventional kernels

Michael Schmid
Hi Tischi,

you could have a look at the ij.plugin.filters.RankFilters class of the old ImageJ 1.37 version (you might add the 'CONVERT_TO_FLOAT' flag not present in ImageJ 1.37, then you can safely assume that the run(ip) method of your plugin filter is always called with Float values and you need not convert it).

In Version 1.38, ImageJ started to use a code for minimum/maximum that needs to have a contiguous range of pixels in each line (that new code is much faster, but not suitable for your needs).

You could also have a look at some other plugins, e.g.
  http://imagejdocu.tudor.lu/doku.php?id=plugin:filter:thresholded_blur:start
  http://rsb.info.nih.gov/ij/plugins/sigma-filter.html
to see how to write a filter with preview.

Michael
________________________________________________________________
On Jun 20, 2012, at 23:27, Christian Tischer wrote:

> Hello,
>
> i'd like to replace the value of each pixel with the maximum value that is
> found in a certain neighborhood, but in contrast to the normal
> grayscale-dilation which (i guess) uses a circular kernel for this, i'd
> like to use more free-style kernels, like for instance a ring shaped
> kernel, e.g.
>
> 000000000
> 000111000
> 001000100
> 001000100
> 001000100
> 000111000
> 000000000
>
> my question is what you think is the easiest way to implement this?
> or, i guess in other words, which java-code could i start from to get to
> this?
>
> thanks a lot!
> Tischi
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html