How to call Z-functions from a plugin on ImageJ

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

How to call Z-functions from a plugin on ImageJ

Danae
Good morning

I'm currently doing a plugin on JAVA for imagej that needs to call the function "Maximum Intensity Z-projection" which I know it's already in imagej if you go for "Image/Stacks/Z Project...".
Documentation here: Maximum Intensity Z-projection

I tried to call it like if I was running a plugin from another plugin but it didn't work (now I'm showing you the code I'm trying)

public class MaximumIntensity_ implements PlugIn{
        ImagePlus img = WindowManager.getCurrentImage();

        @Override
        public void run(String arg0) {
                // TODO Auto-generated method stub
                Object zProjector = null;
                zProjector = IJ.runPlugIn(img , "ZProjector", arg0);
               
                if(zProjector==null){
                        String arg = "Error";
                        IJ.showMessage(arg);

                }
        }
}

Thank you so much.
Reply | Threaded
Open this post in threaded view
|

Re: How to call Z-functions from a plugin on ImageJ

Gabriel Landini
On Tuesday 27 Sep 2016 03:27:01 Danae wrote:
> I'm currently doing a plugin on JAVA for imagej that needs to call the
> function "Maximum Intensity Z-projection" which I know it's already in
> imagej if you go for "Image/Stacks/Z Project...".

You can find this out by using the macro recorder.
Choose "java" for the target language in the recorder window.
In you case what you are after is:

IJ.run(imp, "Z Project...", "projection=[Max Intensity]");

There might be another way of doing, like calling the code directly, but the
above would do too.

Cheers

Gabriel

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

Re: How to call Z-functions from a plugin on ImageJ

Danae
Gabriel Landini wrote
On Tuesday 27 Sep 2016 03:27:01 Danae wrote:
> I'm currently doing a plugin on JAVA for imagej that needs to call the
> function "Maximum Intensity Z-projection" which I know it's already in
> imagej if you go for "Image/Stacks/Z Project...".

You can find this out by using the macro recorder.
Choose "java" for the target language in the recorder window.
In you case what you are after is:

IJ.run(imp, "Z Project...", "projection=[Max Intensity]");

There might be another way of doing, like calling the code directly, but the
above would do too.

Cheers

Gabriel

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


Thank you so much :)
It worked perfectly.
I've just started to programme for imagej and I don't know a lot of things ^^