I am writing again because I have an issue with the Windows Manager function on my script.
The goal is to make the user select each windows to define wich one corresponds to FLIM or C1. Once it’s done, I ask the user to create a ROI to define the nucleus. (No possible Nucleus marker so it’s the best option I had.)
Now comes the problem : My script registrer the roi using roimanager and is supposed to bring to front the proper picture to perform the remaining process. But it doesn’t bring to front the picture. So the duplicate, and all the remaining process is done on the wrong picture, and even the second duplicate is done on the first processed picture.
Here is my script if you have some ideas :
from ij import IJ, ImagePlus, WindowManager as WM #Selection of the windows waitCA = WaitForUserDialog ("Waiting", "Select C1 picture") waitCA.show() impcawm=WM.getCurrentWindow() impcaij=IJ.getImage() waitFLIM = WaitForUserDialog ("Waiting", "Select FLIM picture") waitFLIM.show() impflimwm = WM.getCurrentWindow() impflimij=IJ.getImage() #ROI creation WM.toFront(impcawm) rm=RoiManager.getInstance() if not rm: rm = RoiManager() rm.runCommand("reset") waitROI=WaitForUserDialog("Waiting", "Select the nucleus ROI") waitROI.show() roi=impcaij.getRoi() rm.addRoi(roi) IJ.run(impcaij, "Make Inverse", "") roi2=impcaij.getRoi() rm.addRoi(roi2) IJ.run(impflimij, "Select None", "") rm.runCommand(impflimij,"Show None"); #Process on picture impflimwm WM.toFront(impflimwm) IJ.run("Duplicate...","new_name") clear=IJ.getImage() clear.setRoi(roi) IJ.run(clear, "Clear", "stack") #Inverse process on picture impflimwm WM.toFront(impflimwm) IJ.run("Duplicate...","Inverse") clearinv=IJ.getImage() clearinv.setRoi(roi2) IJ.run(clearinv, "Clear", "stack")
I don’t understand why it does it, I tried this script using blob sample picture, but this windows manager function used to always work, until now…
Thanks a lot for all you did for the beginner I am.