"""Displays one or several slices from a 3d volume.
"""Displays one or several slices from a 3d volume.
...
@@ -59,6 +60,7 @@ def slices(
...
@@ -59,6 +60,7 @@ def slices(
show_position (bool, optional): If True, displays the position of the slices. Defaults to True.
show_position (bool, optional): If True, displays the position of the slices. Defaults to True.
interpolation (str, optional): Specifies the interpolation method for the image. Defaults to None.
interpolation (str, optional): Specifies the interpolation method for the image. Defaults to None.
cbar (bool, optional): Adds a colorbar positioned in the top-right for the corresponding colormap and data range. Defaults to False.
cbar (bool, optional): Adds a colorbar positioned in the top-right for the corresponding colormap and data range. Defaults to False.
cbar_style (str, optional): Determines the style of the colorbar. Option 'small' is height of one image row. Option 'large' spans full height of image grid. Defaults to 'small'.
Returns:
Returns:
fig (matplotlib.figure.Figure): The figure with the slices from the 3d array.
fig (matplotlib.figure.Figure): The figure with the slices from the 3d array.
...
@@ -68,6 +70,7 @@ def slices(
...
@@ -68,6 +70,7 @@ def slices(
ValueError: If the axis to slice along is not a valid choice, i.e. not an integer between 0 and the number of dimensions of the volume minus 1.
ValueError: If the axis to slice along is not a valid choice, i.e. not an integer between 0 and the number of dimensions of the volume minus 1.
ValueError: If the file or array is not a volume with at least 3 dimensions.
ValueError: If the file or array is not a volume with at least 3 dimensions.
ValueError: If the `position` keyword argument is not a integer, list of integers or one of the following strings: "start", "mid" or "end".
ValueError: If the `position` keyword argument is not a integer, list of integers or one of the following strings: "start", "mid" or "end".
ValueError: If the cbar_style keyword argument is not one of the following strings: 'small' or 'large'.
Example:
Example:
```python
```python
...
@@ -91,6 +94,10 @@ def slices(
...
@@ -91,6 +94,10 @@ def slices(
"The provided object is not a volume as it has less than 3 dimensions."
"The provided object is not a volume as it has less than 3 dimensions."
)
)
cbar_style_options=["small","large"]
ifcbar_stylenotincbar_style_options:
raiseValueError(f"Value '{cbar_style}' is not valid for colorbar style. Please select from {cbar_style_options}.")