{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Interactivity\n", "\n", "*Spatialproteomics* has a variety of functions to ensure interoperability with existing tools. For example, we can export the *spatialproteomics* object into *spatialdata*, and the use *napari* for interactive visualiztations." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "%reload_ext autoreload\n", "%autoreload 2\n", "\n", "import spatialproteomics as sp\n", "import xarray as xr\n", "from napari_spatialdata import Interactive\n", "import spatialdata\n", "from spatialdata import SpatialData\n", "import numpy as np" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/opt/conda/lib/python3.10/site-packages/xarray/backends/plugins.py:159: RuntimeWarning: 'scipy' fails while guessing\n", " warnings.warn(f\"{engine!r} fails while guessing\", RuntimeWarning)\n" ] }, { "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 3.111 0.0 1.391 ... 1.324 0.4174\n", " _arcsinh_sum (cells, channels) float64 8.346 0.0 6.564 ... 6.625 5.224\n", " _image (channels, y, x) uint8 4 4 4 4 5 4 4 3 4 ... 2 2 2 2 2 2 2 2\n", " _obs (cells, features) float64 613.3 768.4 4.0 ... 8.0 7.0\n", " _raw_mean (cells, channels) float64 56.02 0.0 9.426 ... 8.727 2.148\n", " _raw_sum (cells, channels) float64 1.053e+04 0.0 ... 1.885e+03 464.0\n", " _segmentation (y, x) int64 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0\n", " _properties (labels, props) object 'C3' ... 'B (PAX5)'