locan.visualize.render_napari.render2d.render_2d_rgb_napari#

locan.visualize.render_napari.render2d.render_2d_rgb_napari(locdatas, loc_properties=None, other_property=None, bins=None, n_bins=None, bin_size=10, bin_edges=None, bin_range=None, rescale=None, viewer=None, **kwargs)[source]#

Render localization data into a 2D RGB image by binning x,y-coordinates into regular bins.

Note

For rescale=False no normalization is carried out image intensities are clipped to (0, 1) for float value or (0, 255) for integer values according to the matplotlib.imshow behavior. For rescale=None we apply a normalization to (min, max) of all intensity values. For all other rescale options the normalization is applied to each individual image.

Parameters:
  • locdatas (Iterable[LocData]) – Localization data.

  • loc_properties (Optional[list[str]]) – Localization properties to be grouped into bins. If None The coordinate_values of locdata are used.

  • other_property (Optional[str]) – Localization property (columns in locdata.data) that is averaged in each pixel. If None, localization counts are shown.

  • bins (UnionType[Bins, Axis, AxesTuple, None]) – The bin specification as defined in Bins

  • bin_edges (UnionType[Sequence[float], Sequence[Sequence[float]], None]) – Bin edges for all or each dimension with shape (dimension, n_bin_edges).

  • bin_range (Union[tuple[float, float], Sequence[float], Sequence[Sequence[float]], Literal['zero', 'link'], None]) – Minimum and maximum edge for all or each dimensions with shape (2,) or (dimension, 2). If None (min, max) ranges are determined from data and returned; if ‘zero’ (0, max) ranges with max determined from data are returned. if ‘link’ (min_all, max_all) ranges with min and max determined from all combined data are returned.

  • n_bins (UnionType[int, Sequence[int], None]) – The number of bins for all or each dimension. 5 yields 5 bins in all dimensions. (2, 5) yields 2 bins for one dimension and 5 for the other dimension.

  • bin_size (UnionType[float, Sequence[float], Sequence[Sequence[float]], None]) – The size of bins for all or each bin and for all or each dimension with shape (dimension,) or (dimension, n_bins). 5 would describe bin_size of 5 for all bins in all dimensions. ((2, 5),) yield bins of size (2, 5) for one dimension. (2, 5) yields bins of size 2 for one dimension and 5 for the other dimension. ((2, 5), (1, 3)) yields bins of size (2, 5) for one dimension and (1, 3) for the other dimension. To specify arbitrary sequence of bin_size use bin_edges instead.

  • rescale (UnionType[int, str, Trafo, Callable[..., Any], bool, None]) – Transformation as defined in locan.Trafo or by transformation function. For None or False no rescaling occurs. Legacy behavior: For tuple with upper and lower bounds provided in percent, rescale intensity values to be within percentile of max and min intensities. For ‘equal’ intensity values are rescaled by histogram equalization.

  • viewer (Viewer) – The viewer object on which to add the image

  • kwargs (Any) – Other parameters passed to napari.Viewer.add_image().

Return type:

napari.Viewer