Hi all,
This problem has me stumped. I’m sure this results from my lack of understanding of some of the issues involved and I’m hoping that some of you maybe able to enlighten me.
Here’s the problem:
I’m building a script for analyzing microscopy images, the hope is that this can be headless (this will be important later). I’m able to identify a series of ROIs, which I use to construct a B&W mask for further analysis. What I’m stuck on now is that I’d like to take the outlines of these ROIs and overlay them on the original image to document which regions were passed on to subsequent analyses. The original ROIs are stored in an Overlay() object [muscleOverlay]. The original ROIs are filled (either black or white) and have no stroke color defined. To change these colors, I cycle through the ROIs in the first Overlay object, change the fill color, stroke color, and stroke width. These modified ROIs are stored in another Overlay() [traceRoi] object and the ROI Manager.
Using an ImagePlus object [output] (duplicated from an ij.CompositeImage), I assign the new Overlay object [traceRoi] to this ImagePlus object using the .setOverlay() method. However when I .show() the ImagePlus object, the overlayed ROIs are not visible. What is interesting is that using the Image > Overlay > From ROI Manager… command things work just fine. However, the IJ.run(“From ROI Manager”,””) command requires an open image, which I’m trying to avoid.
Here is the Jython code of the relevant issue (I think).
bgStacks is a CompositeImage
muscleOverlay: is an Overlay object containing ROIs that are filled either white or black.
#Creating Background image tracing
output = bgStacks.duplicate()
rm.reset()
traceRoi = Overlay()
for w in range(0,muscleOverlay.size()):
ctRoi = muscleOverlay.get(w)
ctRoi.setStrokeWidth(1)
ctRoi.setStrokeColor(Color(0,255,0))
ctRoi.setFillColor(Color(0,0,0,0))
traceRoi.add(ctRoi)
rm.addRoi(ctRoi)
output.setOverlay(traceRoi)
Any help/guidance that you can provide is greatly appreciated.
-DeWayne Townsend
--
DeWayne Townsend DVM, PhD
Assistant Professor
Department of Integrative Biology and Physiology
University of Minnesota
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html