multicolorfits.combine_layers#

multicolorfits.combine_layers(data_list, colors, stretches=None, min_maxes=None, colorspace='rgb', blend='screen', weights=None, gamma=2.2, inverse=False, smooth_sigmas=None, preview=False, dtype=None)[source]#

Stretch, colorize, and combine a list of 2D arrays into one RGB image.

Parameters:
  • data_list (list of array) – Greyscale 2D images (same shape if not pre-aligned).

  • colors (list of str) – Hex colors, one per layer (e.g. ['#C11B17', '#4CC417']).

  • stretches (list of str or None) – Per-layer stretch names; None uses 'linear' for all.

  • min_maxes (list of [vmin, vmax] or None) – Per-layer scaling limits; None uses each array’s full range.

  • colorspace (str) – 'rgb' (classic channel sum) or 'lab' / 'hsv' / 'hsl'.

  • blend (str) – Lightness blend for Lab/HSV/HSL: 'screen', 'sum', 'max', 'mean'.

  • weights (list or None) – Optional per-layer chroma weights (Lab/HSV/HSL).

  • gamma (float) – Gamma for to_grey_rgb / colorize (default 2.2).

  • inverse (bool) – Legacy white-background mode via 1 - image (prefer a white combine_background in session / alpha APIs for new work).

  • smooth_sigmas (list of float or None) – Optional Gaussian sigma per colorized layer.

  • preview (bool) – If True, run the compose in float32 (lower memory; slightly reduced precision). Re-render with preview=False for final float64 export. Ignored when dtype is set.

  • dtype (numpy dtype or None) – Explicit working dtype; overrides preview.

Returns:

array – Combined display-ready RGB image in [0, 1].

Examples

>>> rgb = combine_layers(  
...     [d1, d2], colors=['#C11B17', '#4CC417'], colorspace='lab')