I am trying to close a dialog box when using looping through a directory. I have a Python background and therefore am using Jython. The dialog box appears when using the TurboReg plugin asking whether I would like to save the image and measurement results - I don't and just want to continue looping!
I have tried to recreate this but am still a novice with ImageJ and Jython, so here is an outline (note: this snippet calls functions I have not posted)... 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! ### Thanks |
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. |
In reply to this post by kungphil
Hi kungphil,
I see that you already asked and answered your own question on StackOverflow: http://stackoverflow.com/questions/19017986/fiji-and-jython-closing-or-suppressing-a-plugin-dialog-box I reply here for the mailing list archives. Regards, Curtis On Wed, Sep 25, 2013 at 7:48 PM, kungphil <[hidden email]>wrote: > I am trying to close a dialog box when using looping through a directory. > I > have a Python background and therefore am using Jython. The dialog box > appears when using the TurboReg plugin asking whether I would like to save > the image and measurement results - I don't and just want to continue > looping! > > I have tried to recreate this but am still a novice with ImageJ and Jython, > so here is an outline (note: this snippet calls functions I have not > posted)... > > 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! ### > > Thanks > > > > -- > View this message in context: > http://imagej.1557.x6.nabble.com/Jython-close-plugin-dialog-box-in-a-loop-tp5004943.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 |