ImageJ 3D Viewer setLocation

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

ImageJ 3D Viewer setLocation

Michelle Cai
Hello, I am beginner user of ImageJ and 3D viewer.
I noticed recently
if I run the following commands in Macro

run("3D Viewer");
call("ij3d.ImageJ3DViewer.add", "path/image(file.name)", "None", "image(file.name)", "0", "true", "true", "true", "2", "0");
selectWindow("3d");
setLocation(1200, 500);

it did not work in the latest ImageJ 3D viewer, and error message "window titled "3d" not found".

But it DOES work with early releases of "ImageJ 3D viewer" plugin on 22.09.2010 or early (http://3dviewer.neurofly.de/)

Can anyone help shine some light on this? I would like to use the later version of ImageJ 3D Viewer for some other nice features, but got stuck with not being able to set the window location.

Any other idea to get the 3D window handler with the latest version of 3D viewer?

Thanks!

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

Re: ImageJ 3D Viewer setLocation

ctrueden
Hi Michelle,

It looks like Bene changed the code on February 7, 2011 to no longer
register itself with ImageJ 1.x's window manager [1].

As a workaround, you can manually search for and manipulate the 3D Viewer
window frame as follows:

--snip--
run("3D Viewer");
call("ij3d.ImageJ3DViewer.add", "mri-stack.tif", "None", "mri-stack.tif",
"0", "true", "true", "true", "2", "0");

// Loop over all frames to find the 3D Viewer window(s)
x = 1200;
y = 500;
eval("script",
"frames = java.awt.Frame.getFrames();" +
"for (f=0; f<frames.length; f++) {" +
"  frame = frames[f];" +
"  if (\"ImageJ 3D Viewer\".equals(frame.getTitle())) {" +
"    frame.setLocation(" + x + ", " + y + ");" +
"  }" +
"}"
);
--snap--

Note that if there is more than one 3D Window viewer open, the code above
repositions all of them.

It's not ideal, but it works.

Regards,
Curtis

[1]
https://github.com/fiji/3D_Viewer/commit/1af5eab94abb7922fc492bf90fbafecc7719a824


--
Curtis Rueden
LOCI software architect - http://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - http://imagej.net/User:Rueden
Did you know ImageJ has a forum? http://forum.imagej.net/


On Mon, Jul 4, 2016 at 11:46 PM, Michelle Cai <
[hidden email]> wrote:

> Hello, I am beginner user of ImageJ and 3D viewer.
> I noticed recently
> if I run the following commands in Macro
>
> run("3D Viewer");
> call("ij3d.ImageJ3DViewer.add", "path/image(file.name)", "None", "image(
> file.name)", "0", "true", "true", "true", "2", "0");
> selectWindow("3d");
> setLocation(1200, 500);
>
> it did not work in the latest ImageJ 3D viewer, and error message "window
> titled "3d" not found".
>
> But it DOES work with early releases of "ImageJ 3D viewer" plugin on
> 22.09.2010 or early (http://3dviewer.neurofly.de/)
>
> Can anyone help shine some light on this? I would like to use the later
> version of ImageJ 3D Viewer for some other nice features, but got stuck
> with not being able to set the window location.
>
> Any other idea to get the 3D window handler with the latest version of 3D
> viewer?
>
> Thanks!
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

Re: ImageJ 3D Viewer setLocation

Michelle Cai
In reply to this post by Michelle Cai
Hi Curtis,

Thanks a lot! your macro worked very well.
I actually went ahead and learn to customize the 3D viewer java code, set the frame style (undecorated) and the location because I need the 3D feature and would like to blend it into another application. It would be very convenient if the flexibility of setting frame/window style can be added to the 3D viewer menu.

Thanks again for your help!
Michelle

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

Re: ImageJ 3D Viewer setLocation

ctrueden
Hi Michelle,

> It would be very convenient if the flexibility of setting
> frame/window style can be added to the 3D viewer menu.

Please note that in general, development of the 3D Viewer plugin has ceased
in favor of ClearVolume (http://imagej.net/ClearVolume) and the new
ThreeDViewer (http://imagej.net/ThreeDViewer, working title) built on it.

That said, if you want to add such a feature by submitting a PR, I would
still review and merge it.

Regards,
Curtis

--
Curtis Rueden
LOCI software architect - http://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - http://imagej.net/User:Rueden
Did you know ImageJ has a forum? http://forum.imagej.net/


On Tue, Jul 26, 2016 at 9:26 AM, Michelle Cai <
[hidden email]> wrote:

> Hi Curtis,
>
> Thanks a lot! your macro worked very well.
> I actually went ahead and learn to customize the 3D viewer java code, set
> the frame style (undecorated) and the location because I need the 3D
> feature and would like to blend it into another application. It would be
> very convenient if the flexibility of setting frame/window style can be
> added to the 3D viewer menu.
>
> Thanks again for your help!
> Michelle
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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