iscc.sample.tissue_image ¶
Rasterize cell positions into an H&E-like morphology background image.
Bins the (row, col) positions into a grid_side*px square raster, smooths the density,
and maps it to colour (denser tissue → darker/more nuclear). This is the tissue image a
spatial slide sits on — morphology only, carrying no per-cell data — suitable for
adata.uns['spatial'][lib]['images']['hires'].
The density is normalised by a high percentile (not the single peak) and clipped, so one unusually dense patch does not wash out the contrast of the rest of the section — that peak-normalisation is what made an earlier version read as structureless.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coords
|
(array - like, shape(n_cells, 2))
|
Sub-deme cell positions as |
required |
grid_side
|
int or tuple of int
|
Capture-area extent in coordinate units: a scalar for a square area, or |
required |
px
|
int
|
Pixels per coordinate unit; also the |
14
|
darkness
|
float
|
Maximum darkening of the densest tissue (0 = pale everywhere, 1 = full stain at peak). |
0.85
|
sigma_frac
|
float
|
Gaussian smoothing sigma as a fraction of |
0.32
|
stain
|
(he, grey)
|
|
"he"
|
Returns:
| Name | Type | Description |
|---|---|---|
image |
(ndarray, shape(rows * px, cols * px, 3), float32)
|
RGB morphology image in |
scalef |
float
|
The |