File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
cellseg_models_pytorch/postproc/functional Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 3232import skimage .morphology as morph
3333
3434from cellseg_models_pytorch .transforms import percentile_normalize99
35- from cellseg_models_pytorch .utils import naive_thresh_prob
3635
3736__all__ = ["post_proc_dcan" ]
3837
3938
4039def post_proc_dcan (
41- prob_map : np .ndarray , contour_map : np .ndarray , ** kwargs
40+ prob_map : np .ndarray , contour_map : np .ndarray , thresh : float = 0.5 , ** kwargs
4241) -> np .ndarray :
4342 """DCAN post-processing pipeline.
4443
@@ -50,6 +49,8 @@ def post_proc_dcan(
5049 Probablilty map. Shape (H, W).
5150 contour_map : np.ndarray
5251 Contour map. Shape (H, W).
52+ thresh : float, default=0.5
53+ Threshold for the difference between prob_map and contour_map.
5354
5455 Returns
5556 -------
@@ -58,7 +59,7 @@ def post_proc_dcan(
5859 """
5960 contour_map = percentile_normalize99 (contour_map , amin = - 1 , amax = 1 )
6061 sub = prob_map - contour_map
61- pre_insts = ndi .label (naive_thresh_prob (sub ))[0 ]
62+ pre_insts = ndi .label ((sub >= thresh ). astype ( int ))[0 ]
6263
6364 inst_ids = np .unique (pre_insts )[1 :]
6465 disk = morph .disk (3 )
You can’t perform that action at this time.
0 commit comments