Search code examples
javaimagej

Imagej filter larger than the default 3x3


Is there a way using the Imagej api to apply a smooth filter using a larger area than the default 3x3. When you run Imagej and select filters you can specify a size, but I can't find that functionality in the api.

Thanks in advance for any help.


Solution

  • Using the Command Finder (Plugins > Utilities > Find Commands... or just type [L]), you can find that Process > Filters > Mean... actually launches this command: ij.plugin.filter.RankFilters("mean")

    The Command Finder window

    Then just look in the API docs of the RankFilters class, and you will find that you can run the mean filter using

    rank(ImageProcessor ip, double radius, int filterType)
    

    with your desired radius and the filter type RankFilters.MEAN.