Question

I am looping through image pairs and registering them with the TurboReg plugin in Fiji. I have some background in Python so am using Jython.

The problem is when TurboReg completes a dialog box appears which asks if you want to save results - I don't - I want to continue looping. How can I close or suppress the dialog box without having to do it manually?

I tried to recreate the problem succinctly, but I am new to Jython and Fiji so below is a snippet from my script minus some functions that call the images etc.

from ij import IJ 
w = WindowManager 

# dictionary of variables 
d = {"t":target.path_to_image, "tCropRight":target.width-1, "tCropBottom":target.height-1, "s":source.path_to_image, "sCropRight":source.width-1, "sCropBottom":source.height-1} 

# run TurboReg dialog 
IJ.run("TurboReg ", "-align \ 
                -file %(s)s 0 0 %(sCropRight)s %(sCropBottom)s \ 
                -file %(t)s 0 0 %(tCropRight)s %(tCropBottom)s \ 
                -bilinear \ 
                1131 847  \ 
                1595 1198 \ 
                1131 4636 \ 
                1595 6561 \ 
                6188 847  \ 
                8732 1198 \ 
                6188 4636 \ 
                8732 6561 \ 
                -hideOutput" % d) 

w.setCurrentWindow(w.getWindow("Output")) # select output window 
IJ.run("Stack to Images") # stack to images 
w.setCurrentWindow(w.getWindow("Data")) # select data window 
IJ.run("16-bit") # convert to 16 bit 
IJ.saveAs("Tiff", temp_nir) # save image 
### CLOSE DIALOG BOXES! ### 
Was it helpful?

Solution

I have figured out my own problem! The dialog is called "Results", so:

from ij import IJ 
w = WindowManager 

win = w.getWindow("Results") 
win.removeNotify() 

This closes dialog without asking whether saving is required.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top