How to use aicssegmentation - 3 common examples

To help you get started, we’ve selected a few aicssegmentation examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AllenInstitute / aics-ml-segmentation / aicsmlsegment / bin / curator / curator_sorting.py View on Github external
def create_mask(raw_img, seg):
    global pts, draw_img, draw_mask, draw_ax
    bw = seg>0
    z_profile = np.zeros((bw.shape[0],),dtype=int)
    for zz in range(bw.shape[0]):
        z_profile[zz] = np.count_nonzero(bw[zz,:,:])
    mid_frame = round(histogram_otsu(z_profile)*bw.shape[0]).astype(int)

    offset = 20
    seg_label = seg + offset # make it brighter
    seg_label[seg_label==offset]=0
    seg_label = seg_label.astype(float) * (255/seg_label.max())
    seg_label = np.round(seg_label)
    seg_label = seg_label.astype(np.uint8)

    img = np.zeros((raw_img.shape[1], 3*raw_img.shape[2], 3),dtype=np.uint8)

    for cc in range(3):
        img[:, :raw_img.shape[2], cc]=raw_img[mid_frame,:,:]
        img[:, raw_img.shape[2]:2*raw_img.shape[2], cc]=seg_label[mid_frame,:,:]
        img[:, 2*raw_img.shape[2]:, cc]=np.amax(seg_label, axis=0)

    draw_mask = np.zeros((img.shape[0],img.shape[1]),dtype=np.uint8)
github AllenInstitute / aics-ml-segmentation / aicsmlsegment / bin / curator / curator_merging.py View on Github external
seg1_label = np.round(seg1_label)
    seg1_label = seg1_label.astype(np.uint8)

    offset = 25
    seg2_label = seg2 + offset # make it brighter
    seg2_label[seg2_label==offset]=0
    seg2_label = seg2_label.astype(float) * (255/seg2_label.max())
    seg2_label = np.round(seg2_label)
    seg2_label = seg2_label.astype(np.uint8)


    bw = seg1>0
    z_profile = np.zeros((bw.shape[0],),dtype=int)
    for zz in range(bw.shape[0]):
        z_profile[zz] = np.count_nonzero(bw[zz,:,:])
    mid_frame = round(histogram_otsu(z_profile)*bw.shape[0]).astype(int)

    img = np.zeros((2*raw_img.shape[1], 3*raw_img.shape[2], 3),dtype=np.uint8)

    row_index = 0

    for cc in range(3):
        img[row_index*raw_img.shape[1]:(row_index+1)*raw_img.shape[1], :raw_img.shape[2], cc]=np.amax(raw_img, axis=0)
        img[row_index*raw_img.shape[1]:(row_index+1)*raw_img.shape[1], raw_img.shape[2]:2*raw_img.shape[2], cc]=np.amax(seg1_label, axis=0)
        img[row_index*raw_img.shape[1]:(row_index+1)*raw_img.shape[1], 2*raw_img.shape[2]:, cc]=np.amax(seg2_label, axis=0)
    
    row_index = 1
    for cc in range(3):
        img[row_index*raw_img.shape[1]:(row_index+1)*raw_img.shape[1], :raw_img.shape[2], cc]=raw_img[mid_frame,:,:]
        img[row_index*raw_img.shape[1]:(row_index+1)*raw_img.shape[1], raw_img.shape[2]:2*raw_img.shape[2], cc]=seg1_label[mid_frame,:,:]
        img[row_index*raw_img.shape[1]:(row_index+1)*raw_img.shape[1], 2*raw_img.shape[2]:, cc]=seg2_label[mid_frame,:,:]
github AllenInstitute / aics-ml-segmentation / aicsmlsegment / bin / curator / curator_sorting.py View on Github external
def gt_sorting(raw_img, seg):
    global button

    bw = seg>0
    z_profile = np.zeros((bw.shape[0],),dtype=int)
    for zz in range(bw.shape[0]):
        z_profile[zz] = np.count_nonzero(bw[zz,:,:])
    mid_frame = round(histogram_otsu(z_profile)*bw.shape[0]).astype(int)

    #create 2x4 mosaic
    out = np.zeros((2*raw_img.shape[1], 4*raw_img.shape[2], 3),dtype=np.uint8)
    row_index=0
    im = raw_img
    
    for cc in range(3):
        out[row_index*raw_img.shape[1]:(row_index+1)*raw_img.shape[1], 0*raw_img.shape[2]:1*raw_img.shape[2], cc]=im[mid_frame-4,:,:]
        out[row_index*raw_img.shape[1]:(row_index+1)*raw_img.shape[1], 1*raw_img.shape[2]:2*raw_img.shape[2], cc]=im[mid_frame,:,:]
        out[row_index*raw_img.shape[1]:(row_index+1)*raw_img.shape[1], 2*raw_img.shape[2]:3*raw_img.shape[2], cc]=im[mid_frame+4,:,:]
        out[row_index*raw_img.shape[1]:(row_index+1)*raw_img.shape[1], 3*raw_img.shape[2]:4*raw_img.shape[2], cc]=np.amax(im, axis=0)

    row_index=1
    offset = 20
    im = seg + offset # make it brighter
    im[im==offset]=0

aicssegmentation

Part 1 of Allen Cell and Structure Segmenter

Allen Institute Software Lice…
Latest version published 11 months ago

Package Health Score

54 / 100
Full package analysis

Popular aicssegmentation functions

Similar packages