http://imagej.273.s1.nabble.com/Use-Rank-rankFloat-RankFilters-in-a-plugin-tp3693843p3693845.html
> Thank you very much. Tried it, but I seem not to be able to get it run
> the right image. it should run on the image processor ip2 in the code,
> it destructively changes the first slice in the original stack. Any
current stack. You can call the rank() method of the RankFilters class
to median filter an ImageProcessor. Here is a JavaScript example:
>
> Kind regards
> Joris
>
> Code :
> public static ImageProcessor getDeriche(ImageProcessor ip, float alpha,
> double radius){
> int type = getType(ip);
> if (type==OTHER){
> IJ.showMessage("Deriche works only on greyscale or
> pseudocolored
> images");
> return null;
> }
> ArrayList<double[]> arrays = null;
> ImageProcessor ip2= ip.duplicate();
> //if (radius > 0)ip2 = applyMedian(ip2, radius); // to the
> function
> I copied from rankFloat.
> if (radius>0)IJ.run("Median...","radius="+radius);
>
> arrays = dericheCalc(ip2,alpha); // self-defined function
> double[] norm = arrays.get(0);
> double[] angle = arrays.get(1);
> FloatProcessor normfp = new FloatProcessor(ip2.getWidth(),
> ip2.getHeight(), norm);
> normfp.resetMinAndMax();
> FloatProcessor anglefp = new FloatProcessor(ip2.getWidth(),
> ip2.getHeight(), angle);
> anglefp.resetMinAndMax();
> ip2 = nonMaximalSuppression(normfp, anglefp);
> return ip2;
> }
>
>
>
> On Thu, Feb 5, 2009 at 3:53 PM, Wayne Rasband <
[hidden email]> wrote:
>
>> Dear Joris,
>>
>> On Feb 5, 2009, at 6:48 AM, joris meys wrote:
>>
>> Dear all,
>>>
>>> I'm writing (yet another) plugin for edge detection, and i want to
>>> apply
>>> the
>>> median filter, but not with a 3x3 kernel but with a circular mask. I
>>> know
>>> I
>>> can run the command with IJ.doCommand("Median"), but when I try that
>>> (or
>>> IJ.run), I get the message "image locked". with
>>> IJ.RunPlugIn("Median",null),
>>> I get simply nothing.
>>>
>>
>> You can avoid the "image locked" error by changing your plugin so
>> that it
>> implements the PlugIn interface instead of PlugInFiler and run the
>> median
>> filter using
>>
>> run("Median...", "radius=1");
>>
>> -wayne
>>
>>
>>
>>> Plus, I don't want the image filter to open, I just want to apply the
>>> method
>>> rankFloat to my imageprocessor with a fixed radius. I tried
>>> accessing the
>>> method, but got (off course) the static/nonstatic error. Tried to
>>> instantize
>>> RankFilters and do it that way, but that didn't want to work either.
>>> Right
>>> now, I copied the code of rankFloat() and adjusted it for my own
>>> use. It
>>> works, but it's not really elegant to say at least.
>>>
>>> Anybody who knows to do this right?
>>> Kind regards
>>> Joris
>>>
>>>
>>
>