Image Processing vox.morphology

Performs various image manipulations on binary images based on techniques from Mathematical morphology. To use within scripting, first retrieve a binary image of the current voxels:

im = voxels.image()

Then pass the resulting image to any of these functions. The resulting binary image can be consumed by the Add/Remove Voxels tool or by the PowerEdit tool:

# erodes the image (removes voxels starting from the boundary)
morph.erode im

# fills a hole starting at 4, 5, 8
morph.fillHole im, [4, 5, 8]

Methods

Call methods with.name(),.name(arguments)or just .name arguments .

  • close (arr, [radius], [p]) -> ndarray#

    Performs a morphological closing on the input array with a ball of the given radius. Closing removes holes the size of the structuring element; use a larger radius to close bigger holes.

    Parameters
    arr
    ndarray

    Binary image (updated in place)

    radius
    Number

    Size of the structuring element

    (Optional; defaults to 1)
    p
    Number

    Exponent of the metric

    (Optional; defaults to 2)
    Return
    return
    ndarray

    Resulting image

  • dilate (arr, [radius], [p]) -> ndarray#

    Performs a morphological dilation on the input array with a ball of the given radius.

    Parameters
    arr
    ndarray

    Binary image (updated in place)

    radius
    Number

    Size of the structuring element

    (Optional; defaults to 1)
    p
    Number

    Exponent of the metric

    (Optional; defaults to 2)
    Return
    return
    ndarray

    Resulting image

  • erode (arr, [radius], [p]) -> ndarray#

    Performs a morphological erosion on the input array with a ball of the given radius

    Parameters
    arr
    ndarray

    Binary image (updated in place)

    radius
    Number

    Size of the structuring element

    (Optional; defaults to 1)
    p
    Number

    Exponent of the metric

    (Optional; defaults to 2)
    Return
    return
    ndarray

    Resulting image

  • fillHole (arr, hint, [radius], [p]) -> ndarray#

    Fills a 3D hole within the input array, starting at the given position. This acts like a smarter "flood fill"---like the paint bucket tool in Photoshop.

    Parameters
    arr
    ndarray

    Binary image (updated in place)

    hint
    Number[]

    Position in the array to start filling

    radius
    Number

    Size of the structuring element

    (Optional; defaults to 1)
    p
    Number

    Exponent of the metric

    (Optional; defaults to 2)
    Return
    return
    ndarray

    Resulting image

  • getBoundary (arr) -> ndarray#

    Gets the 3D boundary of the input array

    Parameters
    arr
    ndarray

    Binary image (updated in place)

    Return
    return
    ndarray

    Resulting image

  • open (arr, [radius], [p]) -> ndarray#

    Performs a morphological opening on the input array with a ball of the given radius.

    Opening removes small objects; use a larger radius to remove bigger objects.

    Parameters
    arr
    ndarray

    Binary image (updated in place)

    radius
    Number

    Size of the structuring element

    (Optional; defaults to 1)
    p
    Number

    Exponent of the metric

    (Optional; defaults to 2)
    Return
    return
    ndarray

    Resulting image