Skip to content

maps

maps

Parameter map visualization functions.

This module provides functions for visualizing perfusion parameter maps.

NO scipy dependency - uses numpy for linear regression.

plot_parameter_map

plot_parameter_map(parameter_map, slice_idx=None, axis=2, orientation=None, title=None, colormap='viridis', cmap=None, vmin=None, vmax=None, mask=None, show_mask=False, show_colorbar=True, underlay=None, alpha=1.0, ax=None, figsize=(8, 6))

Plot a 2D slice of a parameter map.

PARAMETER DESCRIPTION
parameter_map

Parameter map to visualize.

TYPE: ParameterMap or NDArray

slice_idx

Slice index to display. If None, uses middle slice.

TYPE: int DEFAULT: None

axis

Axis perpendicular to the slice (0, 1, or 2).

TYPE: int DEFAULT: 2

orientation

Orientation name: "axial", "coronal", or "sagittal". If provided, overrides axis parameter.

TYPE: str DEFAULT: None

title

Plot title. Uses parameter name if not provided.

TYPE: str DEFAULT: None

colormap

Matplotlib colormap name.

TYPE: str DEFAULT: 'viridis'

cmap

Alias for colormap (for compatibility).

TYPE: str DEFAULT: None

vmin

Color scale limits.

TYPE: float DEFAULT: None

vmax

Color scale limits.

TYPE: float DEFAULT: None

mask

Mask to apply (show only masked region).

TYPE: NDArray DEFAULT: None

show_mask

Whether to show quality mask from ParameterMap.

TYPE: bool DEFAULT: False

show_colorbar

Whether to show colorbar.

TYPE: bool DEFAULT: True

underlay

Anatomical underlay image.

TYPE: NDArray DEFAULT: None

alpha

Transparency for overlay (when underlay is provided).

TYPE: float DEFAULT: 1.0

ax

Axes to plot on. Creates new figure if None.

TYPE: Axes DEFAULT: None

figsize

Figure size if creating new figure.

TYPE: tuple DEFAULT: (8, 6)

RETURNS DESCRIPTION
Figure or Axes

The figure or axes with the plot.

RAISES DESCRIPTION
ImportError

If matplotlib is not available.

plot_parameter_comparison

plot_parameter_comparison(*maps_args, maps=None, slice_idx=None, axis=2, colormap='viridis', figsize=None)

Plot multiple parameter maps side by side.

PARAMETER DESCRIPTION
*maps_args

Parameter maps to compare (positional arguments).

TYPE: ParameterMap DEFAULT: ()

maps

List of parameter maps (alternative to positional args).

TYPE: list[ParameterMap] DEFAULT: None

slice_idx

Slice index to display.

TYPE: int DEFAULT: None

axis

Slice axis.

TYPE: int DEFAULT: 2

colormap

Colormap name.

TYPE: str DEFAULT: 'viridis'

figsize

Figure size.

TYPE: tuple DEFAULT: None

RETURNS DESCRIPTION
Figure

The figure with the plots.

create_montage

create_montage(data, n_cols=5, colormap='viridis', vmin=None, vmax=None, figsize=None)

Create a montage of all slices in a 3D volume.

PARAMETER DESCRIPTION
data

3D data volume.

TYPE: NDArray

n_cols

Number of columns in montage.

TYPE: int DEFAULT: 5

colormap

Colormap name.

TYPE: str DEFAULT: 'viridis'

vmin

Color limits.

TYPE: float DEFAULT: None

vmax

Color limits.

TYPE: float DEFAULT: None

figsize

Figure size.

TYPE: tuple DEFAULT: None

RETURNS DESCRIPTION
Figure

The figure with the montage.