Hi,
I recently scratched my head about how to define a Rois visibility in an overlay. So I want for example that a specific roi only is visible at a specified frame. From the API, the Roi.setPostion(C,Z,T) method should do the job. However, in this example: from os import path from ij import IJ,ImagePlus from ij.gui import OvalRoi,Overlay from java.awt import Color width = 300 height = 300 NFrames = 10 NChannels = 1 NSlices = 1 HS = IJ.createHyperStack('PartialStack',width,height,NChannels,NSlices,NFrames,16) print HS.getDimensions() ov = Overlay() for frame in range(1,NFrames+1): HS.setPosition(1,1,frame) print 'Channel:' ,HS.getC() print 'Slice:' ,HS.getZ() print 'Frame:' ,HS.getT() roi = OvalRoi(50+frame*5,50+frame*5,50,50) roi.setPosition(HS.getC(),HS.getZ(),HS.getT()) roi.setStrokeColor(Color.RED) ov.add(roi) HS.setOverlay(ov) HS.show() The rois are still visible for all frames. However, when I set NChannels = 2, it works as expected. I know, I could use for the NChannels = 1 case the Roi.setPosition(n) (instead of the 3-based index), but when writing general plugins, it would still be good if also the Roi.setPosition(1,1,T) would work as expected?! Best, Gregor |
Free forum by Nabble | Edit this page |