-
-
Save hkmoon/8675677317d5c64afbd51c1d45663ba5 to your computer and use it in GitHub Desktop.
Generate label image from rois in Fiji
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@ ImagePlus imp | |
#@ OUTPUT ImagePlus result | |
from ij import IJ | |
from ij.plugin.frame import RoiManager | |
result = IJ.createImage("Labeling", "16-bit black", imp.getWidth(), imp.getHeight(), 1) | |
ip = result.getProcessor() | |
rm = RoiManager.getInstance() | |
for index, roi in enumerate(rm.getRoisAsArray()): | |
ip.setColor(index+1) | |
ip.fill(roi) | |
ip.resetMinAndMax() | |
IJ.run(result, "glasbey inverted", "") | |
result.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment