Launch binder

Extract segmentation features

This example shows how to extract segmentation features from the tissue image.

Features extracted from a nucleus segmentation range from the number of nuclei per image, over nuclei shapes and sizes, to the intensity of the input channels within the segmented objects. They are very interpretable features and provide valuable additional information. Segmentation features are calculated by using features = 'segmentation', which calls squidpy.im.ImageContainer.features_segmentation().

In addition to feature_name and channels we can specify the following features_kwargs:

See also

import squidpy as sq

import matplotlib.pyplot as plt

First, let’s load the fluorescence Visium dataset.

img = sq.datasets.visium_fluo_image_crop()
adata = sq.datasets.visium_fluo_adata_crop()

Before calculating segmentation features, we need to first calculate a segmentation using squidpy.im.segment().

sq.im.segment(img=img, layer="image", layer_added="segmented_watershed", method="watershed", channel=0)

Now we can calculate segmentation features. Here, we will calculate the following features:

  • number of nuclei label.

  • mean area of nuclei area.

  • mean intensity of channels 1 (anti-NEUN) and 2 (anti-GFAP) within nuclei mean_intensity.

We use mask_cicle = True to ensure that we are only extracting features from the tissue underneath each Visium spot. For more details on the image cropping, see Crop images with ImageContainer.

sq.im.calculate_image_features(
    adata,
    img,
    layer="image",
    features="segmentation",
    key_added="segmentation_features",
    features_kwargs={
        "segmentation": {
            "label_layer": "segmented_watershed",
            "props": ["label", "area", "mean_intensity"],
            "channels": [1, 2],
        }
    },
    mask_circle=True,
)

Out:

  0%|          | 0/704 [00:00<?, ?/s]
  0%|          | 1/704 [00:05<1:08:04,  5.81s/]
  0%|          | 2/704 [00:06<29:30,  2.52s/]
  0%|          | 3/704 [00:06<17:14,  1.48s/]
  1%|          | 4/704 [00:06<11:27,  1.02/s]
  1%|          | 5/704 [00:06<08:16,  1.41/s]
  1%|          | 6/704 [00:06<06:21,  1.83/s]
  1%|          | 7/704 [00:07<05:07,  2.26/s]
  1%|1         | 8/704 [00:07<04:17,  2.70/s]
  1%|1         | 9/704 [00:07<03:45,  3.09/s]
  1%|1         | 10/704 [00:07<03:23,  3.42/s]
  2%|1         | 11/704 [00:08<03:07,  3.69/s]
  2%|1         | 12/704 [00:08<02:58,  3.88/s]
  2%|1         | 13/704 [00:08<02:50,  4.05/s]
  2%|1         | 14/704 [00:08<02:44,  4.19/s]
  2%|2         | 15/704 [00:08<02:42,  4.24/s]
  2%|2         | 16/704 [00:09<02:39,  4.32/s]
  2%|2         | 17/704 [00:09<02:36,  4.40/s]
  3%|2         | 18/704 [00:09<02:36,  4.37/s]
  3%|2         | 19/704 [00:09<02:34,  4.43/s]
  3%|2         | 20/704 [00:10<02:34,  4.43/s]
  3%|2         | 21/704 [00:10<02:33,  4.46/s]
  3%|3         | 22/704 [00:10<02:34,  4.42/s]
  3%|3         | 23/704 [00:10<02:33,  4.42/s]
  3%|3         | 24/704 [00:10<02:33,  4.42/s]
  4%|3         | 25/704 [00:11<02:32,  4.46/s]
  4%|3         | 26/704 [00:11<02:38,  4.29/s]
  4%|3         | 27/704 [00:11<02:35,  4.36/s]
  4%|3         | 28/704 [00:11<02:33,  4.40/s]
  4%|4         | 29/704 [00:12<02:33,  4.40/s]
  4%|4         | 30/704 [00:12<02:31,  4.44/s]
  4%|4         | 31/704 [00:12<02:31,  4.43/s]
  5%|4         | 32/704 [00:12<02:30,  4.46/s]
  5%|4         | 33/704 [00:13<02:32,  4.41/s]
  5%|4         | 34/704 [00:13<02:29,  4.47/s]
  5%|4         | 35/704 [00:13<02:28,  4.50/s]
  5%|5         | 36/704 [00:13<02:27,  4.52/s]
  5%|5         | 37/704 [00:13<02:28,  4.50/s]
  5%|5         | 38/704 [00:14<02:27,  4.52/s]
  6%|5         | 39/704 [00:14<02:27,  4.50/s]
  6%|5         | 40/704 [00:14<02:27,  4.50/s]
  6%|5         | 41/704 [00:14<02:27,  4.49/s]
  6%|5         | 42/704 [00:15<02:27,  4.47/s]
  6%|6         | 43/704 [00:15<02:27,  4.48/s]
  6%|6         | 44/704 [00:15<02:25,  4.52/s]
  6%|6         | 45/704 [00:15<02:24,  4.55/s]
  7%|6         | 46/704 [00:15<02:24,  4.56/s]
  7%|6         | 47/704 [00:16<02:24,  4.53/s]
  7%|6         | 48/704 [00:16<02:24,  4.53/s]
  7%|6         | 49/704 [00:16<02:24,  4.52/s]
  7%|7         | 50/704 [00:16<02:24,  4.53/s]
  7%|7         | 51/704 [00:16<02:23,  4.54/s]
  7%|7         | 52/704 [00:17<02:23,  4.54/s]
  8%|7         | 53/704 [00:17<02:24,  4.52/s]
  8%|7         | 54/704 [00:17<02:24,  4.50/s]
  8%|7         | 55/704 [00:17<02:24,  4.48/s]
  8%|7         | 56/704 [00:18<02:24,  4.49/s]
  8%|8         | 57/704 [00:18<02:24,  4.48/s]
  8%|8         | 58/704 [00:18<02:23,  4.51/s]
  8%|8         | 59/704 [00:18<02:23,  4.48/s]
  9%|8         | 60/704 [00:18<02:24,  4.47/s]
  9%|8         | 61/704 [00:19<02:35,  4.14/s]
  9%|8         | 62/704 [00:19<02:40,  4.00/s]
  9%|8         | 63/704 [00:19<02:42,  3.93/s]
  9%|9         | 64/704 [00:20<02:32,  4.20/s]
  9%|9         | 65/704 [00:20<02:27,  4.33/s]
  9%|9         | 66/704 [00:20<02:23,  4.45/s]
 10%|9         | 67/704 [00:20<02:27,  4.33/s]
 10%|9         | 68/704 [00:21<02:52,  3.69/s]
 10%|9         | 69/704 [00:21<02:56,  3.60/s]
 10%|9         | 70/704 [00:21<02:45,  3.83/s]
 10%|#         | 71/704 [00:21<02:37,  4.02/s]
 10%|#         | 72/704 [00:22<02:30,  4.19/s]
 10%|#         | 73/704 [00:22<02:27,  4.26/s]
 11%|#         | 74/704 [00:22<02:30,  4.19/s]
 11%|#         | 75/704 [00:22<02:29,  4.21/s]
 11%|#         | 76/704 [00:22<02:29,  4.20/s]
 11%|#         | 77/704 [00:23<02:31,  4.15/s]
 11%|#1        | 78/704 [00:23<02:24,  4.34/s]
 11%|#1        | 79/704 [00:23<02:22,  4.39/s]
 11%|#1        | 80/704 [00:23<02:29,  4.17/s]
 12%|#1        | 81/704 [00:24<02:30,  4.13/s]
 12%|#1        | 82/704 [00:24<02:29,  4.15/s]
 12%|#1        | 83/704 [00:24<02:35,  4.00/s]
 12%|#1        | 84/704 [00:24<02:33,  4.04/s]
 12%|#2        | 85/704 [00:25<02:32,  4.06/s]
 12%|#2        | 86/704 [00:25<02:28,  4.17/s]
 12%|#2        | 87/704 [00:25<02:27,  4.18/s]
 12%|#2        | 88/704 [00:25<02:30,  4.09/s]
 13%|#2        | 89/704 [00:26<02:25,  4.22/s]
 13%|#2        | 90/704 [00:26<02:23,  4.27/s]
 13%|#2        | 91/704 [00:26<02:21,  4.34/s]
 13%|#3        | 92/704 [00:26<02:24,  4.23/s]
 13%|#3        | 93/704 [00:27<02:30,  4.06/s]
 13%|#3        | 94/704 [00:27<02:34,  3.95/s]
 13%|#3        | 95/704 [00:27<02:29,  4.07/s]
 14%|#3        | 96/704 [00:27<02:23,  4.22/s]
 14%|#3        | 97/704 [00:27<02:21,  4.28/s]
 14%|#3        | 98/704 [00:28<02:24,  4.20/s]
 14%|#4        | 99/704 [00:28<02:22,  4.25/s]
 14%|#4        | 100/704 [00:28<02:19,  4.34/s]
 14%|#4        | 101/704 [00:28<02:17,  4.38/s]
 14%|#4        | 102/704 [00:29<02:13,  4.50/s]
 15%|#4        | 103/704 [00:29<02:11,  4.56/s]
 15%|#4        | 104/704 [00:29<02:17,  4.36/s]
 15%|#4        | 105/704 [00:29<02:18,  4.33/s]
 15%|#5        | 106/704 [00:30<02:18,  4.33/s]
 15%|#5        | 107/704 [00:30<02:16,  4.38/s]
 15%|#5        | 108/704 [00:30<02:16,  4.38/s]
 15%|#5        | 109/704 [00:30<02:15,  4.40/s]
 16%|#5        | 110/704 [00:30<02:15,  4.37/s]
 16%|#5        | 111/704 [00:31<02:15,  4.39/s]
 16%|#5        | 112/704 [00:31<02:14,  4.39/s]
 16%|#6        | 113/704 [00:31<02:14,  4.38/s]
 16%|#6        | 114/704 [00:31<02:14,  4.39/s]
 16%|#6        | 115/704 [00:32<02:13,  4.41/s]
 16%|#6        | 116/704 [00:32<02:14,  4.38/s]
 17%|#6        | 117/704 [00:32<02:15,  4.33/s]
 17%|#6        | 118/704 [00:32<02:15,  4.32/s]
 17%|#6        | 119/704 [00:33<02:15,  4.32/s]
 17%|#7        | 120/704 [00:33<02:15,  4.30/s]
 17%|#7        | 121/704 [00:33<02:15,  4.31/s]
 17%|#7        | 122/704 [00:33<02:14,  4.33/s]
 17%|#7        | 123/704 [00:33<02:12,  4.38/s]
 18%|#7        | 124/704 [00:34<02:13,  4.35/s]
 18%|#7        | 125/704 [00:34<02:13,  4.35/s]
 18%|#7        | 126/704 [00:34<02:13,  4.33/s]
 18%|#8        | 127/704 [00:34<02:12,  4.35/s]
 18%|#8        | 128/704 [00:35<02:12,  4.35/s]
 18%|#8        | 129/704 [00:35<02:12,  4.33/s]
 18%|#8        | 130/704 [00:35<02:12,  4.32/s]
 19%|#8        | 131/704 [00:35<02:12,  4.33/s]
 19%|#8        | 132/704 [00:36<02:11,  4.34/s]
 19%|#8        | 133/704 [00:36<02:11,  4.36/s]
 19%|#9        | 134/704 [00:36<02:10,  4.36/s]
 19%|#9        | 135/704 [00:36<02:10,  4.35/s]
 19%|#9        | 136/704 [00:36<02:11,  4.32/s]
 19%|#9        | 137/704 [00:37<02:11,  4.33/s]
 20%|#9        | 138/704 [00:37<02:10,  4.34/s]
 20%|#9        | 139/704 [00:37<02:09,  4.35/s]
 20%|#9        | 140/704 [00:37<02:11,  4.30/s]
 20%|##        | 141/704 [00:38<02:09,  4.35/s]
 20%|##        | 142/704 [00:38<02:10,  4.32/s]
 20%|##        | 143/704 [00:38<02:08,  4.36/s]
 20%|##        | 144/704 [00:38<02:08,  4.35/s]
 21%|##        | 145/704 [00:39<02:08,  4.35/s]
 21%|##        | 146/704 [00:39<02:07,  4.36/s]
 21%|##        | 147/704 [00:39<02:07,  4.36/s]
 21%|##1       | 148/704 [00:39<02:07,  4.37/s]
 21%|##1       | 149/704 [00:39<02:07,  4.36/s]
 21%|##1       | 150/704 [00:40<02:07,  4.35/s]
 21%|##1       | 151/704 [00:40<02:07,  4.34/s]
 22%|##1       | 152/704 [00:40<02:08,  4.31/s]
 22%|##1       | 153/704 [00:40<02:08,  4.30/s]
 22%|##1       | 154/704 [00:41<02:08,  4.29/s]
 22%|##2       | 155/704 [00:41<02:08,  4.27/s]
 22%|##2       | 156/704 [00:41<02:07,  4.29/s]
 22%|##2       | 157/704 [00:41<02:07,  4.29/s]
 22%|##2       | 158/704 [00:42<02:07,  4.28/s]
 23%|##2       | 159/704 [00:42<02:06,  4.30/s]
 23%|##2       | 160/704 [00:42<02:06,  4.30/s]
 23%|##2       | 161/704 [00:42<02:06,  4.30/s]
 23%|##3       | 162/704 [00:42<02:07,  4.26/s]
 23%|##3       | 163/704 [00:43<02:05,  4.30/s]
 23%|##3       | 164/704 [00:43<02:04,  4.34/s]
 23%|##3       | 165/704 [00:43<02:02,  4.39/s]
 24%|##3       | 166/704 [00:43<02:01,  4.42/s]
 24%|##3       | 167/704 [00:44<02:00,  4.46/s]
 24%|##3       | 168/704 [00:44<02:01,  4.41/s]
 24%|##4       | 169/704 [00:44<02:00,  4.42/s]
 24%|##4       | 170/704 [00:44<02:00,  4.42/s]
 24%|##4       | 171/704 [00:44<02:00,  4.41/s]
 24%|##4       | 172/704 [00:45<02:01,  4.39/s]
 25%|##4       | 173/704 [00:45<02:00,  4.41/s]
 25%|##4       | 174/704 [00:45<01:59,  4.42/s]
 25%|##4       | 175/704 [00:45<02:00,  4.39/s]
 25%|##5       | 176/704 [00:46<02:02,  4.31/s]
 25%|##5       | 177/704 [00:46<02:02,  4.29/s]
 25%|##5       | 178/704 [00:46<02:02,  4.31/s]
 25%|##5       | 179/704 [00:46<02:01,  4.32/s]
 26%|##5       | 180/704 [00:47<02:00,  4.35/s]
 26%|##5       | 181/704 [00:47<01:59,  4.37/s]
 26%|##5       | 182/704 [00:47<01:59,  4.36/s]
 26%|##5       | 183/704 [00:47<02:01,  4.29/s]
 26%|##6       | 184/704 [00:47<02:01,  4.30/s]
 26%|##6       | 185/704 [00:48<01:59,  4.34/s]
 26%|##6       | 186/704 [00:48<01:58,  4.37/s]
 27%|##6       | 187/704 [00:48<01:58,  4.37/s]
 27%|##6       | 188/704 [00:48<01:59,  4.34/s]
 27%|##6       | 189/704 [00:49<01:58,  4.36/s]
 27%|##6       | 190/704 [00:49<01:58,  4.34/s]
 27%|##7       | 191/704 [00:49<01:57,  4.35/s]
 27%|##7       | 192/704 [00:49<01:56,  4.40/s]
 27%|##7       | 193/704 [00:50<01:56,  4.39/s]
 28%|##7       | 194/704 [00:50<01:54,  4.46/s]
 28%|##7       | 195/704 [00:50<01:52,  4.54/s]
 28%|##7       | 196/704 [00:50<01:58,  4.30/s]
 28%|##7       | 197/704 [00:50<02:02,  4.13/s]
 28%|##8       | 198/704 [00:51<02:00,  4.21/s]
 28%|##8       | 199/704 [00:51<01:56,  4.32/s]
 28%|##8       | 200/704 [00:51<01:54,  4.41/s]
 29%|##8       | 201/704 [00:51<01:52,  4.46/s]
 29%|##8       | 202/704 [00:52<01:53,  4.44/s]
 29%|##8       | 203/704 [00:52<01:51,  4.48/s]
 29%|##8       | 204/704 [00:52<01:51,  4.48/s]
 29%|##9       | 205/704 [00:52<01:51,  4.48/s]
 29%|##9       | 206/704 [00:52<01:51,  4.48/s]
 29%|##9       | 207/704 [00:53<01:50,  4.49/s]
 30%|##9       | 208/704 [00:53<01:50,  4.50/s]
 30%|##9       | 209/704 [00:53<01:49,  4.51/s]
 30%|##9       | 210/704 [00:53<01:48,  4.53/s]
 30%|##9       | 211/704 [00:54<01:48,  4.55/s]
 30%|###       | 212/704 [00:54<01:48,  4.54/s]
 30%|###       | 213/704 [00:54<01:48,  4.52/s]
 30%|###       | 214/704 [00:54<01:48,  4.52/s]
 31%|###       | 215/704 [00:54<01:49,  4.48/s]
 31%|###       | 216/704 [00:55<01:48,  4.48/s]
 31%|###       | 217/704 [00:55<01:48,  4.47/s]
 31%|###       | 218/704 [00:55<01:48,  4.50/s]
 31%|###1      | 219/704 [00:55<01:48,  4.45/s]
 31%|###1      | 220/704 [00:56<01:48,  4.44/s]
 31%|###1      | 221/704 [00:56<01:48,  4.46/s]
 32%|###1      | 222/704 [00:56<01:46,  4.54/s]
 32%|###1      | 223/704 [00:56<01:46,  4.52/s]
 32%|###1      | 224/704 [00:56<01:45,  4.54/s]
 32%|###1      | 225/704 [00:57<01:45,  4.54/s]
 32%|###2      | 226/704 [00:57<01:45,  4.52/s]
 32%|###2      | 227/704 [00:57<01:45,  4.51/s]
 32%|###2      | 228/704 [00:57<01:45,  4.50/s]
 33%|###2      | 229/704 [00:58<01:43,  4.58/s]
 33%|###2      | 230/704 [00:58<01:43,  4.60/s]
 33%|###2      | 231/704 [00:58<01:41,  4.66/s]
 33%|###2      | 232/704 [00:58<01:42,  4.59/s]
 33%|###3      | 233/704 [00:58<01:42,  4.58/s]
 33%|###3      | 234/704 [00:59<01:43,  4.53/s]
 33%|###3      | 235/704 [00:59<01:43,  4.53/s]
 34%|###3      | 236/704 [00:59<01:43,  4.54/s]
 34%|###3      | 237/704 [00:59<01:43,  4.51/s]
 34%|###3      | 238/704 [01:00<01:43,  4.50/s]
 34%|###3      | 239/704 [01:00<01:42,  4.54/s]
 34%|###4      | 240/704 [01:00<01:43,  4.49/s]
 34%|###4      | 241/704 [01:00<01:43,  4.47/s]
 34%|###4      | 242/704 [01:00<01:43,  4.47/s]
 35%|###4      | 243/704 [01:01<01:42,  4.50/s]
 35%|###4      | 244/704 [01:01<01:40,  4.56/s]
 35%|###4      | 245/704 [01:01<01:39,  4.60/s]
 35%|###4      | 246/704 [01:01<01:39,  4.59/s]
 35%|###5      | 247/704 [01:02<01:39,  4.58/s]
 35%|###5      | 248/704 [01:02<01:40,  4.55/s]
 35%|###5      | 249/704 [01:02<01:39,  4.57/s]
 36%|###5      | 250/704 [01:02<01:38,  4.59/s]
 36%|###5      | 251/704 [01:02<01:39,  4.56/s]
 36%|###5      | 252/704 [01:03<01:39,  4.53/s]
 36%|###5      | 253/704 [01:03<01:38,  4.56/s]
 36%|###6      | 254/704 [01:03<01:38,  4.55/s]
 36%|###6      | 255/704 [01:03<01:39,  4.51/s]
 36%|###6      | 256/704 [01:04<01:39,  4.52/s]
 37%|###6      | 257/704 [01:04<01:38,  4.52/s]
 37%|###6      | 258/704 [01:04<01:38,  4.54/s]
 37%|###6      | 259/704 [01:04<01:38,  4.52/s]
 37%|###6      | 260/704 [01:04<01:38,  4.52/s]
 37%|###7      | 261/704 [01:05<01:39,  4.47/s]
 37%|###7      | 262/704 [01:05<01:38,  4.50/s]
 37%|###7      | 263/704 [01:05<01:38,  4.49/s]
 38%|###7      | 264/704 [01:05<01:38,  4.47/s]
 38%|###7      | 265/704 [01:06<01:39,  4.43/s]
 38%|###7      | 266/704 [01:06<01:39,  4.39/s]
 38%|###7      | 267/704 [01:06<01:40,  4.35/s]
 38%|###8      | 268/704 [01:06<01:39,  4.38/s]
 38%|###8      | 269/704 [01:06<01:40,  4.31/s]
 38%|###8      | 270/704 [01:07<01:41,  4.27/s]
 38%|###8      | 271/704 [01:07<01:40,  4.29/s]
 39%|###8      | 272/704 [01:07<01:40,  4.28/s]
 39%|###8      | 273/704 [01:07<01:39,  4.35/s]
 39%|###8      | 274/704 [01:08<01:38,  4.38/s]
 39%|###9      | 275/704 [01:08<01:36,  4.46/s]
 39%|###9      | 276/704 [01:08<01:36,  4.46/s]
 39%|###9      | 277/704 [01:08<01:34,  4.50/s]
 39%|###9      | 278/704 [01:09<01:34,  4.49/s]
 40%|###9      | 279/704 [01:09<01:34,  4.48/s]
 40%|###9      | 280/704 [01:09<01:34,  4.47/s]
 40%|###9      | 281/704 [01:09<01:35,  4.45/s]
 40%|####      | 282/704 [01:09<01:34,  4.45/s]
 40%|####      | 283/704 [01:10<01:34,  4.46/s]
 40%|####      | 284/704 [01:10<01:34,  4.46/s]
 40%|####      | 285/704 [01:10<01:34,  4.44/s]
 41%|####      | 286/704 [01:10<01:34,  4.42/s]
 41%|####      | 287/704 [01:11<01:35,  4.39/s]
 41%|####      | 288/704 [01:11<01:35,  4.34/s]
 41%|####1     | 289/704 [01:11<01:35,  4.34/s]
 41%|####1     | 290/704 [01:11<01:35,  4.35/s]
 41%|####1     | 291/704 [01:11<01:34,  4.37/s]
 41%|####1     | 292/704 [01:12<01:33,  4.40/s]
 42%|####1     | 293/704 [01:12<01:33,  4.41/s]
 42%|####1     | 294/704 [01:12<01:32,  4.43/s]
 42%|####1     | 295/704 [01:12<01:32,  4.44/s]
 42%|####2     | 296/704 [01:13<01:32,  4.42/s]
 42%|####2     | 297/704 [01:13<01:31,  4.43/s]
 42%|####2     | 298/704 [01:13<01:31,  4.45/s]
 42%|####2     | 299/704 [01:13<01:30,  4.45/s]
 43%|####2     | 300/704 [01:13<01:30,  4.45/s]
 43%|####2     | 301/704 [01:14<01:30,  4.47/s]
 43%|####2     | 302/704 [01:14<01:29,  4.52/s]
 43%|####3     | 303/704 [01:14<01:29,  4.49/s]
 43%|####3     | 304/704 [01:14<01:29,  4.49/s]
 43%|####3     | 305/704 [01:15<01:29,  4.47/s]
 43%|####3     | 306/704 [01:15<01:28,  4.49/s]
 44%|####3     | 307/704 [01:15<01:27,  4.52/s]
 44%|####3     | 308/704 [01:15<01:28,  4.48/s]
 44%|####3     | 309/704 [01:15<01:28,  4.47/s]
 44%|####4     | 310/704 [01:16<01:29,  4.42/s]
 44%|####4     | 311/704 [01:16<01:29,  4.41/s]
 44%|####4     | 312/704 [01:16<01:29,  4.38/s]
 44%|####4     | 313/704 [01:16<01:29,  4.37/s]
 45%|####4     | 314/704 [01:17<01:28,  4.38/s]
 45%|####4     | 315/704 [01:17<01:28,  4.38/s]
 45%|####4     | 316/704 [01:17<01:28,  4.40/s]
 45%|####5     | 317/704 [01:17<01:26,  4.47/s]
 45%|####5     | 318/704 [01:18<01:26,  4.45/s]
 45%|####5     | 319/704 [01:18<01:26,  4.48/s]
 45%|####5     | 320/704 [01:18<01:25,  4.49/s]
 46%|####5     | 321/704 [01:18<01:25,  4.50/s]
 46%|####5     | 322/704 [01:18<01:25,  4.45/s]
 46%|####5     | 323/704 [01:19<01:25,  4.44/s]
 46%|####6     | 324/704 [01:19<01:25,  4.45/s]
 46%|####6     | 325/704 [01:19<01:25,  4.45/s]
 46%|####6     | 326/704 [01:19<01:23,  4.51/s]
 46%|####6     | 327/704 [01:20<01:24,  4.47/s]
 47%|####6     | 328/704 [01:20<01:24,  4.47/s]
 47%|####6     | 329/704 [01:20<01:23,  4.48/s]
 47%|####6     | 330/704 [01:20<01:23,  4.46/s]
 47%|####7     | 331/704 [01:20<01:23,  4.47/s]
 47%|####7     | 332/704 [01:21<01:23,  4.48/s]
 47%|####7     | 333/704 [01:21<01:23,  4.45/s]
 47%|####7     | 334/704 [01:21<01:22,  4.48/s]
 48%|####7     | 335/704 [01:21<01:22,  4.47/s]
 48%|####7     | 336/704 [01:22<01:22,  4.46/s]
 48%|####7     | 337/704 [01:22<01:22,  4.46/s]
 48%|####8     | 338/704 [01:22<01:22,  4.44/s]
 48%|####8     | 339/704 [01:22<01:22,  4.45/s]
 48%|####8     | 340/704 [01:22<01:21,  4.44/s]
 48%|####8     | 341/704 [01:23<01:21,  4.46/s]
 49%|####8     | 342/704 [01:23<01:21,  4.46/s]
 49%|####8     | 343/704 [01:23<01:20,  4.47/s]
 49%|####8     | 344/704 [01:23<01:20,  4.46/s]
 49%|####9     | 345/704 [01:24<01:20,  4.47/s]
 49%|####9     | 346/704 [01:24<01:19,  4.51/s]
 49%|####9     | 347/704 [01:24<01:18,  4.52/s]
 49%|####9     | 348/704 [01:24<01:18,  4.53/s]
 50%|####9     | 349/704 [01:24<01:18,  4.52/s]
 50%|####9     | 350/704 [01:25<01:18,  4.52/s]
 50%|####9     | 351/704 [01:25<01:19,  4.46/s]
 50%|#####     | 352/704 [01:25<01:17,  4.52/s]
 50%|#####     | 353/704 [01:25<01:18,  4.46/s]
 50%|#####     | 354/704 [01:26<01:17,  4.50/s]
 50%|#####     | 355/704 [01:26<01:17,  4.50/s]
 51%|#####     | 356/704 [01:26<01:17,  4.48/s]
 51%|#####     | 357/704 [01:26<01:17,  4.47/s]
 51%|#####     | 358/704 [01:26<01:17,  4.47/s]
 51%|#####     | 359/704 [01:27<01:17,  4.44/s]
 51%|#####1    | 360/704 [01:27<01:18,  4.40/s]
 51%|#####1    | 361/704 [01:27<01:18,  4.37/s]
 51%|#####1    | 362/704 [01:27<01:18,  4.38/s]
 52%|#####1    | 363/704 [01:28<01:18,  4.34/s]
 52%|#####1    | 364/704 [01:28<01:17,  4.38/s]
 52%|#####1    | 365/704 [01:28<01:16,  4.42/s]
 52%|#####1    | 366/704 [01:28<01:16,  4.45/s]
 52%|#####2    | 367/704 [01:29<01:15,  4.46/s]
 52%|#####2    | 368/704 [01:29<01:14,  4.48/s]
 52%|#####2    | 369/704 [01:29<01:15,  4.43/s]
 53%|#####2    | 370/704 [01:29<01:15,  4.41/s]
 53%|#####2    | 371/704 [01:29<01:16,  4.37/s]
 53%|#####2    | 372/704 [01:30<01:16,  4.35/s]
 53%|#####2    | 373/704 [01:30<01:15,  4.36/s]
 53%|#####3    | 374/704 [01:30<01:15,  4.36/s]
 53%|#####3    | 375/704 [01:30<01:14,  4.40/s]
 53%|#####3    | 376/704 [01:31<01:13,  4.44/s]
 54%|#####3    | 377/704 [01:31<01:13,  4.45/s]
 54%|#####3    | 378/704 [01:31<01:13,  4.44/s]
 54%|#####3    | 379/704 [01:31<01:12,  4.47/s]
 54%|#####3    | 380/704 [01:31<01:13,  4.42/s]
 54%|#####4    | 381/704 [01:32<01:12,  4.44/s]
 54%|#####4    | 382/704 [01:32<01:12,  4.42/s]
 54%|#####4    | 383/704 [01:32<01:12,  4.43/s]
 55%|#####4    | 384/704 [01:32<01:11,  4.45/s]
 55%|#####4    | 385/704 [01:33<01:11,  4.44/s]
 55%|#####4    | 386/704 [01:33<01:11,  4.46/s]
 55%|#####4    | 387/704 [01:33<01:10,  4.47/s]
 55%|#####5    | 388/704 [01:33<01:10,  4.50/s]
 55%|#####5    | 389/704 [01:33<01:10,  4.50/s]
 55%|#####5    | 390/704 [01:34<01:09,  4.51/s]
 56%|#####5    | 391/704 [01:34<01:09,  4.51/s]
 56%|#####5    | 392/704 [01:34<01:09,  4.51/s]
 56%|#####5    | 393/704 [01:34<01:08,  4.51/s]
 56%|#####5    | 394/704 [01:35<01:08,  4.52/s]
 56%|#####6    | 395/704 [01:35<01:08,  4.50/s]
 56%|#####6    | 396/704 [01:35<01:08,  4.49/s]
 56%|#####6    | 397/704 [01:35<01:07,  4.52/s]
 57%|#####6    | 398/704 [01:35<01:08,  4.45/s]
 57%|#####6    | 399/704 [01:36<01:08,  4.45/s]
 57%|#####6    | 400/704 [01:36<01:07,  4.49/s]
 57%|#####6    | 401/704 [01:36<01:07,  4.48/s]
 57%|#####7    | 402/704 [01:36<01:07,  4.45/s]
 57%|#####7    | 403/704 [01:37<01:07,  4.45/s]
 57%|#####7    | 404/704 [01:37<01:07,  4.41/s]
 58%|#####7    | 405/704 [01:37<01:07,  4.43/s]
 58%|#####7    | 406/704 [01:37<01:07,  4.41/s]
 58%|#####7    | 407/704 [01:37<01:06,  4.44/s]
 58%|#####7    | 408/704 [01:38<01:06,  4.46/s]
 58%|#####8    | 409/704 [01:38<01:05,  4.47/s]
 58%|#####8    | 410/704 [01:38<01:04,  4.53/s]
 58%|#####8    | 411/704 [01:38<01:04,  4.56/s]
 59%|#####8    | 412/704 [01:39<01:04,  4.54/s]
 59%|#####8    | 413/704 [01:39<01:04,  4.53/s]
 59%|#####8    | 414/704 [01:39<01:03,  4.54/s]
 59%|#####8    | 415/704 [01:39<01:03,  4.53/s]
 59%|#####9    | 416/704 [01:39<01:03,  4.52/s]
 59%|#####9    | 417/704 [01:40<01:03,  4.53/s]
 59%|#####9    | 418/704 [01:40<01:03,  4.48/s]
 60%|#####9    | 419/704 [01:40<01:03,  4.50/s]
 60%|#####9    | 420/704 [01:40<01:02,  4.51/s]
 60%|#####9    | 421/704 [01:41<01:02,  4.53/s]
 60%|#####9    | 422/704 [01:41<01:02,  4.53/s]
 60%|######    | 423/704 [01:41<01:01,  4.57/s]
 60%|######    | 424/704 [01:41<01:01,  4.57/s]
 60%|######    | 425/704 [01:41<01:01,  4.54/s]
 61%|######    | 426/704 [01:42<01:01,  4.52/s]
 61%|######    | 427/704 [01:42<01:01,  4.51/s]
 61%|######    | 428/704 [01:42<01:01,  4.49/s]
 61%|######    | 429/704 [01:42<01:01,  4.49/s]
 61%|######1   | 430/704 [01:43<01:00,  4.50/s]
 61%|######1   | 431/704 [01:43<01:00,  4.49/s]
 61%|######1   | 432/704 [01:43<01:00,  4.47/s]
 62%|######1   | 433/704 [01:43<01:00,  4.49/s]
 62%|######1   | 434/704 [01:43<01:00,  4.47/s]
 62%|######1   | 435/704 [01:44<00:59,  4.52/s]
 62%|######1   | 436/704 [01:44<00:59,  4.51/s]
 62%|######2   | 437/704 [01:44<00:58,  4.56/s]
 62%|######2   | 438/704 [01:44<00:58,  4.56/s]
 62%|######2   | 439/704 [01:45<00:58,  4.57/s]
 62%|######2   | 440/704 [01:45<00:57,  4.59/s]
 63%|######2   | 441/704 [01:45<00:58,  4.53/s]
 63%|######2   | 442/704 [01:45<00:57,  4.53/s]
 63%|######2   | 443/704 [01:45<00:57,  4.51/s]
 63%|######3   | 444/704 [01:46<00:57,  4.56/s]
 63%|######3   | 445/704 [01:46<00:57,  4.54/s]
 63%|######3   | 446/704 [01:46<00:56,  4.57/s]
 63%|######3   | 447/704 [01:46<00:56,  4.54/s]
 64%|######3   | 448/704 [01:47<00:56,  4.55/s]
 64%|######3   | 449/704 [01:47<00:56,  4.55/s]
 64%|######3   | 450/704 [01:47<00:55,  4.54/s]
 64%|######4   | 451/704 [01:47<00:55,  4.57/s]
 64%|######4   | 452/704 [01:47<00:56,  4.50/s]
 64%|######4   | 453/704 [01:48<00:56,  4.47/s]
 64%|######4   | 454/704 [01:48<00:55,  4.47/s]
 65%|######4   | 455/704 [01:48<00:55,  4.48/s]
 65%|######4   | 456/704 [01:48<00:55,  4.44/s]
 65%|######4   | 457/704 [01:49<00:54,  4.51/s]
 65%|######5   | 458/704 [01:49<00:54,  4.50/s]
 65%|######5   | 459/704 [01:49<00:54,  4.48/s]
 65%|######5   | 460/704 [01:49<00:54,  4.51/s]
 65%|######5   | 461/704 [01:49<00:53,  4.52/s]
 66%|######5   | 462/704 [01:50<00:53,  4.52/s]
 66%|######5   | 463/704 [01:50<00:53,  4.55/s]
 66%|######5   | 464/704 [01:50<00:53,  4.51/s]
 66%|######6   | 465/704 [01:50<00:52,  4.51/s]
 66%|######6   | 466/704 [01:51<00:53,  4.46/s]
 66%|######6   | 467/704 [01:51<00:52,  4.48/s]
 66%|######6   | 468/704 [01:51<00:52,  4.53/s]
 67%|######6   | 469/704 [01:51<00:51,  4.53/s]
 67%|######6   | 470/704 [01:51<00:51,  4.52/s]
 67%|######6   | 471/704 [01:52<00:51,  4.51/s]
 67%|######7   | 472/704 [01:52<00:50,  4.55/s]
 67%|######7   | 473/704 [01:52<00:50,  4.56/s]
 67%|######7   | 474/704 [01:52<00:50,  4.59/s]
 67%|######7   | 475/704 [01:53<00:49,  4.58/s]
 68%|######7   | 476/704 [01:53<00:49,  4.60/s]
 68%|######7   | 477/704 [01:53<00:49,  4.59/s]
 68%|######7   | 478/704 [01:53<00:49,  4.59/s]
 68%|######8   | 479/704 [01:53<00:49,  4.54/s]
 68%|######8   | 480/704 [01:54<00:49,  4.53/s]
 68%|######8   | 481/704 [01:54<00:48,  4.55/s]
 68%|######8   | 482/704 [01:54<00:48,  4.56/s]
 69%|######8   | 483/704 [01:54<00:48,  4.57/s]
 69%|######8   | 484/704 [01:55<00:48,  4.55/s]
 69%|######8   | 485/704 [01:55<00:48,  4.51/s]
 69%|######9   | 486/704 [01:55<00:48,  4.51/s]
 69%|######9   | 487/704 [01:55<00:48,  4.51/s]
 69%|######9   | 488/704 [01:55<00:47,  4.51/s]
 69%|######9   | 489/704 [01:56<00:48,  4.46/s]
 70%|######9   | 490/704 [01:56<00:48,  4.45/s]
 70%|######9   | 491/704 [01:56<00:47,  4.49/s]
 70%|######9   | 492/704 [01:56<00:46,  4.61/s]
 70%|#######   | 493/704 [01:56<00:45,  4.63/s]
 70%|#######   | 494/704 [01:57<00:44,  4.71/s]
 70%|#######   | 495/704 [01:57<00:44,  4.69/s]
 70%|#######   | 496/704 [01:57<00:44,  4.63/s]
 71%|#######   | 497/704 [01:57<00:45,  4.59/s]
 71%|#######   | 498/704 [01:58<00:45,  4.56/s]
 71%|#######   | 499/704 [01:58<00:44,  4.57/s]/Users/giovanni.palla/Projects/squidpy_notebooks/.tox/docs/lib/python3.9/site-packages/numpy/core/fromnumeric.py:3474: RuntimeWarning: Mean of empty slice.
  return _methods._mean(a, axis=axis, dtype=dtype,
/Users/giovanni.palla/Projects/squidpy_notebooks/.tox/docs/lib/python3.9/site-packages/numpy/core/_methods.py:189: RuntimeWarning: invalid value encountered in double_scalars
  ret = ret.dtype.type(ret / rcount)
/Users/giovanni.palla/Projects/squidpy_notebooks/.tox/docs/lib/python3.9/site-packages/numpy/core/_methods.py:264: RuntimeWarning: Degrees of freedom <= 0 for slice
  ret = _var(a, axis=axis, dtype=dtype, out=out, ddof=ddof,
/Users/giovanni.palla/Projects/squidpy_notebooks/.tox/docs/lib/python3.9/site-packages/numpy/core/_methods.py:222: RuntimeWarning: invalid value encountered in true_divide
  arrmean = um.true_divide(arrmean, div, out=arrmean, casting='unsafe',
/Users/giovanni.palla/Projects/squidpy_notebooks/.tox/docs/lib/python3.9/site-packages/numpy/core/_methods.py:256: RuntimeWarning: invalid value encountered in double_scalars
  ret = ret.dtype.type(ret / rcount)

 71%|#######1  | 500/704 [01:58<00:44,  4.57/s]
 71%|#######1  | 501/704 [01:58<00:44,  4.56/s]
 71%|#######1  | 502/704 [01:58<00:44,  4.59/s]
 71%|#######1  | 503/704 [01:59<00:43,  4.60/s]
 72%|#######1  | 504/704 [01:59<00:43,  4.59/s]
 72%|#######1  | 505/704 [01:59<00:43,  4.60/s]
 72%|#######1  | 506/704 [01:59<00:42,  4.61/s]
 72%|#######2  | 507/704 [02:00<00:43,  4.57/s]
 72%|#######2  | 508/704 [02:00<00:42,  4.57/s]
 72%|#######2  | 509/704 [02:00<00:42,  4.54/s]
 72%|#######2  | 510/704 [02:00<00:42,  4.53/s]
 73%|#######2  | 511/704 [02:00<00:42,  4.55/s]
 73%|#######2  | 512/704 [02:01<00:42,  4.54/s]
 73%|#######2  | 513/704 [02:01<00:41,  4.55/s]
 73%|#######3  | 514/704 [02:01<00:41,  4.60/s]
 73%|#######3  | 515/704 [02:01<00:41,  4.59/s]
 73%|#######3  | 516/704 [02:02<00:41,  4.58/s]
 73%|#######3  | 517/704 [02:02<00:40,  4.57/s]
 74%|#######3  | 518/704 [02:02<00:40,  4.57/s]
 74%|#######3  | 519/704 [02:02<00:40,  4.56/s]
 74%|#######3  | 520/704 [02:02<00:40,  4.57/s]
 74%|#######4  | 521/704 [02:03<00:40,  4.56/s]
 74%|#######4  | 522/704 [02:03<00:40,  4.55/s]
 74%|#######4  | 523/704 [02:03<00:39,  4.58/s]
 74%|#######4  | 524/704 [02:03<00:39,  4.52/s]
 75%|#######4  | 525/704 [02:04<00:43,  4.15/s]
 75%|#######4  | 526/704 [02:04<00:44,  4.03/s]
 75%|#######4  | 527/704 [02:04<00:44,  4.02/s]
 75%|#######5  | 528/704 [02:04<00:41,  4.21/s]
 75%|#######5  | 529/704 [02:04<00:40,  4.32/s]
 75%|#######5  | 530/704 [02:05<00:43,  4.03/s]
 75%|#######5  | 531/704 [02:05<00:46,  3.73/s]
 76%|#######5  | 532/704 [02:05<00:47,  3.60/s]
 76%|#######5  | 533/704 [02:06<00:47,  3.64/s]
 76%|#######5  | 534/704 [02:06<00:44,  3.82/s]
 76%|#######5  | 535/704 [02:06<00:42,  4.00/s]
 76%|#######6  | 536/704 [02:06<00:40,  4.16/s]
 76%|#######6  | 537/704 [02:07<00:39,  4.27/s]
 76%|#######6  | 538/704 [02:07<00:38,  4.29/s]
 77%|#######6  | 539/704 [02:07<00:37,  4.36/s]
 77%|#######6  | 540/704 [02:07<00:37,  4.33/s]
 77%|#######6  | 541/704 [02:07<00:37,  4.33/s]
 77%|#######6  | 542/704 [02:08<00:36,  4.47/s]
 77%|#######7  | 543/704 [02:08<00:35,  4.52/s]
 77%|#######7  | 544/704 [02:08<00:35,  4.53/s]
 77%|#######7  | 545/704 [02:08<00:35,  4.51/s]
 78%|#######7  | 546/704 [02:09<00:34,  4.56/s]
 78%|#######7  | 547/704 [02:09<00:34,  4.56/s]
 78%|#######7  | 548/704 [02:09<00:34,  4.52/s]
 78%|#######7  | 549/704 [02:09<00:34,  4.52/s]
 78%|#######8  | 550/704 [02:09<00:34,  4.51/s]
 78%|#######8  | 551/704 [02:10<00:35,  4.32/s]
 78%|#######8  | 552/704 [02:10<00:35,  4.28/s]
 79%|#######8  | 553/704 [02:10<00:34,  4.34/s]
 79%|#######8  | 554/704 [02:10<00:33,  4.43/s]
 79%|#######8  | 555/704 [02:11<00:32,  4.52/s]
 79%|#######8  | 556/704 [02:11<00:32,  4.60/s]
 79%|#######9  | 557/704 [02:11<00:31,  4.60/s]
 79%|#######9  | 558/704 [02:11<00:31,  4.64/s]
 79%|#######9  | 559/704 [02:11<00:31,  4.64/s]
 80%|#######9  | 560/704 [02:12<00:31,  4.56/s]
 80%|#######9  | 561/704 [02:12<00:31,  4.60/s]
 80%|#######9  | 562/704 [02:12<00:31,  4.47/s]
 80%|#######9  | 563/704 [02:12<00:31,  4.51/s]
 80%|########  | 564/704 [02:13<00:30,  4.55/s]
 80%|########  | 565/704 [02:13<00:30,  4.53/s]
 80%|########  | 566/704 [02:13<00:31,  4.43/s]
 81%|########  | 567/704 [02:13<00:30,  4.44/s]
 81%|########  | 568/704 [02:13<00:30,  4.44/s]
 81%|########  | 569/704 [02:14<00:29,  4.55/s]
 81%|########  | 570/704 [02:14<00:29,  4.62/s]
 81%|########1 | 571/704 [02:14<00:29,  4.55/s]
 81%|########1 | 572/704 [02:14<00:29,  4.53/s]
 81%|########1 | 573/704 [02:15<00:29,  4.49/s]
 82%|########1 | 574/704 [02:15<00:28,  4.55/s]
 82%|########1 | 575/704 [02:15<00:28,  4.56/s]
 82%|########1 | 576/704 [02:15<00:28,  4.56/s]
 82%|########1 | 577/704 [02:15<00:27,  4.62/s]
 82%|########2 | 578/704 [02:16<00:27,  4.66/s]
 82%|########2 | 579/704 [02:16<00:26,  4.72/s]
 82%|########2 | 580/704 [02:16<00:26,  4.74/s]
 83%|########2 | 581/704 [02:16<00:25,  4.75/s]
 83%|########2 | 582/704 [02:16<00:25,  4.73/s]
 83%|########2 | 583/704 [02:17<00:25,  4.72/s]
 83%|########2 | 584/704 [02:17<00:25,  4.77/s]
 83%|########3 | 585/704 [02:17<00:24,  4.77/s]
 83%|########3 | 586/704 [02:17<00:24,  4.76/s]
 83%|########3 | 587/704 [02:18<00:24,  4.76/s]
 84%|########3 | 588/704 [02:18<00:24,  4.70/s]
 84%|########3 | 589/704 [02:18<00:24,  4.68/s]
 84%|########3 | 590/704 [02:18<00:24,  4.59/s]
 84%|########3 | 591/704 [02:18<00:24,  4.58/s]
 84%|########4 | 592/704 [02:19<00:24,  4.60/s]
 84%|########4 | 593/704 [02:19<00:24,  4.59/s]
 84%|########4 | 594/704 [02:19<00:23,  4.59/s]
 85%|########4 | 595/704 [02:19<00:23,  4.57/s]
 85%|########4 | 596/704 [02:19<00:24,  4.46/s]
 85%|########4 | 597/704 [02:20<00:23,  4.49/s]
 85%|########4 | 598/704 [02:20<00:23,  4.59/s]
 85%|########5 | 599/704 [02:20<00:22,  4.62/s]
 85%|########5 | 600/704 [02:20<00:22,  4.64/s]
 85%|########5 | 601/704 [02:21<00:22,  4.68/s]
 86%|########5 | 602/704 [02:21<00:21,  4.66/s]
 86%|########5 | 603/704 [02:21<00:21,  4.70/s]
 86%|########5 | 604/704 [02:21<00:21,  4.69/s]
 86%|########5 | 605/704 [02:21<00:21,  4.64/s]
 86%|########6 | 606/704 [02:22<00:21,  4.57/s]
 86%|########6 | 607/704 [02:22<00:21,  4.61/s]
 86%|########6 | 608/704 [02:22<00:20,  4.61/s]
 87%|########6 | 609/704 [02:22<00:21,  4.52/s]
 87%|########6 | 610/704 [02:23<00:20,  4.49/s]
 87%|########6 | 611/704 [02:23<00:20,  4.52/s]
 87%|########6 | 612/704 [02:23<00:20,  4.47/s]
 87%|########7 | 613/704 [02:23<00:20,  4.44/s]
 87%|########7 | 614/704 [02:23<00:20,  4.48/s]
 87%|########7 | 615/704 [02:24<00:19,  4.54/s]
 88%|########7 | 616/704 [02:24<00:19,  4.56/s]
 88%|########7 | 617/704 [02:24<00:18,  4.60/s]
 88%|########7 | 618/704 [02:24<00:18,  4.56/s]
 88%|########7 | 619/704 [02:25<00:19,  4.40/s]
 88%|########8 | 620/704 [02:25<00:18,  4.48/s]
 88%|########8 | 621/704 [02:25<00:18,  4.38/s]
 88%|########8 | 622/704 [02:25<00:18,  4.45/s]
 88%|########8 | 623/704 [02:25<00:18,  4.31/s]
 89%|########8 | 624/704 [02:26<00:18,  4.27/s]
 89%|########8 | 625/704 [02:26<00:18,  4.24/s]
 89%|########8 | 626/704 [02:26<00:18,  4.27/s]
 89%|########9 | 627/704 [02:26<00:18,  4.18/s]
 89%|########9 | 628/704 [02:27<00:17,  4.34/s]
 89%|########9 | 629/704 [02:27<00:17,  4.24/s]
 89%|########9 | 630/704 [02:27<00:17,  4.18/s]
 90%|########9 | 631/704 [02:27<00:18,  3.99/s]
 90%|########9 | 632/704 [02:28<00:18,  3.89/s]
 90%|########9 | 633/704 [02:28<00:18,  3.80/s]
 90%|######### | 634/704 [02:28<00:18,  3.86/s]
 90%|######### | 635/704 [02:28<00:16,  4.07/s]
 90%|######### | 636/704 [02:29<00:16,  4.20/s]
 90%|######### | 637/704 [02:29<00:15,  4.32/s]
 91%|######### | 638/704 [02:29<00:15,  4.38/s]
 91%|######### | 639/704 [02:29<00:14,  4.46/s]
 91%|######### | 640/704 [02:30<00:15,  4.26/s]
 91%|#########1| 641/704 [02:30<00:19,  3.29/s]
 91%|#########1| 642/704 [02:30<00:21,  2.82/s]
 91%|#########1| 643/704 [02:31<00:21,  2.90/s]
 91%|#########1| 644/704 [02:31<00:20,  2.92/s]
 92%|#########1| 645/704 [02:31<00:18,  3.17/s]
 92%|#########1| 646/704 [02:32<00:16,  3.43/s]
 92%|#########1| 647/704 [02:32<00:15,  3.68/s]
 92%|#########2| 648/704 [02:32<00:14,  3.90/s]
 92%|#########2| 649/704 [02:32<00:13,  4.07/s]
 92%|#########2| 650/704 [02:33<00:12,  4.20/s]
 92%|#########2| 651/704 [02:33<00:12,  4.30/s]
 93%|#########2| 652/704 [02:33<00:11,  4.34/s]
 93%|#########2| 653/704 [02:33<00:11,  4.44/s]
 93%|#########2| 654/704 [02:33<00:11,  4.47/s]
 93%|#########3| 655/704 [02:34<00:11,  4.44/s]
 93%|#########3| 656/704 [02:34<00:10,  4.37/s]
 93%|#########3| 657/704 [02:34<00:10,  4.36/s]
 93%|#########3| 658/704 [02:34<00:10,  4.32/s]
 94%|#########3| 659/704 [02:35<00:10,  4.14/s]
 94%|#########3| 660/704 [02:35<00:10,  4.15/s]
 94%|#########3| 661/704 [02:35<00:10,  4.18/s]
 94%|#########4| 662/704 [02:35<00:10,  4.15/s]
 94%|#########4| 663/704 [02:36<00:09,  4.21/s]
 94%|#########4| 664/704 [02:36<00:09,  4.29/s]
 94%|#########4| 665/704 [02:36<00:09,  4.09/s]
 95%|#########4| 666/704 [02:36<00:09,  4.01/s]
 95%|#########4| 667/704 [02:37<00:08,  4.15/s]
 95%|#########4| 668/704 [02:37<00:08,  4.30/s]
 95%|#########5| 669/704 [02:37<00:08,  4.30/s]
 95%|#########5| 670/704 [02:37<00:07,  4.45/s]
 95%|#########5| 671/704 [02:37<00:07,  4.55/s]
 95%|#########5| 672/704 [02:38<00:06,  4.67/s]
 96%|#########5| 673/704 [02:38<00:06,  4.69/s]
 96%|#########5| 674/704 [02:38<00:06,  4.71/s]
 96%|#########5| 675/704 [02:38<00:06,  4.73/s]
 96%|#########6| 676/704 [02:38<00:05,  4.68/s]
 96%|#########6| 677/704 [02:39<00:05,  4.75/s]
 96%|#########6| 678/704 [02:39<00:05,  4.74/s]
 96%|#########6| 679/704 [02:39<00:05,  4.74/s]
 97%|#########6| 680/704 [02:39<00:05,  4.80/s]
 97%|#########6| 681/704 [02:39<00:04,  4.78/s]
 97%|#########6| 682/704 [02:40<00:04,  4.75/s]
 97%|#########7| 683/704 [02:40<00:04,  4.67/s]
 97%|#########7| 684/704 [02:40<00:04,  4.74/s]
 97%|#########7| 685/704 [02:40<00:04,  4.70/s]
 97%|#########7| 686/704 [02:41<00:03,  4.70/s]
 98%|#########7| 687/704 [02:41<00:03,  4.73/s]
 98%|#########7| 688/704 [02:41<00:03,  4.72/s]
 98%|#########7| 689/704 [02:41<00:03,  4.71/s]
 98%|#########8| 690/704 [02:41<00:02,  4.74/s]
 98%|#########8| 691/704 [02:42<00:02,  4.73/s]
 98%|#########8| 692/704 [02:42<00:02,  4.73/s]
 98%|#########8| 693/704 [02:42<00:02,  4.73/s]
 99%|#########8| 694/704 [02:42<00:02,  4.70/s]
 99%|#########8| 695/704 [02:42<00:01,  4.73/s]
 99%|#########8| 696/704 [02:43<00:01,  4.72/s]
 99%|#########9| 697/704 [02:43<00:01,  4.75/s]
 99%|#########9| 698/704 [02:43<00:01,  4.78/s]
 99%|#########9| 699/704 [02:43<00:01,  4.78/s]
 99%|#########9| 700/704 [02:43<00:00,  4.75/s]
100%|#########9| 701/704 [02:44<00:00,  4.74/s]
100%|#########9| 702/704 [02:44<00:00,  4.73/s]
100%|#########9| 703/704 [02:44<00:00,  4.72/s]
100%|##########| 704/704 [02:44<00:00,  4.70/s]
100%|##########| 704/704 [02:44<00:00,  4.27/s]

The result is stored in adata.obsm['segmentation_features'].

adata.obsm["segmentation_features"].head()
segmentation_label segmentation_area_mean segmentation_area_std segmentation_ch-1_mean_intensity_mean segmentation_ch-1_mean_intensity_std segmentation_ch-2_mean_intensity_mean segmentation_ch-2_mean_intensity_std
AAACGAGACGGTTGAT-1 17 174.764706 291.276810 5604.069561 3100.506862 8997.290710 177.888882
AAAGGGATGTAGCAAG-1 14 100.785714 80.946348 5034.146353 1625.737796 10376.489346 564.254124
AAATGGCATGTCTTGT-1 16 132.000000 147.241723 11527.768307 12227.308457 7725.282284 947.987907
AAATGGTCAATGTGCC-1 9 243.000000 132.341310 3581.244911 46.124320 9664.505991 1331.259644
AAATTAACGGGTAGCT-1 7 229.142857 203.573383 9038.077440 8707.493743 10922.808071 3631.149215


Use squidpy.pl.extract() to plot the texture features on the tissue image or have a look at our interactive visualization tutorial to learn how to use our interactive napari plugin. Here, we show all calculated segmentation features.

# show all channels (using low-res image contained in adata to save memory)
fig, axes = plt.subplots(1, 3, figsize=(8, 4))
for i, ax in enumerate(axes):
    ax.imshow(adata.uns["spatial"]["V1_Adult_Mouse_Brain_Coronal_Section_2"]["images"]["hires"][:, :, i])
    ax.set_title(f"ch{i}")

# plot segmentation features
sq.pl.spatial_scatter(
    sq.pl.extract(adata, "segmentation_features"),
    color=[
        "segmentation_label",
        "segmentation_area_mean",
        "segmentation_ch-1_mean_intensity_mean",
        "segmentation_ch-2_mean_intensity_mean",
    ],
    img_cmap="gray",
    ncols=2,
)
  • ch0, ch1, ch2
  • segmentation_label, segmentation_area_mean, segmentation_ch-1_mean_intensity_mean, segmentation_ch-2_mean_intensity_mean

segmentation_label shows the number of nuclei per spot and segmentation_area_mean the mean are of nuclei per spot. The remaining two plots show the mean intensity of channels 1 and 2 per spot. As the stains for channels 1 and 2 are specific to Neurons and Glial cells, respectively, these features show us Neuron and Glial cell dense areas.

Total running time of the script: ( 3 minutes 37.796 seconds)

Estimated memory usage: 2339 MB