Avoid 3D Viewer Dialog

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

Avoid 3D Viewer Dialog

Juanjo Vega
Hi everyone,

I'm trying to run 3D Viewer automatically from a different plugin.

I have been trying to it as Albert Cardona says at:
http://albert.rierol.net/imagej_programming_tutorials.html#How to
automate an ImageJ dialog

It is:

        Thread thread = Thread.currentThread();
        String originalName = thread.getName();
        thread.setName("Run$_run3DViewer");

        Macro.setOptions("Image='" + IJ.getImage() + "'");

        IJ.run("3D Viewer");

        Macro.setOptions(thread, null);
        thread.setName(originalName);

It launches 3D Viewer, but I get the empty 3D Viewer window. It's
supposed to get the default parameters if they are not set, so the only
required one should be "Image".

If I use the macro recorder and sets it to record as "plugin", I get
some code containing the following:



IJ.runPlugIn("ImageJ_3D_Viewer", "");
call("ij3d.ImageJ3DViewer.add", "12205_000008.xmp", "None",
"12205_000008.xmp", "0", "true", "true", "true", "2", "0");



But I don't know where that "call" instruction comes from. It doesn't
work and "IJ" class has not such a method.

Can anybody help me?

Sincerelly,

Juanjo Vega.
Reply | Threaded
Open this post in threaded view
|

Re: Avoid 3D Viewer Dialog

Albert Cardona-2
Juanjo,

Look at the examples for direct API usage of the 3D Viewer library:

http://www.biomedcentral.com/1471-2105/11/274/abstract

They amount to 2 lines of code.

Albert
--
http://albert.rierol.net
Reply | Threaded
Open this post in threaded view
|

Re: Avoid 3D Viewer Dialog

Juanjo Vega
Hi everybody,

I finally added the jar to my project and runs the plugin with:

    private void run3DViewer(ImagePlus ip) {
        Image3DUniverse universe = new Image3DUniverse(UNIVERSE_W,
UNIVERSE_H);

        // Adds the sphere image plus to universe.
        new StackConverter(ip).convertToRGB();
        Content c = universe.addVoltex(ip);
        c.displayAs(Content.VOLUME);

        universe.show();
    }

I would prefer to run it with "IJ.run(...)", but I can't manage to skip
the dialog and this solution works, so it's ok.

Thank you very much, Albert :)

Sincerelly,

Juanjo Vega.


On Wed, 2010-06-16 at 09:36 -0400, Albert Cardona wrote:
> Juanjo,
>
> Look at the examples for direct API usage of the 3D Viewer library:
>
> http://www.biomedcentral.com/1471-2105/11/274/abstract
>
> They amount to 2 lines of code.
>
> Albert