def getLineLength(imp):
	x1=-1
	y1=-1
	x2=-1
	y2=-1
	roi = imp.getRoi()
	if roi != None:
		if roi.getType() == Roi.LINE:
			cal = imp.getCalibration()
			pw = cal.pixelWidth
			ph = cal.pixelHeight
			x1=roi.x1d
			y1=roi.y1d
			x2=roi.x2d
			y2=roi.y2d
			x = (x2-x1)*pw
			y = (y2-y1)*ph
			l = sqrt(x*x+y*y)
			imp = addRoiToOverlay(imp, roi, labCol=Color.white, linCol=Color.green)
			# imp.updateAndRepaintWindow()			
			IJ.makePoint(-1,-1)
			# imp.updateAndRepaintWindow()
			return l, cal.getUnit()
	return None
Example #2
0
def makePoint(x, y):
    IJ.makePoint(x, y)
        sl = int(lineSplit[iSlice])

        # Separate input into slices
        if sl == oldSlice:
            xLst += [x]
            yLst += [y]
        else:
            print "Reading slice", oldSlice, ":::", xLst, yLst

            # Place selection points on the frame
            # makeSelection("point", xLst, yLst);

            break

            for x1, y1 in zip(xLst, yLst):
                IJ.makePoint(x1, y1)

            #roi = PointRoi(0, 0)
            #
            #	roi.addPoint(IJ.getImage(), x1, y1)
            #	IJ.getImage().setRoi(roi)

            # Move to the next frame
            IJ.getImage().setSlice(sl + 1)

            # Update point storage
            oldSlice = sl
            xLst = [x]
            yLst = [y]

    # Finish off the last trailing slice