Exemplo n.º 1
0
def myResults(results):
    myResultsTable = ResultsTable()
    for idx, graph in enumerate(results.getGraph()):
        for edge in graph.getEdges():
            edgeLength = edge.getLength()
            v1 = edge.getV1()
            v2 = edge.getV2()
            dist = euclideanDistance(v1, v2)
            #print('v1:', type(v1), v1.getPoints())
            #
            myResultsTable.incrementCounter()  # add a row to results table
            myResultsTable.addValue('graphID', idx)
            myResultsTable.addValue('length_3d', edgeLength)
            myResultsTable.addValue('dist', dist)
            if dist > 0:
                myResultsTable.addValue('tort', edgeLength / dist)
            else:
                myResultsTable.addValue('tort', 'inf')

    myResultsTable.setPrecision(6)
    myResultsTable.show('samiSkel_results')
Exemplo n.º 2
0
        Channel4 = Generate_segmented_manual(imp1, 4, "Moments", 2)
        # # # # Generate ROIs by "Analyse Particles"
        IJ.run(Channel4, "Analyze Particles...",
               "size=5-Infinity pixel add exclude stack")
        IJ.run("Clear Results", "")
        Channel4_count = RoiManager.getInstance().getCount()
        print Channel4_count
        time.sleep(0.5)

        rm.runCommand("reset")

        time.sleep(0.5)

        ort = ResultsTable()
        ort.setPrecision(2)
        ort.incrementCounter()
        ort.addValue("Channel1", Channel1_count)
        ort.addValue("Channel2", Channel2_count)
        ort.addValue("Channel3", Channel3_count)
        ort.addValue("Channel4", Channel4_count)
        ort.show("Results")
        if automatic_save_results:
            dataname = imp1.getTitle()

            filename = dataname + ".csv"
            #files = glob.glob(savepath+"/"+dataname+"*.csv")
            savename = savepath + "/" + filename
            ort.saveAs(savename)

        Channel1.changes = False
    imp_height = imp.getHeight()
    imp_width = imp.getWidth()
    channelnumber = imp.getNChannels()
    slicenumber = imp.getNSlices()
    ExtractedChannel = Duplicator().run(imp, channel, channel, 1, slicenumber, timepoint, timepoint)
    return ExtractedChannel

# identifying spots

def mean(numbers):
    return float(sum(numbers)) / max(len(numbers), 1)

timepoints = imp1.getNFrames()

ort = ResultsTable()
ort.setPrecision(3)

IJ.run(imp1, "Select All", "")
stats_all = imp1.getStatistics( Measurements.AREA)
print str(stats_all.area)
IJ.run(imp1, "Select None", "")


WaitForUserDialog("Select cell-free region","select background free of cells").show()             

stats_background = imp1.getStatistics( Measurements.AREA)
print str(stats_background.area)

IJ.run(imp1, "Select None", "")

for i in range (1, timepoints+1):
Exemplo n.º 4
0
C2_Filtered_Cells_Spots = []  # Number of spots in Channel 2
##  End of list initialisation

## set pixel calibration based on the entry on top
cal = imp.getCalibration()
cal.pixelHeight = pixelsize
cal.pixelWidth = pixelsize
pixelWidth = imp.getCalibration().pixelWidth
print pixelWidth

coordinates = []

### setting up the results tables ####

ort = ResultsTable()
ort.setPrecision(0)
#print ort.getCounter
ort.setHeading(0, "Cell")
ort.setHeading(1, "Point_C1")
ort.setHeading(2, "Point_C2")
ort.setHeading(3, "Distance in um")
ort.setHeading(4, "Distance in pixel")
ort.setHeading(5, "Area in um")
ort.setHeading(6, "Feret in um")

#pixelWidth = imp.getCalibration().pixelWidth

ort2 = ResultsTable()
ort2.setPrecision(3)
ort2.setHeading(0, "Cell")
ort2.setHeading(1, "Channel")
Exemplo n.º 5
0
    # def maxZprojection(stackimp):
    #     """ from EMBL python / Fiji cookbook"""
    #     allTimeFrames = Boolean.TRUE
    #     zp = ZProjector(stackimp)
    #     zp.setMethod(ZProjector.MAX_METHOD)
    #     zp.doHyperStackProjection()
    #     zpimp = zp.getProjection()
    #     return zpimp

    imp2 = Generate_segmented_image(imp1, 2)
    # # # # Generate ROIs by "Analyse Particles"
    IJ.run(imp2, "Analyze Particles...",
           "size=5-Infinity pixel add exclude stack")
    IJ.run("Clear Results", "")
    ort = ResultsTable()
    ort.setPrecision(1)
    imp_measure = ExtractChannel(imp1, Measure_Channel)
    imp_measure.show()
    for i, roi in enumerate(RoiManager.getInstance().getRoisAsArray()):
        roi2 = rm.getRoiIndex(roi)
        rm.select(imp_measure, roi2)
        stats = imp_measure.getStatistics(Measurements.MEAN | Measurements.AREA
                                          | Measurements.FERET
                                          | Measurements.CENTROID)

        ort.incrementCounter()
        #ort.addValue("ROI", str(i))
        ort.addValue("Mean intensity", str(stats.mean))
        ort.addValue("Area", str(stats.area))
        ort.addValue("Compartment", (channel2_name))