{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Datasets with 3 or more spatial dimensions\n\nMost scikit-image functions are compatible with 3D datasets, i.e., images with\n3 spatial dimensions (to be distinguished from 2D multichannel images, which\nare also arrays with\nthree axes). :func:`skimage.data.cells3d` returns a 3D fluorescence microscopy\nimage of cells. The returned dataset is a 3D multichannel image with dimensions\nprovided in ``(z, c, y, x)`` order. Channel 0 contains cell membranes, while channel\n1 contains nuclei.\n\nThe example below shows how to explore this dataset. This 3D image can be used\nto test the various functions of scikit-image.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import numpy as np\nimport skimage as ski\nimport plotly\nimport plotly.express as px\n\nimg = ski.data.cells3d()[20:]\n\n# omit some slices that are partially empty\nimg = img[5:26]\n\nupper_limit = 1.5 * np.percentile(img, q=99)\nimg = np.clip(img, 0, upper_limit)\n\nfig = px.imshow(\n    img,\n    facet_col=1,\n    animation_frame=0,\n    binary_string=True,\n    binary_format=\"jpg\",\n)\nfig.layout.annotations[0][\"text\"] = \"Cell membranes\"\nfig.layout.annotations[1][\"text\"] = \"Nuclei\"\nplotly.io.show(fig)"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.12.12"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}