AllenCell / napari-allencell-segmenter

A plugin that enables image segmentation provided by Allen Institute for Cell Science
BSD 3-Clause "New" or "Revised" License
16 stars 6 forks source link

MPP1.6 - Run LaminB1 full workflow #19

Closed Aerendel closed 3 years ago

Aerendel commented 3 years ago

Story As a stakeholder, I want to see a complex workflow running in Napari so that I can identify any potential issues

A/C:

Details:

jxchen01 commented 3 years ago

We can try lamin b1 interphase workflow. It is one of the complicated ones.

https://github.com/AllenCell/aics-segmentation/blob/feature/json_workflow/aicssegmentation/structure_wrapper_config/conf_lmnb1_interphase.json

jxchen01 commented 3 years ago

here is the code:

from aicssegmentation.core.pre_processing_utils import  intensity_normalization, image_smoothing_gaussian_3d
from aicssegmentation.core.vessel import  vesselnessSliceBySlice
from aicssegmentation.core.utils import segmentation_union, get_seed_for_objects, remove_index_object
from skimage.morphology import watershed
from skimage.segmentation import find_boundaries

#step 1
scaling_param = [4000]
img_1 = intensity_normalization(img_0, scaling_param = scaling_param)

#step2
sigma = 1
img_2 = image_smoothing_gaussian_3d(img_1, sigma = sigma)

#step3
sigmas = [1]
cutoff = 0.01
img_3 = vesselnessSliceBySlice(img_2, sigmas = sigmas, cutoff = cutoff)

#step4
sigmas = [2]
cutoff = 0.01
img_4 = vesselnessSliceBySlice(img_2, sigmas = sigmas, cutoff = cutoff)

#step5
sigmas = [3]
cutoff = 0.01
img_5 = vesselnessSliceBySlice(img_2, sigmas = sigmas, cutoff = cutoff)

#step6
img_6 = segmentation_union([img_3, img_4, img_5])

#step7
area_min = 1
area_max = 10
bg_seed = True
img_7 = get_seed_for_objects(img_2, img_6, area_min = area_min, area_max = area_max, bg_seed = bg_seed)

#step8
watershed_line = True
img_8 = skimage.morphology(img_1, img_7, watershed_line = watershed_line)

#step9
id_to_remove = [1]
img_9 = remove_index_object(img_8, id_to_remove=id_to_remove)

#step10
connectivity = 1
method = "thick"
img_10 = find_boundaries(img_9, connectivity = connectivity, method = method) 

Here, img_10 will be the final result