Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for mixed world plugins #5

Closed
ctrueden opened this Issue May 3, 2014 · 2 comments

Comments

Projects
None yet
2 participants
@ctrueden
Copy link
Member

ctrueden commented May 3, 2014

We should support plugins that use both ImageJ2 and IJ1 data structures simultaneously. There would be a plugin that implements both IJ1's and IJ2's plugin interfaces. And we would support the @parameter annotation of IJ1 objects (ImagePlus, etc.). Some of this work already exists on the legacy-delusions branch.

Migrated-From: http://trac.imagej.net/ticket/1663

@dscho dscho added this to the imagej-2.0.0 milestone May 26, 2014

@dscho

This comment has been minimized.

Copy link
Member

dscho commented May 27, 2014

At least partially addressed in dfb075f. Maybe we want a widget to handle multiple ImagePlus parameters?

@dscho

This comment has been minimized.

Copy link
Member

dscho commented May 30, 2014

And with 192e6ed the following works:

import ij.ImagePlus;
import org.scijava.command.Command;
import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;

@Plugin(type = Command.class, menu = "Plugins > Close Image")
public class CloseImage implements Command {
    @Parameter
    private ImagePlus imp;

    @Override
    public void run() {
        imp.close();
    }
}

and likewise the other direction:

import ij.IJ;
import ij.plugin.PlugIn;
import org.scijava.Context;
import net.imagej.ImageJ;

public class Do_IJ2_Stuff implements PlugIn {
    @Override
    public void run(String arg) {
        // FIXME: Make a utility method for this.
        // add net.imagej.legacy.IJ2 with “getInstance()” method
// that gives back a net.imagej.ImageJ gateway
        Object o = IJ.runPlugIn("org.scijava.Context", "");
        ImageJ ij = new ImageJ((Context) o);
        ij.ui().showDialog("Huzzah!");
        ij.status().showStatus("Booyah");       
    }
}

@dscho dscho closed this May 30, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.