{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Image Processing\n", "\n", "This notebook shows some exemplary image processing algorithms. Note that plotting methods should always be called after preprocessing modules. `ds.pp.threshold(0.99).pl.colorize('red').pl.show()` will work, whereas `ds.pl.colorize('red').pp.threshold(0.99).pl.show()` will not show the thresholded image correctly." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "tags": [] }, "outputs": [], "source": [ "%reload_ext autoreload\n", "%autoreload 2\n", "\n", "import spatialproteomics\n", "import matplotlib.pyplot as plt\n", "import xarray as xr" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "tags": [] }, "outputs": [ { "data": { "text/html": [ "
<xarray.Dataset>\n", "Dimensions: (cells: 12560, channels: 56, y: 3000, x: 3000, features: 4,\n", " labels: 8, props: 2)\n", "Coordinates:\n", " * cells (cells) int64 1 2 3 4 5 6 ... 12556 12557 12558 12559 12560\n", " * channels (channels) <U11 'DAPI' 'Helios' 'CD10' ... 'CD79a' 'Ki-67'\n", " * features (features) <U10 'centroid-0' 'centroid-1' ... '_original_'\n", " * labels (labels) int64 1 2 3 4 5 6 7 8\n", " * props (props) <U6 '_color' '_name'\n", " * x (x) int64 0 1 2 3 4 5 6 ... 2994 2995 2996 2997 2998 2999\n", " * y (y) int64 0 1 2 3 4 5 6 ... 2994 2995 2996 2997 2998 2999\n", "Data variables:\n", " _arcsinh_mean (cells, channels) float64 dask.array<chunksize=(3140, 14), meta=np.ndarray>\n", " _arcsinh_sum (cells, channels) float64 dask.array<chunksize=(3140, 14), meta=np.ndarray>\n", " _image (channels, y, x) uint8 dask.array<chunksize=(7, 375, 750), meta=np.ndarray>\n", " _obs (cells, features) float64 dask.array<chunksize=(12560, 2), meta=np.ndarray>\n", " _raw_mean (cells, channels) float64 dask.array<chunksize=(3140, 14), meta=np.ndarray>\n", " _raw_sum (cells, channels) float64 dask.array<chunksize=(3140, 14), meta=np.ndarray>\n", " _segmentation (y, x) int64 dask.array<chunksize=(375, 375), meta=np.ndarray>\n", " _properties (labels, props) object dask.array<chunksize=(8, 2), meta=np.ndarray>