Slice Matrix

class SliceMatrix(slices, texts_top=None, texts_left=None, color_type=SliceMatrixColorType.COLOR_CENTERED, height_slice=520, width_text=300, height_color_bar=150, font=None, font_size=None, text_view_height=100)[source]

Bases: object

Initialize a SliceMatrix, a structured arrangement of slices with optional text annotations and color bar configurations.

A SliceMatrix can be used to render multiple slices at once into a layout. It can additionally render color bars, and descriptive text.

A SliceMatrix reserves the entire layout and manages its own internal structure. No additional views can be added once the layout is dedicated to a slice matrix.

Parameters:
  • slices (list[Slice]) – The list of Slice objects that will be rendered.

  • texts_top (list[str]) – Text annotations for the top row (one per column).

  • texts_left (list[str]) – Text annotations for the left column (one per row).

  • color_type (SliceMatrixColorType) – Defines the color bar strategy for the matrix.

  • height_slice (int) – Height in pixels of each slice in the matrix.

  • width_text (int) – Width in pixels of the left‑side text views (if any).

  • height_color_bar (int) – Height in pixels of the color bars in the matrix.

  • font (str) – Font used for text annotations (e.g., "Times", "Courier", "Arial").

  • font_size (int) – Font size used for text annotations.

  • text_view_height (int) – Height in pixels of the top text views.

Returns:

None

render(layout)[source]

Render the slice matrix into the provided layout.

This method organizes and renders: - The slice grid - Optional top text row - Optional left text column - Color bars (depending on the slice matrix color mode)

The layout is modified by inserting additional rows and/or columns to accommodate text annotations and color bars as required by the chosen SliceMatrixColorType.

Parameters:

layout (Layout) – The layout into which the slice matrix should be rendered.

Returns:

None