imagej / imagej-legacy

ImageJ+ImageJ2 compatibility layer
https://imagej.net/libs/imagej-legacy
BSD 2-Clause "Simplified" License
17 stars 25 forks source link

Support ij.gui.Overlay input parameters #173

Closed imagejan closed 6 years ago

imagejan commented 7 years ago

As an alias for net.imagej.overlay.Overlay already existed, this introduces a script alias "IJ1Overlay" for ij.gui.Overlay.

This basically saves a line of code in scripts. Instead of:

#@ ImagePlus imp
ovl = imp.getOverlay()

you can write:

#@ IJ1Overlay ovl

If the community agrees that supporting ij.gui.Overlay is useful, I can add a test to this PR testing its correct behavior.

ctrueden commented 6 years ago

Sorry this sat for so long. At first I wasn't sure I liked IJ1Overlay, especially since net.imagej.overlay.Overlay will eventually go away. But now I think IJ1Overlay for more clarity is still OK. I do wonder about the use of WindowManager. It won't work headless. We could instead use IJ.getImage() but that also doesn't fully work headless. Maybe it never will, and that is OK. Will try to return to this soon and get it sorted.

imagejan commented 6 years ago

@ctrueden I basically copied the WindowManager call from ActiveImagePlusPreprocessor, see:

https://github.com/imagej/imagej-legacy/blob/eeb6555916a8c58ee13d1fda5b1f4ec1280240e5/src/main/java/net/imagej/legacy/plugin/ActiveImagePlusPreprocessor.java#L86-L88

As it is meant to work on the active image, I don't think it needs to run headless (i.e. you can still feed an ij.gui.Overlay manually if you wish).

Should I rename the class to ActiveOverlayProcessor (although we also have net.imagej.display.process.ActiveOverlayPreprocessor)?