Exemple #1
0
 def mousePressed(self, keyEvent):
     global iROI, xlist, ylist, zlist
     iROI += 1
     canv = imp.getCanvas()
     p = canv.getCursorLoc()
     z = imp.getCurrentSlice()
     nCh = imp.getNChannels()
     if nCh > 1:
         z = (z + 1) / nCh
     roi = OvalRoi(p.x - radius, p.y - radius, radius * 2, radius * 2)
     roi.setName('z' + str(z) + 'cell' + str(iROI))
     roi.setPosition(z)
     xlist.append(p.x)
     ylist.append(p.y)
     zlist.append(z)
     imp.setRoi(roi)
     manager.addRoi(roi)
     manager.runCommand('Draw')
            if tempvar == []:
                continue
            idx = tempvar.index(max(tempvar))
            start = frame[0]
            metaphase = frame[idx+3]
            
            if (division - start > 15 and division - start < 100):
                if start>0:
                    for spot in sortedTrack:

                        # Fetch spot features directly from spot.
                        x=spot.getFeature('POSITION_X')
                        y=spot.getFeature('POSITION_Y')
                        t=spot.getFeature('FRAME')
                        roi2 = OvalRoi(x/dx - (6*dx), y/dy - (6*dy), 12, 12)
                        roi2.setPosition(int(t))
                        rm.add(imp, roi2, nextRoi)
                        nextRoi = nextRoi+1
                    resultstable.setValue("IMAGE_NAME", trackrowNumber, filename)
                    resultstable.setValue("TRACK_ID", trackrowNumber, id)
                    resultstable.setValue("START", trackrowNumber, start)
                    resultstable.setValue("METAPHASE", trackrowNumber, metaphase)
                    resultstable.setValue("END", trackrowNumber, division)

                    trackrowNumber = trackrowNumber + 1
#                    plot = Plot(str(id), "slice", "mean", frame, var) 
#                    plot.show()
#                    break

#        imp.close()
resultstable.show("Results")     
Exemple #3
0
    # Loop through all the peak that were found
    for peak in peaks:
        # Print the current coordinates
        print "peaks", peak.getDoublePosition(0), peak.getDoublePosition(
            1), peak.getDoublePosition(2)
        # Add the current peak to the Roi manager
        roi = PointRoi(
            peak.getDoublePosition(0) / cal.pixelWidth,
            peak.getDoublePosition(1) / cal.pixelHeight)
        oval = OvalRoi(
            int(
                peak.getDoublePosition(0) / cal.pixelWidth -
                0.5 * radius / cal.pixelWidth),
            int(
                peak.getDoublePosition(1) / cal.pixelHeight -
                0.5 * radius / cal.pixelHeight), radius / cal.pixelWidth,
            radius / cal.pixelHeight)
        oval.setColor(Color.RED)
        # Set the Z position of the peak otherwise the peaks are all set on the same slice
        oval.setPosition(
            int(round(peak.getDoublePosition(2) / cal.pixelDepth)) + 1)
        roi.setPosition(
            int(round(peak.getDoublePosition(2) / cal.pixelDepth)) + 1)
        overlay.add(oval)
        imp.setOverlay(overlay)
        imp.updateAndDraw()

        rm.addRoi(roi)

else:
    print "The detector could not process the data."
                continue
            idx = tempvar.index(max(tempvar))
            start = frame[0]
            metaphase = frame[idx + 3]

            if (division - start > 15 and division - start < 100):
                if start > 0:
                    for spot in sortedTrack:

                        # Fetch spot features directly from spot.
                        x = spot.getFeature('POSITION_X')
                        y = spot.getFeature('POSITION_Y')
                        t = spot.getFeature('FRAME')
                        roi2 = OvalRoi(x / dx - (6 * dx), y / dy - (6 * dy),
                                       12, 12)
                        roi2.setPosition(int(t))
                        rm.add(imp, roi2, nextRoi)
                        nextRoi = nextRoi + 1
                    resultstable.setValue("IMAGE_NAME", trackrowNumber,
                                          filename)
                    resultstable.setValue("TRACK_ID", trackrowNumber, id)
                    resultstable.setValue("START", trackrowNumber, start)
                    resultstable.setValue("METAPHASE", trackrowNumber,
                                          metaphase)
                    resultstable.setValue("END", trackrowNumber, division)

                    trackrowNumber = trackrowNumber + 1
#                    plot = Plot(str(id), "slice", "mean", frame, var)
#                    plot.show()
#                    break