Skip to content

Instantly share code, notes, and snippets.

@romainGuiet
Last active August 9, 2024 11:19
Show Gist options
  • Save romainGuiet/8b59a90ad87e7c6a1af26194a45cd181 to your computer and use it in GitHub Desktop.
Save romainGuiet/8b59a90ad87e7c6a1af26194a45cd181 to your computer and use it in GitHub Desktop.
groovy command equivalent to 'close("\\others")' in macro language. #BIOP #Groovy #Macro
// https://forum.image.sc/t/macro-function-close-others-in-groovy/44630
// Using ID as proposed by @imagejan
import ij.WindowManager
#@ ImagePlus imp
WindowManager.getIDList()
.findAll{ it != imp.getID() }
.each{ WindowManager.getImage(it).close() }
null // suppress result processing by SciJava
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment