Applying Median 3D filter on an image in eclipse (Jython)

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

Applying Median 3D filter on an image in eclipse (Jython)

haider
Hello

I have just started programming a plugin for ImageJ in eclipse. My programming language of choice is Jython. I have the following code:

 from ij import *

 get = IJ.openImage("http://imagej.net/images/clown.jpg");
 get.show()

 imp = IJ.getImage()

 IJ.runPlugIn('plugin.Filters3D.MEDIAN', 'imp')

When I print image pixels statistics before and after, I see no difference. Am I inputting the image improperly? Any help would be appreciated.

Thanks
Haider


Reply | Threaded
Open this post in threaded view
|

Re: Applying Median 3D filter on an image in eclipse (Jython)

Tiago Ferreira-2
Hi Haider,

On Jul 8, 2014, at 12:54, haider <[hidden email]> wrote:
> IJ.runPlugIn('plugin.Filters3D.MEDIAN', 'imp')
>
> When I print image pixels statistics before and after, I see no difference.


Using the macro recorder I get IJ.run(imp, "Median 3D...", "x=4 y=4 z=4")
which works. But why not use the ImageJ API directly?

from ij import IJ
from ij import ImagePlus
from ij.plugin import Filters3D

# 1. get image
get = IJ.openImage("http://imagej.net/images/clown.jpg");

# 2. get the image stack within the ImagePlus
stack = get.getStack()

# 3. Instantiate plugin [1]
f3d = Filters3D()

# 4. Retrieve filtered stack
newStack = f3d.filter(stack, f3d.MEDIAN, 4.0, 4.0, 4.0)

# 5. Construct an ImagePlus from the stack
newImage = ImagePlus("Filtered Clown", newStack);

# 6. Display result
newImage.show()


-tiago

[1] http://imagej.nih.gov/ij/developer/api/index.html?ij/plugin/Filters3D.html
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html