Skip to content

Implemented 3D connected components as wrapper class for scipy.ndimage.label

s204159 requested to merge 3d_connected_components into main

Ticket: https://www.notion.so/qim-dtu/3D-connected-components-ca5c410fef49444eac7c6efd0b56ead4?pvs=4

I have made a simple plot functions that takes the ConnectedComponents object and extracts the connected_components volume.

However I don't know if it is necessary as the user could do this manually.

def plot_connected_components(connected_components: ConnectedComponents, **kwargs):
    """ Plots connected components from the ConnectedComponents class as 2d slices.

    Args:
        connected_components (ConnectedComponents): The connected components class from the qim3d.utils.connected_components module.
        **kwargs: Additional keyword arguments to pass to qim3d.viz.img.slice_viz.

    Returns:
        matplotlib.pyplot: the 3D plot of the connected components.
    """
    fig = slice_viz(connected_components.connected_components, **kwargs)
    return fig

Merge request reports