Skip to content

Issue Running Anisotropic Tutorial #14

Description

@HanyingYan

Hi,

Thank you for developing this tool! I’ve been trying to work around the indirect method by following your anisotropic tutorial. However, both segment_epithelial_organoid_2D_stacks.py and segment_single-cell_tracking_challenge_2D_stacks.py failed when running uSegment3D.aggregate_2D_to_3D_segmentation_indirect_method(), and I received the error message below.

Could you please let me know what might be causing this issue?

Thanks!


ValueError Traceback (most recent call last)
Cell In[35], line 2
1 # perform the indirect method. As we only have xy segmentations, we set the rest to empty []. We need to pass in the shape of the 'xy' view to get the dimensionality correct.
----> 2 segmentation3D, (probability3D, gradients3D) = uSegment3D.aggregate_2D_to_3D_segmentation_indirect_method(segmentations=[labels_xy,
3 [],
4 []],
5 img_xy_shape = img_preprocess.shape,
6 precomputed_binary=None,
7 params=indirect_aggregation_params,
8 savefolder=None,
9 basename=None)
11 uSegment3D_fio.save_segmentation(os.path.join(savefolder_seg,
12 'uSegment3D_epidermal_initial_labels.tif'), segmentation3D)

File ~/miniconda3/envs/segment3D/lib/python3.9/site-packages/segment3D/usegment3d.py:504, in aggregate_2D_to_3D_segmentation_indirect_method(segmentations, params, img_xy_shape, precomputed_binary, savefolder, basename)
502 if precomputed_binary is None:
503 if sigma > 0:
--> 504 mask_combine = usegment3D_filters.var_combine([ndimage.gaussian_filter((masks[0]>0)*1., sigma=sigma),
505 ndimage.gaussian_filter((masks[1]>0).transpose(1,0,2)*1., sigma=sigma),
506 ndimage.gaussian_filter((masks[2]>0).transpose(1,2,0)*1., sigma=sigma)],
507 ksize=params['combine_cell_probs']['ksize'], # awesome... high ksize is good
508 alpha = params['combine_cell_probs']['alpha'], # was 1.0
509 eps=params['combine_cell_probs']['eps'])
510 else:
511 mask_combine = usegment3D_filters.var_combine([(masks[0]>0)*1.,
512 (masks[1]>0).transpose(1,0,2)*1.,
513 (masks[2]>0).transpose(1,2,0)*1.],
514 ksize=params['combine_cell_probs']['ksize'], # awesome... high ksize is good
515 alpha = params['combine_cell_probs']['alpha'], # was 1.0
516 eps=params['combine_cell_probs']['eps'])

File ~/miniconda3/envs/segment3D/lib/python3.9/site-packages/segment3D/filters.py:704, in var_combine(arrays, ksize, alpha, eps)
701 import skimage.filters.rank as skfilters_rank #import entropy
702 import skimage.morphology as skmorph
--> 704 weights = np.array([1./(var_filter(array, ksize=ksize) + alpha) for array in arrays])
706 v = np.sum(weights*arrays, axis=0) / (weights.sum(axis=0)+eps)
708 return v

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3,) + inhomogeneous part.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions