Skip to content
Snippets Groups Projects

Docstrings

1 file
+ 6
6
Compare changes
  • Side-by-side
  • Inline
  • 4f8727e5
    fix · 4f8727e5
    s214735 authored
+ 14
14
@@ -21,27 +21,27 @@ def plot_cc(
Parameters:
connected_components (CC): The connected components object.
component_indexs (list | tuple, optional): The components to plot. If None the first max_cc_to_plot=32 components will be plotted. Defaults to None.
component_indexs (list or tuple, optional): The components to plot. If None the first max_cc_to_plot=32 components will be plotted. Defaults to None.
max_cc_to_plot (int, optional): The maximum number of connected components to plot. Defaults to 32.
overlay (optional): Overlay image. Defaults to None.
overlay (np.ndarray or None, optional): Overlay image. Defaults to None.
crop (bool, optional): Whether to crop the image to the cc. Defaults to False.
show (bool, optional): Whether to show the figure. Defaults to True.
cmap (str, optional): Specifies the color map for the image. Defaults to "viridis".
vmin (float, optional): Together with vmax define the data range the colormap covers. By default colormap covers the full range. Defaults to None.
vmax (float, optional): Together with vmin define the data range the colormap covers. By default colormap covers the full range. Defaults to None
**kwargs: Additional keyword arguments to pass to `qim3d.viz.slices_grid`.
display_figure (bool, optional): Whether to show the figure. Defaults to True.
color_map (str, optional): Specifies the color map for the image. Defaults to "viridis".
value_min (float or None, optional): Together with vmax define the data range the colormap covers. By default colormap covers the full range. Defaults to None.
value_max (float or None, optional): Together with vmin define the data range the colormap covers. By default colormap covers the full range. Defaults to None
**kwargs (Any): Additional keyword arguments to pass to `qim3d.viz.slices_grid`.
Returns:
figs (list[plt.Figure]): List of figures, if `show=False`.
figs (list[plt.Figure]): List of figures, if `display_figure=False`.
Example:
```python
import qim3d
vol = qim3d.examples.cement_128x128x128[50:150]
vol_bin = vol<80
cc = qim3d.processing.get_3d_cc(vol_bin)
qim3d.viz.plot_cc(cc, crop=True, show=True, overlay=None, n_slices=5, component_indexs=[4,6,7])
qim3d.viz.plot_cc(cc, crop=True, show=True, overlay=vol, n_slices=5, component_indexs=[4,6,7])
cc = qim3d.segmentation.get_3d_cc(vol_bin)
qim3d.viz.plot_cc(cc, crop=True, display_figure=True, overlay=None, num_slices=5, component_indexs=[4,6,7])
qim3d.viz.plot_cc(cc, crop=True, display_figure=True, overlay=vol, num_slices=5, component_indexs=[4,6,7])
```
![plot_cc_no_overlay](assets/screenshots/plot_cc_no_overlay.png)
![plot_cc_overlay](assets/screenshots/plot_cc_overlay.png)
@@ -79,12 +79,12 @@ def plot_cc(
)
else:
# assigns discrete color map to each connected component if not given
if "cmap" not in kwargs:
kwargs["cmap"] = qim3d.viz.colormaps.segmentation(len(component_indexs))
if "color_map" not in kwargs:
kwargs["color_map"] = qim3d.viz.colormaps.segmentation(len(component_indexs))
# Plot the connected component without overlay
fig = qim3d.viz.slices_grid(
connected_components.get_cc(component, crop=crop), show=show, **kwargs
connected_components.get_cc(component, crop=crop), display_figure=display_figure, **kwargs
)
figs.append(fig)
Loading