arboretum/utils.py
def localize(stack_as_array: np.ndarray,
             **kwargs):
    """ localize

    get the centroids of all objects given a segmentaion mask from Napari.

    Should work with volumetric data, and infers the object class label from
    the segmentation label.

    Parameters:
        stack_as_array: a numpy array of the stack, typically the data from
            a napari 'labels' layer

        use_labels: bool, use the labels present in a binary image

    Notes:
        - multiprocessing is not a good options for use with the GUI. Change to
        a generator
    """

    if 'binary_segmentation' not in kwargs:
        is_binary = _is_binary_segmentation(stack_as_array[0,...])
        print(f'guessing is_binary: {is_binary}')
    else:
        is_binary = kwargs['binary_segmentation']
        assert type(is_binary) == type(bool)

    use_labels = kwargs.get('use_labels', False)

    stack = _Stack(stack_as_array)
    localizations=[_localize_process(s,
                                     is_binary=is_binary,
                                     use_labels=use_labels) for s in stack]
    return np.concatenate(localizations, axis=0)
 localize

    get the centroids of all objects given a segmentaion mask from Napari.

    Should work with volumetric data, and infers the object class label from
    the segmentation label.

    Parameters:
        stack_as_array: a numpy array of the stack, typically the data from
            a napari 'labels' layer

        use_labels: bool, use the labels present in a binary image

    Notes:
        - multiprocessing is not a good options for use with the GUI. Change to
        a generator
    
localize
get the centroids of all objects given a segmentaion mask from Napari.

Should work with volumetric data, and infers the object class label from
the segmentation label.
localize get the centroids of all objects given a segmentaion mask from Napari . Should work with volumetric data and infers the object class label from the segmentation label .
def localize(stack_as_array: np.ndarray,
             **kwargs):
    if 'binary_segmentation' not in kwargs:
        is_binary = _is_binary_segmentation(stack_as_array[0,...])
        print(f'guessing is_binary: {is_binary}')
    else:
        is_binary = kwargs['binary_segmentation']
        assert type(is_binary) == type(bool)
    use_labels = kwargs.get('use_labels', False)
    stack = _Stack(stack_as_array)
    localizations=[_localize_process(s,
                                     is_binary=is_binary,
                                     use_labels=use_labels) for s in stack]
    return np.concatenate(localizations, axis=0)
def localize ( stack_as_array : np . ndarray , ** kwargs ) : if 'binary_segmentation' not in kwargs : is_binary = _is_binary_segmentation ( stack_as_array [ 0 , ... ] ) print ( f'guessing is_binary: {is_binary}' ) else : is_binary = kwargs [ 'binary_segmentation' ] assert type ( is_binary ) == type ( bool ) use_labels = kwargs . get ( 'use_labels' , False ) stack = _Stack ( stack_as_array ) localizations = [ _localize_process ( s , is_binary = is_binary , use_labels = use_labels ) for s in stack ] return np . concatenate ( localizations , axis = 0 )
localize
get the centroids of all objects given a segmentaion mask from Napari.
localize get the centroids of all objects given a segmentaion mask from Napari .
""" localize

    get the centroids of all objects given a segmentaion mask from Napari.

    Should work with volumetric data, and infers the object class label from
    the segmentation label.

    Parameters:
        stack_as_array: a numpy array of the stack, typically the data from
            a napari 'labels' layer

        use_labels: bool, use the labels present in a binary image

    Notes:
        - multiprocessing is not a good options for use with the GUI. Change to
        a generator
    """
stack_as_array
np.ndarray
a numpy array of the stack, typically the data from
a napari 'labels' layer
a numpy array of the stack typically the data from a napari ' labels ' layer
use_labels
bool, use the labels present in a binary image
bool use the labels present in a binary image