Login  Register

Re: ImageJ 3D Viewer setLocation

Posted by ctrueden on Jul 22, 2016; 5:40pm
URL: http://imagej.273.s1.nabble.com/ImageJ-3D-Viewer-setLocation-tp5016811p5016928.html

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