I have a script where I am trying to get an ROI of an image using an autothreshold and then trying to clear everything outside of that ROI. However, the issue is that when I create the roi, add it to the roi manager and then try and select it and use the “clear outside” command, it does not work and I get a prompt saying “this command requires a selection”. The portion of the script pertaining to this follows below. I took it from the macro recorder. Any help would be appreciated!
IJ.setAutoThreshold(imp, “Intermodes dark no-reset”)
IJ.run(imp, “Convert to Mask”, “”)
IJ.run(imp, “Analyze Particles…”, “size=100000-Infinity add”)
rm = RoiManager()
IJ.setBackgroundColor(0, 0, 0)
IJ.run(imp, “Clear Outside”, “”)
I’ve tried using imp= getCurrentImage() and then putting that in rm.select(), I’ve tried not putting any image input in rm.select(), but it essentially doesn’t select the ROI so that clear outside can clear everything outside the ROI.