http://imagej.273.s1.nabble.com/Python-iteration-through-Pixel-ROI-to-slow-tp5005274p5005287.html
Map plugin will do this for you. If you have 255 or fewer ROIs it creates
an 8-bit labeling with discontinuous LUT (similar to Glasbey [2]). If you
have more than 255 ROIs it creates a 16-bit labeling with grayscale LUT.
> Thx for the help so far. I try to lable the ROIs with a grey color
> (1-65536 in a 16bit picture) first, which will most probably speed up my
> procedure.
>
> Therefore I tried this code:
>
> import math
> from ij import IJ
> from ij.gui import GenericDialog
> imp = IJ.getImage()
> ip = imp.getProcessor().convertToFloat()
>
> imp = IJ.getImage()
> ip = imp.getProcessor().convertToFloat()
> grey_value = 1
>
> IJ.run("Set Measurements...", "area centroid perimeter shape feret's
> area_fraction redirect=None decimal=6")
> IJ.run("Set Scale...")
> IJ.run("Analyze Particles...")
> IJ.run("16-bit")
>
> for roi in RoiManager.getInstance().getRoisAsArray():
> roi.setFillColor(grey_value)
> grey_value = grey_value + 1
>
> imp.show()
>
>
> This leads to:
>
> TypeError: setFillColor(): 1st arg can't be coerced to java.awt.Color
>
> Unfortunatly it looks like setFillColor() needs the color determing value
> in another form? Would it be possible to use 32bit picture too, because I
> maybe need more then 65536 lable classes?
>
> Best regards
>
> Andreas
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>