예제 #1
0
def liveDead(row, f):
    path, name = os.path.split(f)

    img = ogre.site_to_array(f)

    b = img[:, :, 0]  # DAPI
    g = img[:, :, 1]  # FITC
    r = img[:, :, 2]  # TexasRed

    bc = ogre.correct_illumination(b)
    bcmask = ogre.adapt_thresh(bc)
    blabs, bprops = ogre.watershed_label(bcmask, bc)

    gc = ogre.correct_illumination(g)
    gcmask = ogre.adapt_thresh(gc)
    glabs, gprops = ogre.watershed_label(gcmask, gc)

    rc = ogre.correct_illumination(r)
    rcmask = ogre.adapt_thresh(rc)
    rlabs, rprops = ogre.watershed_label(rcmask, rc)

    #    fig, ax = plt.subplots(3,3, figsize=(15,12))
    #    fig.suptitle(f, fontsize=15)
    #    ax[0,0].imshow(bc, cmap=plt.cm.gray)
    #    ax[0,1].imshow(gc, cmap=plt.cm.gray)
    #    ax[0,2].imshow(rc, cmap=plt.cm.gray)
    #    ax[1,0].imshow(bcmask, cmap=plt.cm.gray)
    #    ax[1,1].imshow(gcmask, cmap=plt.cm.gray)
    #    ax[1,2].imshow(rcmask, cmap=plt.cm.gray)
    #    ax[2,0].imshow(label2rgb(blabs))
    #    ax[2,1].imshow(label2rgb(glabs))
    #    ax[2,2].imshow(label2rgb(rlabs))
    #    sns.despine()
    #    fig.tight_layout()

    # Raw cell counter seems to be doing a better job here...
    raw_dapi = ogre.count_raw(bprops)
    #    bcount_filter = ogre.count_filter(bprops)
    raw_fitc = ogre.count_raw(gprops)
    #    gcount_filter = ogre.count_filter(gprops)
    raw_texas = ogre.count_raw(rprops)
    #    rcount_filter = ogre.count_filter(rprops)

    glabmask = glabs != 0
    rlabmask = rlabs != 0

    live = 0
    dead = 0
    dying = 0
    for i in range(1, blabs.max()):
        nucleus_roi = blabs == i
        if ((nucleus_roi * glabmask * rlabmask).any()):
            dying += 1
        elif ((nucleus_roi * glabmask).any()):
            live += 1
        elif ((nucleus_roi * rlabmask).any()):
            dead += 1

    return (row,
            [path, name, raw_dapi, raw_fitc, raw_texas, live, dead, dying])
예제 #2
0
def liveDead(row, f): 
    path, name = os.path.split(f)
    
    img = ogre.site_to_array(f)
    
    b = img[:, :, 0] # DAPI
    g = img[:, :, 1] # FITC
    r = img[:, :, 2] # TexasRed
    
    bc = ogre.correct_illumination(b)
    bcmask = ogre.adapt_thresh(bc)
    blabs, bprops = ogre.watershed_label(bcmask, bc)
    
    gc = ogre.correct_illumination(g)
    gcmask = ogre.adapt_thresh(gc)
    glabs, gprops = ogre.watershed_label(gcmask, gc)
    
    rc = ogre.correct_illumination(r)
    rcmask = ogre.adapt_thresh(rc)
    rlabs, rprops = ogre.watershed_label(rcmask, rc)
    
#    fig, ax = plt.subplots(3,3, figsize=(15,12))
#    fig.suptitle(f, fontsize=15)
#    ax[0,0].imshow(bc, cmap=plt.cm.gray)
#    ax[0,1].imshow(gc, cmap=plt.cm.gray)
#    ax[0,2].imshow(rc, cmap=plt.cm.gray)
#    ax[1,0].imshow(bcmask, cmap=plt.cm.gray)
#    ax[1,1].imshow(gcmask, cmap=plt.cm.gray)
#    ax[1,2].imshow(rcmask, cmap=plt.cm.gray)
#    ax[2,0].imshow(label2rgb(blabs))
#    ax[2,1].imshow(label2rgb(glabs))
#    ax[2,2].imshow(label2rgb(rlabs))
#    sns.despine()
#    fig.tight_layout()
    
    # Raw cell counter seems to be doing a better job here...
    raw_dapi = ogre.count_raw(bprops)
#    bcount_filter = ogre.count_filter(bprops)
    raw_fitc = ogre.count_raw(gprops)
#    gcount_filter = ogre.count_filter(gprops)
    raw_texas = ogre.count_raw(rprops)
#    rcount_filter = ogre.count_filter(rprops)
    
    glabmask = glabs != 0
    rlabmask = rlabs != 0

    live = 0
    dead = 0
    dying = 0
    for i in range(1, blabs.max()):
        nucleus_roi = blabs == i
        if((nucleus_roi * glabmask * rlabmask).any()):
            dying += 1
        elif((nucleus_roi*glabmask).any()):
            live += 1
        elif((nucleus_roi * rlabmask).any()):
            dead += 1
    
    return (row, [path, name, raw_dapi, raw_fitc, raw_texas, live, dead, dying])
예제 #3
0
for f in w1_files:
    row = w1_files.index(f)
    path, name = os.path.split(f)

    print "Status Update:"
    print "File: {0}".format(f)
    print "Item: {0}/{1}".format(row, w1_files_length)

    img = ogre.site_to_array(f)

    b = img[:, :, 0]  # DAPI
    g = img[:, :, 1]  # FITC
    r = img[:, :, 2]  # TexasRed

    bc = ogre.correct_illumination(b)
    bcmask = ogre.adapt_thresh(bc)
    blabs, bprops = ogre.watershed_label(bcmask, bc)

    gc = ogre.correct_illumination(g)
    gcmask = ogre.adapt_thresh(gc)
    glabs, gprops = ogre.watershed_label(gcmask, gc)

    rc = ogre.correct_illumination(r)
    rcmask = ogre.adapt_thresh(rc)
    rlabs, rprops = ogre.watershed_label(rcmask, rc)

    #    fig, ax = plt.subplots(3,3, figsize=(15,12))
    #    fig.suptitle(f, fontsize=15)
    #    ax[0,0].imshow(bc, cmap=plt.cm.gray)
    #    ax[0,1].imshow(gc, cmap=plt.cm.gray)
    #    ax[0,2].imshow(rc, cmap=plt.cm.gray)
예제 #4
0
for f in w1_files:
    row = w1_files.index(f)
    path, name = os.path.split(f)

    print "Status Update:"
    print "File: {0}".format(f)
    print "Item: {0}/{1}".format(row, w1_files_length)

    img = ogre.site_to_array(f)

    b = img[:, :, 0]  # DAPI
    g = img[:, :, 1]  # FITC
    r = img[:, :, 2]  # TexasRed

    bc = ogre.correct_illumination(b)
    bcmask = ogre.adapt_thresh(bc)
    blabs, bprops = ogre.watershed_label(bcmask, bc)

    gc = ogre.correct_illumination(g)
    gcmask = ogre.adapt_thresh(gc)
    glabs, gprops = ogre.watershed_label(gcmask, gc)

    rc = ogre.correct_illumination(r)
    rcmask = ogre.adapt_thresh(rc)
    rlabs, rprops = ogre.watershed_label(rcmask, rc)

    #    fig, ax = plt.subplots(3,3, figsize=(15,12))
    #    fig.suptitle(f, fontsize=15)
    #    ax[0,0].imshow(bc, cmap=plt.cm.gray)
    #    ax[0,1].imshow(gc, cmap=plt.cm.gray)
    #    ax[0,2].imshow(rc, cmap=plt.cm.gray)