Re: Python iteration through Pixel/ROI to slow ... ?
Posted by
Andreas Rzepecki on
Oct 23, 2013; 11:32am
URL: http://imagej.273.s1.nabble.com/Python-iteration-through-Pixel-ROI-to-slow-tp5005274p5005278.html
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