multiScaleAnalysis.SegmentationHighres.gradient_watershed package
Submodules
multiScaleAnalysis.SegmentationHighres.gradient_watershed.filters module
Created on Mon Feb 20 21:37:54 2023
@author: fyz11
helper filters.
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.filters.anisodiff(img, niter=1, kappa=50, gamma=0.1, step=(1.0, 1.0), sigma=0, option=1, ploton=False)[source]
Anisotropic diffusion in 2D
Usage: imgout = anisodiff(im, niter, kappa, gamma, option)
- Parameters:
image (img - input)
iterations (niter - number of)
? (kappa - conduction coefficient 20-100)
stability (gamma - max value of .25 for)
tuple (step -)
in (the distance between adjacent pixels)
1 (option - 1 Perona Malik diffusion equation No) – 2 Perona Malik diffusion equation No 2
True (ploton - if)
iteration (the image will be plotted on every)
- Returns:
imgout - diffused image.
kappa controls conduction as a function of gradient. If kappa is low small intensity gradients are able to block conduction and hence diffusion across step edges. A large value reduces the influence of intensity gradients on conduction.
gamma controls speed of diffusion (you usually want it at a maximum of 0.25)
step is used to scale the gradients in case the spacing between adjacent pixels differs in the x and y axes
Diffusion equation 1 favours high contrast edges over low contrast ones. Diffusion equation 2 favours wide regions over smaller ones.
Reference: P. Perona and J. Malik. Scale-space and edge detection using ansotropic diffusion. IEEE Transactions on Pattern Analysis and Machine Intelligence, 12(7):629-639, July 1990.
Original MATLAB code by Peter Kovesi School of Computer Science & Software Engineering The University of Western Australia pk @ csse uwa edu au <http://www.csse.uwa.edu.au>
Translated to Python and optimised by Alistair Muldal Department of Pharmacology University of Oxford <alistair.muldal@pharm.ox.ac.uk>
June 2000 original version. March 2002 corrected diffusion eqn No 2. July 2012 translated to Python
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.filters.diffuse_labels3D(labels_in, guide, clamp=0.99, n_iter=10)[source]
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.filters.entropy_mean(arrays, ksize=3, alpha=0.5, eps=1e-20)[source]
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.filters.expand_masks(label_seeds, binary, dist_tform=None)[source]
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.filters.expand_masks2D(label_seeds, binary, dist_tform=None)[source]
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.filters.filter_segmentations_axis(labels, window=3, min_count=1)[source]
according to the persistence along 1 direction. - this works and is relatively fast.
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.filters.filter_segmentations_axis_IoU(labels, window=3, iou_var=0.1)[source]
according to the persistence along 1 direction of the IoU with respect to the middle reference shape.
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.filters.largest_component_vol(vol_binary, connectivity=1)[source]
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.filters.normalize(x, pmin=2, pmax=99.8, axis=None, clip=False, eps=1e-20, dtype=<class 'numpy.float32'>)[source]
Percentile-based image normalization.
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.filters.normalize_mi_ma(x, mi, ma, clip=False, eps=1e-20, dtype=<class 'numpy.float32'>)[source]
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.filters.relabel_slices(labelled, bg_label=0)[source]
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.filters.remove_eccentric_shapes(labels, min_size=20, stretch_cutoff=15)[source]
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.filters.remove_small_labels(labels, min_size=64)[source]
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.filters.remove_small_obj_and_keep_largest(labels, min_size=64, connectivity=2)[source]
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.filters.smooth_vol(vol_binary, ds=4, smooth=5)[source]
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.filters.smooth_vol_anisotropic(vol_binary, ds=4, smooth=[5, 5, 5])[source]
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.filters.var_combine(arrays, ksize=3, alpha=1.0, eps=1e-20)[source]
- Parameters:
arrays
ksize – sets neighborhood to look at variance
alpha
eps
- Returns:
multiScaleAnalysis.SegmentationHighres.gradient_watershed.flows module
Created on Wed Feb 15 03:04:09 2023
@author: fyz11
Module for computing and implementing various flow definitions.
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.flows.cellpose_diffuse2D(coords, centroid, shape, niter)[source]
Solve diffusion for points.
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.flows.distance_centroid_tform_flow_labels2D(labelled, dtform_method='cellpose', guide_img=None, fixed_point_percentile=0.9, iter_factor=5, power_dist=None)[source]
This function wraps a distance transform defined for a single binary with point source and generalize to multi-labels.
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.flows.distance_centroid_tform_flow_labels2D_dask(labelled_array, dtform_method='cellpose', guide_image=None, fixed_point_percentile=0.9, iter_factor=5, n_processes=4, power_dist=None)[source]
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.flows.distance_centroid_tform_flow_labels2D_parallel(labelled_array, dtform_method='cellpose', guide_image=None, fixed_point_percentile=0.9, iter_factor=5, n_processes=4, power_dist=None)[source]
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.flows.distance_tform_labels2D(labelled, dtform_fnc, clip=False)[source]
this function wraps a distance transform defined for a single binary and generalize to multi-labels.
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.flows.distance_tform_labels2D_parallel(labelled_array, dtform_fnc, clip=False, n_processes=4)[source]
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.flows.distance_transform_labels_fast(labels, sdf=False, n_threads=16, black_border=False)[source]
compute euclidean distance transform for each uniquely labelled cell in a 2D/3D binary image
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.flows.fmm_point_source2D(coords, centroid, shape)[source]
This is a much better solver of the diffusion
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.flows.poisson_dist_tform(binary, pt=None)[source]
Computation for a single binary image.
multiScaleAnalysis.SegmentationHighres.gradient_watershed.flows_backup module
Created on Wed Feb 15 03:04:09 2023
@author: fyz11
Module for computing and implementing various flow definitions.
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.flows_backup.cellpose_diffuse2D(coords, centroid, shape, niter)[source]
Solve diffusion for points.
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.flows_backup.distance_centroid_tform_flow_labels2D(labelled, dtform_method='cellpose', guide_img=None, fixed_point_percentile=0.9, iter_factor=5, power_dist=None)[source]
This function wraps a distance transform defined for a single binary with point source and generalize to multi-labels.
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.flows_backup.distance_centroid_tform_flow_labels2D_parallel(labelled_array, dtform_method='cellpose', guide_image=None, fixed_point_percentile=0.9, iter_factor=5, n_processes=4, power_dist=None)[source]
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.flows_backup.distance_tform_labels2D(labelled, dtform_fnc, clip=False)[source]
this function wraps a distance transform defined for a single binary and generalize to multi-labels.
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.flows_backup.distance_tform_labels2D_parallel(labelled_array, dtform_fnc, clip=False, n_processes=4)[source]
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.flows_backup.distance_transform_labels_fast(labels, sdf=False, n_threads=16, black_border=False)[source]
compute euclidean distance transform for each uniquely labelled cell in a 2D/3D binary image
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.flows_backup.fmm_point_source2D(coords, centroid, shape)[source]
This is a much better solver of the diffusion
multiScaleAnalysis.SegmentationHighres.gradient_watershed.metrics module
Created on Wed Feb 15 03:04:09 2023
@author: fyz11
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.metrics.compute_metrics_cells(labels_true, labels_pred, bg_label=0, K=15, iou_thresh=0, eps=1e-05, debug_viz=False)[source]
processes a list of images.
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.metrics.mean_dice_np(y_true, y_pred, **kwargs)[source]
Compute mean Dice coefficient of two segmentation masks, via numpy.
Calls metrics_np(y_true, y_pred, metric_name=’dice’), see there for allowed kwargs.
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.metrics.mean_iou_np(y_true, y_pred, **kwargs)[source]
Compute mean Intersection over Union of two segmentation masks, via numpy.
Calls metrics_np(y_true, y_pred, metric_name=’iou’), see there for allowed kwargs.
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.metrics.metrics_np(y_true, y_pred, metric_name, metric_type='standard', drop_last=True, mean_per_class=False, verbose=False)[source]
Compute mean metrics of two segmentation masks, via numpy.
- Parameters:
y_true – true masks, one-hot encoded.
y_pred – predicted masks, either softmax outputs, or one-hot encoded.
metric_name – metric to be computed, either ‘iou’ or ‘dice’.
metric_type – one of ‘standard’ (default), ‘soft’, ‘naive’. In the standard version, y_pred is one-hot encoded and the mean is taken only over classes that are present (in y_true or y_pred). The ‘soft’ version of the metrics are computed without one-hot encoding y_pred. The ‘naive’ version return mean metrics where absent classes contribute to the class mean as 1.0 (instead of being dropped from the mean).
True (drop_last =) – boolean flag to drop last class (usually reserved for background class in semantic segmentation)
False (verbose =) – return mean along batch axis for each class.
False – print intermediate results such as intersection, union (as number of pixels).
- Returns:
- IoU/Dice of y_true and y_pred, as a float, unless mean_per_class == True
in which case it returns the per-class metric, averaged over the batch.
- Inputs are B*W*H*N tensors, with
B = batch size, W = width, H = height, N = number of classes
multiScaleAnalysis.SegmentationHighres.gradient_watershed.plotting module
Created on Tue Feb 21 00:26:42 2023
@author: fyz11
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.plotting.get_colors(inp, colormap, vmin=None, vmax=None, bg_label=None)[source]
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.plotting.plot_border_tracks_2D(tracks, labels, ax, lw=1, color='magenta', samples=10)[source]
multiScaleAnalysis.SegmentationHighres.gradient_watershed.segmentation module
Created on Mon Feb 20 21:37:54 2023
@author: fyz11
helper functions for applying several standard DL segmentation models.
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.segmentation.apply_cellpose_model_2D_prob(im_stack, model, model_channels, best_diam=None, model_invert=False, test_slice=None, diam_range=array([15, 20, 25, 30, 35, 40, 45, 50]), ksize=25, smoothwinsize=5, hist_norm=True, kernel_size=(256, 256), clip_limit=0.01, fraction_threshold=0.1, n_proc=48)[source]
multiScaleAnalysis.SegmentationHighres.gradient_watershed.watershed module
Created on Mon Feb 20 22:35:23 2023
@author: fyz11
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.watershed.connected_components_pts_2D(pts, pts0, shape, smooth_sigma=1, thresh_factor=None, mask=None, min_area=1)[source]
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.watershed.connected_components_pts_3D(pts, pts0, shape, smooth_sigma=1, thresh_factor=None, mask=None, min_area=1)[source]
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.watershed.gradient_watershed2D_binary(binary, gradient_img=None, divergence_rescale=True, smooth_sigma=1, smooth_gradient=1, delta=0.5, n_iter=10, min_area=5, eps=1e-20, interp=True, thresh_factor=None, track_flow=True, mask=None, debug_viz=False)[source]
parses the instance level segmentation implicitly given as an input binary or a vector field. The algorithm works as an inverse watershed.
Step 1: a grid of points is seeds on the image Step 2: points are propagated for n_iter according to the gradient_img, condensing towards cell centers implicitly implied by the gradient image. Step 3: individual cluster centers are found by binarisation and connected component, removing objects < min_area
result is an integer image the same size as binary.
- Parameters:
binary ((MxNxL) numpy array) – input binary image defining the voxels that need labeling
gradient_img ((MxNxLx3) numpy array) – This is a gradient field such as that from applying np.array(np.gradient(img)).transpose(1,2,3,0) where img is a potential such as a distance transform or probability map.
divergence_rescale – If True, the gradient_img is scaled by the divergence which is equivalent to the mean curvature, this helps to prevent early breakage for tube-like structures.
smooth_sigma (scalar) – controls the catchment area for identifying distinct cells at the final propagation position. Smaller smooth_sigma leads to more oversegmentation.
smooth_gradient (scalar) – the isotropic sigma value controlling the Gaussian smoothing of the gradient field. More smoothing results in more cells grouped together
delta (scalar) – the voxel size to propagate grid points per iteration. Related to the stability. If too small takes too long. If too large, might not converge. if delta=1, takes a 1 voxel step.
n_iter (int) – the number of iterations to run. (To do: monitor convergence and break early to improve speed)
min_area (scalar) – volume of cells < min_area are removed.
eps (float) – a small number for numerical stability
thresh_factor (scalar) – The final cells are identified by thresholding on a threshold mean+thresh_factor*std. Thresh_factor controls what is an object prior to connected components analysis
mask ((MxNxL) numpy array) – optional binary mask to gate the region to parse labels for.
debug_viz (bool) – if True, visualise the position of the points at every algorithm iteration.
- Returns:
cell_seg_connected_original – an integer image where each unique int > 0 relates to a unique object such that object 1 is retrieved by cell_seg_connected_original==1.
- Return type:
(MxNxL)
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.watershed.gradient_watershed3D_binary(binary, gradient_img=None, momenta=0.75, divergence_rescale=True, smooth_sigma=1, smooth_gradient=1, delta=1, n_iter=100, min_area=5, eps=1e-12, thresh_factor=None, mask=None, interp=False, use_connectivity=False, connectivity_alpha=0.5, debug_viz=False, renorm_gradient=True)[source]
parses the instance level segmentation implicitly given as an input binary or a vector field. The algorithm works as an inverse watershed.
Step 1: a grid of points is seeds on the image Step 2: points are propagated for n_iter according to the gradient_img, condensing towards cell centers implicitly implied by the gradient image. Step 3: individual cluster centers are found by binarisation and connected component, removing objects < min_area
result is an integer image the same size as binary.
- Parameters:
binary ((MxNxL) numpy array) – input binary image defining the voxels that need labeling gradient_img : (MxNxLx3) numpy array This is a gradient field such as that from applying np.array(np.gradient(img)).transpose(1,2,3,0) where img is a potential such as a distance transform or probability map.
divergence_rescale – If True, the gradient_img is scaled by the divergence which is equivalent to the mean curvature, this helps to prevent early breakage for tube-like structures.
smooth_sigma (scalar) – controls the catchment area for identifying distinct cells at the final propagation position. Smaller smooth_sigma leads to more oversegmentation.
smooth_gradient (scalar) – the isotropic sigma value controlling the Gaussian smoothing of the gradient field. More smoothing results in more cells grouped together
delta (scalar) – the voxel size to propagate grid points per iteration. Related to the stability. If too small takes too long. If too large, might not converge. if delta=1, takes a 1 voxel step.
n_iter (int) – the number of iterations to run. (To do: monitor convergence and break early to improve speed)
min_area (scalar) – volume of cells < min_area are removed.
eps (float) – a small number for numerical stability
thresh_factor (scalar) – The final cells are identified by thresholding on a threshold mean+thresh_factor*std. Thresh_factor controls what is an object prior to connected components analysis
mask ((MxNxL) numpy array) – optional binary mask to gate the region to parse labels for.
debug_viz (bool) – if True, visualise the position of the points at every algorithm iteration.
- Returns:
cell_seg_connected_original – an integer image where each unique int > 0 relates to a unique object such that object 1 is retrieved by cell_seg_connected_original==1.
- Return type:
(MxNxL)
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.watershed.gradient_watershed3D_binary_dynamics(binary, gradient_img=None, momenta=0.75, divergence_rescale=True, smooth_sigma=1, smooth_gradient=1, delta=1, n_iter=100, min_area=5, eps=1e-12, thresh_factor=None, mask=None, interp=False, use_connectivity=False, connectivity_alpha=0.5, debug_viz=False, renorm_gradient=True)[source]
parses the instance level segmentation implicitly given as an input binary or a vector field. The algorithm works as an inverse watershed.
Step 1: a grid of points is seeds on the image Step 2: points are propagated for n_iter according to the gradient_img, condensing towards cell centers implicitly implied by the gradient image. Step 3: individual cluster centers are found by binarisation and connected component, removing objects < min_area
result is an integer image the same size as binary.
- Parameters:
binary ((MxNxL) numpy array) – input binary image defining the voxels that need labeling gradient_img : (MxNxLx3) numpy array This is a gradient field such as that from applying np.array(np.gradient(img)).transpose(1,2,3,0) where img is a potential such as a distance transform or probability map.
divergence_rescale – If True, the gradient_img is scaled by the divergence which is equivalent to the mean curvature, this helps to prevent early breakage for tube-like structures.
smooth_sigma (scalar) – controls the catchment area for identifying distinct cells at the final propagation position. Smaller smooth_sigma leads to more oversegmentation.
smooth_gradient (scalar) – the isotropic sigma value controlling the Gaussian smoothing of the gradient field. More smoothing results in more cells grouped together
delta (scalar) – the voxel size to propagate grid points per iteration. Related to the stability. If too small takes too long. If too large, might not converge. if delta=1, takes a 1 voxel step.
n_iter (int) – the number of iterations to run. (To do: monitor convergence and break early to improve speed)
min_area (scalar) – volume of cells < min_area are removed.
eps (float) – a small number for numerical stability
thresh_factor (scalar) – The final cells are identified by thresholding on a threshold mean+thresh_factor*std. Thresh_factor controls what is an object prior to connected components analysis
mask ((MxNxL) numpy array) – optional binary mask to gate the region to parse labels for.
debug_viz (bool) – if True, visualise the position of the points at every algorithm iteration.
- Returns:
cell_seg_connected_original – an integer image where each unique int > 0 relates to a unique object such that object 1 is retrieved by cell_seg_connected_original==1.
- Return type:
(MxNxL)
multiScaleAnalysis.SegmentationHighres.gradient_watershed.watershed_backup module
Created on Mon Feb 20 22:35:23 2023
@author: fyz11
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.watershed_backup.connected_components_pts_2D(pts, pts0, shape, smooth_sigma=1, thresh_factor=None, mask=None, min_area=1)[source]
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.watershed_backup.connected_components_pts_3D(pts, pts0, shape, smooth_sigma=1, thresh_factor=None, mask=None, min_area=1)[source]
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.watershed_backup.gradient_watershed2D_binary(binary, gradient_img=None, divergence_rescale=True, smooth_sigma=1, smooth_gradient=1, delta=0.5, n_iter=10, min_area=5, eps=1e-20, interp=True, thresh_factor=None, track_flow=True, mask=None, debug_viz=False)[source]
parses the instance level segmentation implicitly given as an input binary or a vector field. The algorithm works as an inverse watershed.
Step 1: a grid of points is seeds on the image Step 2: points are propagated for n_iter according to the gradient_img, condensing towards cell centers implicitly implied by the gradient image. Step 3: individual cluster centers are found by binarisation and connected component, removing objects < min_area
result is an integer image the same size as binary.
- Parameters:
binary ((MxNxL) numpy array) – input binary image defining the voxels that need labeling
gradient_img ((MxNxLx3) numpy array) – This is a gradient field such as that from applying np.array(np.gradient(img)).transpose(1,2,3,0) where img is a potential such as a distance transform or probability map.
divergence_rescale – If True, the gradient_img is scaled by the divergence which is equivalent to the mean curvature, this helps to prevent early breakage for tube-like structures.
smooth_sigma (scalar) – controls the catchment area for identifying distinct cells at the final propagation position. Smaller smooth_sigma leads to more oversegmentation.
smooth_gradient (scalar) – the isotropic sigma value controlling the Gaussian smoothing of the gradient field. More smoothing results in more cells grouped together
delta (scalar) – the voxel size to propagate grid points per iteration. Related to the stability. If too small takes too long. If too large, might not converge. if delta=1, takes a 1 voxel step.
n_iter (int) – the number of iterations to run. (To do: monitor convergence and break early to improve speed)
min_area (scalar) – volume of cells < min_area are removed.
eps (float) – a small number for numerical stability
thresh_factor (scalar) – The final cells are identified by thresholding on a threshold mean+thresh_factor*std. Thresh_factor controls what is an object prior to connected components analysis
mask ((MxNxL) numpy array) – optional binary mask to gate the region to parse labels for.
debug_viz (bool) – if True, visualise the position of the points at every algorithm iteration.
- Returns:
cell_seg_connected_original – an integer image where each unique int > 0 relates to a unique object such that object 1 is retrieved by cell_seg_connected_original==1.
- Return type:
(MxNxL)
- multiScaleAnalysis.SegmentationHighres.gradient_watershed.watershed_backup.gradient_watershed3D_binary(binary, gradient_img=None, divergence_rescale=True, smooth_sigma=1, smooth_gradient=1, delta=1, n_iter=100, min_area=5, eps=1e-12, thresh_factor=None, mask=None, debug_viz=False)[source]
parses the instance level segmentation implicitly given as an input binary or a vector field. The algorithm works as an inverse watershed.
Step 1: a grid of points is seeds on the image Step 2: points are propagated for n_iter according to the gradient_img, condensing towards cell centers implicitly implied by the gradient image. Step 3: individual cluster centers are found by binarisation and connected component, removing objects < min_area
result is an integer image the same size as binary.
- Parameters:
binary ((MxNxL) numpy array) – input binary image defining the voxels that need labeling gradient_img : (MxNxLx3) numpy array This is a gradient field such as that from applying np.array(np.gradient(img)).transpose(1,2,3,0) where img is a potential such as a distance transform or probability map.
divergence_rescale – If True, the gradient_img is scaled by the divergence which is equivalent to the mean curvature, this helps to prevent early breakage for tube-like structures.
smooth_sigma (scalar) – controls the catchment area for identifying distinct cells at the final propagation position. Smaller smooth_sigma leads to more oversegmentation.
smooth_gradient (scalar) – the isotropic sigma value controlling the Gaussian smoothing of the gradient field. More smoothing results in more cells grouped together
delta (scalar) – the voxel size to propagate grid points per iteration. Related to the stability. If too small takes too long. If too large, might not converge. if delta=1, takes a 1 voxel step.
n_iter (int) – the number of iterations to run. (To do: monitor convergence and break early to improve speed)
min_area (scalar) – volume of cells < min_area are removed.
eps (float) – a small number for numerical stability
thresh_factor (scalar) – The final cells are identified by thresholding on a threshold mean+thresh_factor*std. Thresh_factor controls what is an object prior to connected components analysis
mask ((MxNxL) numpy array) – optional binary mask to gate the region to parse labels for.
debug_viz (bool) – if True, visualise the position of the points at every algorithm iteration.
- Returns:
cell_seg_connected_original – an integer image where each unique int > 0 relates to a unique object such that object 1 is retrieved by cell_seg_connected_original==1.
- Return type:
(MxNxL)