Hi all,
I am having a problem using WindowManager in a BeanShell macro in Fiji. Namely, the macro behaves differently when I run it on my Mac, or when I run it through X11 virtual frame buffer (xvfb) on our university's linux cluster. I am not providing the --headless option, so my assumption is that even on the cluster, Fiji thinks it has a monitor and is displaying a GUI. However, the macro essentially opens four images, and then polls WindowManager for a list of image titles (I have included the macro at the bottom, as well as the xvfb command used to run it). On my computer, this reports (as expected) four open windows. However, on the cluster, it reports 0 open windows. I can give the command saveAs("Tiff", "/path/to/tiff.tif") and save one of the images, though, so they must actually be open! But, I cannot select windows using commands (e.g. IJ.selectWindow() will report they are not open) or get a list of them. It is as if WindowManager does not know they exist. I am not sure what is the root — Mac vs. Linux, something weird about running in xvfb, etc, but I was wondering if anyone had any additional information that might help me with my problem. Thank you so very much. Cheers, Jeff --------------------------------- THE BEANSHELL MACRO IN QUESTION: import ij.IJ; import ij.WindowManager; import java.lang.Runtime; import java.lang.String; import java.io; pathbase="/path/on/my/server"; // Open a few images. IJ.open(pathbase+"spim_TL1_Angle1.tif"); IJ.open(pathbase+"spim_TL1_Angle2.tif"); IJ.open(pathbase+"spim_TL1_Angle3.tif"); IJ.open(pathbase+"spim_TL1_Angle4.tif"); System.out.println("Opened some windows!"); // Get a list of the windows allWindows = ij.WindowManager.getImageTitles(); System.out.println("WindowManager thinks there are " + allWindows.length + " open windows."); ------------------------------------------------ THE XVFB CALL TO RUN THE MACRO ON THE CLUSTER xvfb-run -a /path/to/fiji-1.49/ImageJ-linux64 -Xms200m -Xmx200m -- --no-splash WindowTest.bsh |
Hi Jeff,
> I am not providing the --headless option, so my assumption is that > even on the cluster, Fiji thinks it has a monitor and is displaying a > GUI. Yes, that is important. If you pass --headless then GUI-based classes like WindowManager behave differently. > However, the macro essentially opens four images, and then polls > WindowManager for a list of image titles (I have included the macro at > the bottom, as well as the xvfb command used to run it). On my > computer, this reports (as expected) four open windows. However, on > the cluster, it reports 0 open windows. That is strange, and sounds more like something that might happen if --headless is passed. Unfortunately, I am no expert on xvfb. But it looks like your invocation is substantially different (simpler, actually) than the way currently recommended on the wiki: http://imagej.net/Headless#Xvfb Have you tried doing it the way described at that link? Anyone else here have success with the xvfb-based approach? Regards, Curtis On Fri, Jun 26, 2015 at 10:20 AM, Jeff Farrell <[hidden email]> wrote: > Hi all, > > I am having a problem using WindowManager in a BeanShell macro in Fiji. > Namely, the macro behaves differently when I run it on my Mac, or when I > run > it through X11 virtual frame buffer (xvfb) on our university's linux > cluster. I am not providing the --headless option, so my assumption is that > even on the cluster, Fiji thinks it has a monitor and is displaying a GUI. > > However, the macro essentially opens four images, and then polls > WindowManager for a list of image titles (I have included the macro at the > bottom, as well as the xvfb command used to run it). On my computer, this > reports (as expected) four open windows. However, on the cluster, it > reports > 0 open windows. I can give the command saveAs("Tiff", "/path/to/tiff.tif") > and save one of the images, though, so they must actually be open! But, I > cannot select windows using commands (e.g. IJ.selectWindow() will report > they are not open) or get a list of them. It is as if WindowManager does > not > know they exist. > > I am not sure what is the root — Mac vs. Linux, something weird about > running in xvfb, etc, but I was wondering if anyone had any additional > information that might help me with my problem. > > Thank you so very much. > Cheers, > Jeff > > --------------------------------- > THE BEANSHELL MACRO IN QUESTION: > > import ij.IJ; > import ij.WindowManager; > import java.lang.Runtime; > import java.lang.String; > import java.io; > > pathbase="/path/on/my/server"; > > // Open a few images. > IJ.open(pathbase+"spim_TL1_Angle1.tif"); > IJ.open(pathbase+"spim_TL1_Angle2.tif"); > IJ.open(pathbase+"spim_TL1_Angle3.tif"); > IJ.open(pathbase+"spim_TL1_Angle4.tif"); > System.out.println("Opened some windows!"); > > // Get a list of the windows > allWindows = ij.WindowManager.getImageTitles(); > System.out.println("WindowManager thinks there are " + allWindows.length + > " > open windows."); > > ------------------------------------------------ > > THE XVFB CALL TO RUN THE MACRO ON THE CLUSTER > xvfb-run -a /path/to/fiji-1.49/ImageJ-linux64 -Xms200m -Xmx200m -- > --no-splash WindowTest.bsh > > > > -- > View this message in context: > http://imagej.1557.x6.nabble.com/WindowManager-finds-no-windows-tp5013317.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |