具有 3 個或更多空間維度的資料集#

大多數 scikit-image 函式都與 3D 資料集相容,即具有 3 個空間維度的影像(與 2D 多通道影像區分,後者也是具有三個軸的陣列)。skimage.data.cells3d() 傳回細胞的 3D 螢光顯微鏡影像。傳回的資料集是 3D 多通道影像,其維度依 (z, c, y, x) 順序提供。通道 0 包含細胞膜,而通道 1 包含細胞核。

下面的範例示範如何探索此資料集。此 3D 影像可用於測試 scikit-image 的各種函式。

Downloading file 'data/cells3d.tif' from 'https://gitlab.com/scikit-image/data/-/raw/2cdc5ce89b334d28f06a58c9f0ca21aa6992a5ba/cells3d.tif' to '/home/runner/.cache/scikit-image/0.25.0'.

from skimage import data
import plotly
import plotly.express as px
import numpy as np

img = data.cells3d()[20:]

# omit some slices that are partially empty
img = img[5:26]

upper_limit = 1.5 * np.percentile(img, q=99)
img = np.clip(img, 0, upper_limit)

fig = px.imshow(
    img,
    facet_col=1,
    animation_frame=0,
    binary_string=True,
    binary_format="jpg",
)
fig.layout.annotations[0]["text"] = "Cell membranes"
fig.layout.annotations[1]["text"] = "Nuclei"
plotly.io.show(fig)

腳本的總執行時間:(0 分鐘 3.531 秒)

由 Sphinx-Gallery 產生