From 77a4c8b743c70e93f05ac34881722da85462d544 Mon Sep 17 00:00:00 2001 From: Noah Wiggin <77313083+wigginno@users.noreply.github.com> Date: Tue, 23 Jan 2024 02:14:03 -0500 Subject: [PATCH] Fixed demo notebook issue --- notebooks/analysis_demo.ipynb | 254 +++++++++++++++++++++++++++++----- 1 file changed, 221 insertions(+), 33 deletions(-) diff --git a/notebooks/analysis_demo.ipynb b/notebooks/analysis_demo.ipynb index e0621ca..09ae916 100644 --- a/notebooks/analysis_demo.ipynb +++ b/notebooks/analysis_demo.ipynb @@ -5,7 +5,7 @@ "colab": { "provenance": [], "gpuType": "T4", - "authorship_tag": "ABX9TyPhw9acEERgyatEKtHw/oPd", + "authorship_tag": "ABX9TyP7pfKlj0dZQpWJsPU3t28W", "include_colab_link": true }, "kernelspec": { @@ -71,8 +71,7 @@ { "cell_type": "markdown", "source": [ - "### 1. Install conda in the Colab runtime\n", - "**This will restart the runtime.**" + "### 1. Install any missing packages in the runtime" ], "metadata": { "id": "cD0CyLGH-9Ne" @@ -80,41 +79,99 @@ }, { "cell_type": "code", - "execution_count": null, + "source": [ + "!pip install albumentations\n", + "!pip install boost\n", + "!pip install dask\n", + "!pip install gudhi\n", + "!pip install jupyterlab\n", + "!pip install matplotlib\n", + "!pip install networkx\n", + "!pip install opencv\n", + "!pip install scikit-learn\n", + "!pip install scipy\n", + "!pip install setuptools\n", + "!pip install tensorflow\n", + "!pip install keras-tuner\n", + "!pip install pillow\n", + "!pip install scikit-image\n", + "!pip install tqdm" + ], "metadata": { - "id": "-s-QsJt02bpR" + "id": "vvBMB1iZJuIL" }, - "outputs": [], - "source": [ - "!pip install -q condacolab\n", - "import condacolab\n", - "condacolab.install()" - ] + "execution_count": null, + "outputs": [] }, { - "cell_type": "markdown", + "cell_type": "code", "source": [ - "### 2. Install packages\n", - "**The installation will take around 5-10 minutes.**" + "# Install the tissue-model-analysis-tools (tmat) package\n", + "!pip install -I fl_tissue_model_tools@git+https://github.com/fogg-lab/tissue-model-analysis-tools.git#subdirectory=src" ], "metadata": { - "id": "MBvDCV54_AzE" - } + "id": "jG4YnUGmJwps", + "outputId": "858f7ca0-4ec5-4e0f-986d-9acf10896c67", + "colab": { + "base_uri": "https://localhost:8080/" + } + }, + "execution_count": 2, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Collecting fl_tissue_model_tools@ git+https://github.com/fogg-lab/tissue-model-analysis-tools.git#subdirectory=src\n", + " Cloning https://github.com/fogg-lab/tissue-model-analysis-tools.git to /tmp/pip-install-mf35c0he/fl-tissue-model-tools_2b3e13215a074013b66a5e64b9b8ae02\n", + " Running command git clone --filter=blob:none --quiet https://github.com/fogg-lab/tissue-model-analysis-tools.git /tmp/pip-install-mf35c0he/fl-tissue-model-tools_2b3e13215a074013b66a5e64b9b8ae02\n", + " Resolved https://github.com/fogg-lab/tissue-model-analysis-tools.git to commit 308cf43fc81a0d7767b587feb6b903402a7e3640\n", + " Running command git submodule update --init --recursive -q\n", + " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + "Building wheels for collected packages: fl_tissue_model_tools\n", + " Building wheel for fl_tissue_model_tools (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + " Created wheel for fl_tissue_model_tools: filename=fl_tissue_model_tools-0.1.0-cp310-cp310-linux_x86_64.whl size=190205337 sha256=70c27a72bc100eea05e90a50e0c16ed6168520faa8aeecbecd079fdf3e0e2aae\n", + " Stored in directory: /tmp/pip-ephem-wheel-cache-ejf88dlh/wheels/ac/da/2d/3382db7c1adb1ecc35fd756818bd79cd34c0cd62d2956ad5e6\n", + "Successfully built fl_tissue_model_tools\n", + "Installing collected packages: fl_tissue_model_tools\n", + "Successfully installed fl_tissue_model_tools-0.1.0\n", + "\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n", + "\u001b[0m" + ] + } + ] }, { "cell_type": "code", "source": [ - "!mamba env update -f https://github.com/fogg-lab/tissue-model-analysis-tools/raw/main/conda_environments/environment_colab.yml\n", + "# Configure package home directory\n", "!tmat configure /content/fl_tissue_model_tools\n", "\n", "# also remove colab's \"sample_data\" folder (it is distracting)\n", "!rm -rf /content/sample_data 2> /dev/null || true" ], "metadata": { - "id": "4I8MNLTK-4eg" + "id": "4I8MNLTK-4eg", + "outputId": "30c806a5-a370-4346-e601-1193f5e52958", + "colab": { + "base_uri": "https://localhost:8080/" + } }, - "execution_count": null, - "outputs": [] + "execution_count": 3, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Creating base directory: /content/fl_tissue_model_tools\n", + "Creating config directory...\n", + "Creating scripts directory...\n", + "Creating model_training directory...\n", + "\n", + "The base directory for fl_tissue_model_tools is now: /content/fl_tissue_model_tools\n" + ] + } + ] }, { "cell_type": "markdown", @@ -132,10 +189,29 @@ "!git clone https://github.com/fogg-lab/tissue-model-analysis-tools-data.git" ], "metadata": { - "id": "cQu83Z3X59za" + "id": "cQu83Z3X59za", + "outputId": "07435430-81d1-4f88-c5de-60d98e102c43", + "colab": { + "base_uri": "https://localhost:8080/" + } }, - "execution_count": null, - "outputs": [] + "execution_count": 4, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Cloning into 'tissue-model-analysis-tools-data'...\n", + "remote: Enumerating objects: 259, done.\u001b[K\n", + "remote: Counting objects: 33% (1/3)\u001b[K\rremote: Counting objects: 66% (2/3)\u001b[K\rremote: Counting objects: 100% (3/3)\u001b[K\rremote: Counting objects: 100% (3/3), done.\u001b[K\n", + "remote: Compressing objects: 100% (3/3), done.\u001b[K\n", + "remote: Total 259 (delta 0), reused 0 (delta 0), pack-reused 256\u001b[K\n", + "Receiving objects: 100% (259/259), 1.28 GiB | 30.67 MiB/s, done.\n", + "Resolving deltas: 100% (21/21), done.\n", + "Updating files: 100% (250/250), done.\n" + ] + } + ] }, { "cell_type": "markdown", @@ -152,10 +228,42 @@ "!tmat -h" ], "metadata": { - "id": "IpN1Ekg_QatE" + "id": "IpN1Ekg_QatE", + "outputId": "d1a8b408-7cce-4aa5-a2d6-1b01209df4b3", + "colab": { + "base_uri": "https://localhost:8080/" + } }, - "execution_count": null, - "outputs": [] + "execution_count": 5, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Usage: tissue-model-analysis-tools [SUBCOMMAND] [OPTIONS]\n", + "Shorthand: tmat [SUBCOMMAND] [OPTIONS]\n", + "\n", + "If no subcommand is given, the interactive mode will be used. For example, run: tmat\n", + "\n", + "Available subcommands:\n", + " configure: Set the location of the base directory for scripts and model training data.\n", + " update: Update the package from GitHub.\n", + " [SCRIPT_NAME]: Run a script from the scripts directory. Do not include the .py extension.\n", + "\n", + "Get available options:\n", + " -h, --help: Show this help message and exit.\n", + " [SUBCOMMAND] -h: Show help (including available options) for a particular subcommand.\n", + "\n", + "Examples:\n", + " tmat configure -h\n", + " tmat configure \"C:\\Users\\Quinn\\Desktop\\some_folder_name\"\n", + " tmat update\n", + " tmat compute_inv_depth -h\n", + " tmat compute_zproj -v \"C:\\Users\\Quinn\\input_folder_name\" \"C:\\Users\\Quinn\\out_folder_name\"\n", + "\n" + ] + } + ] }, { "cell_type": "markdown", @@ -177,10 +285,54 @@ "!tmat compute_zproj --verbose /content/tissue-model-analysis-tools-data/zprojection_input /content/zproj_demo_out" ], "metadata": { - "id": "ARSZRDOFRm87" + "id": "ARSZRDOFRm87", + "outputId": "5c3e47c3-4abf-4f8b-e6ce-af46a2991a21", + "colab": { + "base_uri": "https://localhost:8080/" + } }, - "execution_count": null, - "outputs": [] + "execution_count": 6, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Executing: /usr/local/bin/python3.10 /content/fl_tissue_model_tools/scripts/compute_zproj.py --verbose /content/tissue-model-analysis-tools-data/zprojection_input /content/zproj_demo_out\n", + "2024-01-23 07:12:51.205908: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\n", + "2024-01-23 07:12:51.206040: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\n", + "2024-01-23 07:12:51.359342: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\n", + "['--verbose', '/content/tissue-model-analysis-tools-data/zprojection_input', '/content/zproj_demo_out']\n", + "\n", + "\u001b[36m[Verifying Input Directory]=========================================================================\u001b[0m\n", + "Z Stack ID No. Z Positions\n", + "A1_02_1_GFP_001...........................................19\n", + "A2_02_1_GFP_001...........................................19\n", + "\u001b[32m[SUCCESS]\u001b[0m\n", + "\u001b[36m====================================================================================================\u001b[0m\n", + "\n", + "\n", + "\u001b[36m[Verifying Output Directory]========================================================================\u001b[0m\n", + "Did not find output dir:\n", + "\t/content/zproj_demo_out\n", + "Creating...\n", + "... Created dir:\n", + "\t/content/zproj_demo_out\n", + "\u001b[32m[SUCCESS]\u001b[0m\n", + "\u001b[36m====================================================================================================\u001b[0m\n", + "\n", + "\n", + "\u001b[36m[Constructing Z projections]========================================================================\u001b[0m\n", + "Loading and computing Z stacks...\n", + "... Projections computed.\n", + "\n", + "Saving projections...\n", + "... Projections saved.\n", + "\u001b[32m[SUCCESS]\u001b[0m\n", + "\u001b[36m====================================================================================================\u001b[0m\n", + "\n" + ] + } + ] }, { "cell_type": "markdown", @@ -211,17 +363,44 @@ " plt.subplot(1, len(zprojections), index)\n", " plt.imshow(zprojection, cmap='gray')\n", " plt.axis('off')\n", - " \n", + "\n", " image_name = os.path.splitext(os.path.basename(zp_path))[0]\n", " plt.title(image_name)\n", "\n", "plt.show()" ], "metadata": { - "id": "JpWACLOqKg1P" + "id": "JpWACLOqKg1P", + "outputId": "7f967108-26dd-4f44-83ed-ce3c4330dab5", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 390 + } }, - "execution_count": null, - "outputs": [] + "execution_count": 7, + "outputs": [ + { + "output_type": "error", + "ename": "ValueError", + "evalue": " requires the 'imagecodecs' package", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0mzprojection_paths\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mglob\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'/content/zproj_demo_out/*.tif'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0mzprojections\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mio\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimread\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mzp\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mzp\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mzprojection_paths\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0mplt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfigure\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfigsize\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m16\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m16\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0mzprojection_paths\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mglob\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'/content/zproj_demo_out/*.tif'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0mzprojections\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mio\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimread\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mzp\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mzp\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mzprojection_paths\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0mplt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfigure\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfigsize\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m16\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m16\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/usr/local/lib/python3.10/site-packages/skimage/io/_io.py\u001b[0m in \u001b[0;36mimread\u001b[0;34m(fname, as_gray, plugin, **plugin_args)\u001b[0m\n\u001b[1;32m 51\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 52\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0mfile_or_url_context\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfname\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mfname\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 53\u001b[0;31m \u001b[0mimg\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcall_plugin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'imread'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfname\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mplugin\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mplugin\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mplugin_args\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 54\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 55\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mhasattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mimg\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'ndim'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/usr/local/lib/python3.10/site-packages/skimage/io/manage_plugins.py\u001b[0m in \u001b[0;36mcall_plugin\u001b[0;34m(kind, *args, **kwargs)\u001b[0m\n\u001b[1;32m 203\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mRuntimeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf'Could not find the plugin \"{plugin}\" for {kind}.'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 205\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 206\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 207\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/usr/local/lib/python3.10/site-packages/skimage/io/_plugins/tifffile_plugin.py\u001b[0m in \u001b[0;36mimread\u001b[0;34m(fname, **kwargs)\u001b[0m\n\u001b[1;32m 72\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'key'\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'img_num'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 73\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 74\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mtifffile_imread\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfname\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m/usr/local/lib/python3.10/site-packages/tifffile/tifffile.py\u001b[0m in \u001b[0;36mimread\u001b[0;34m(files, selection, aszarr, key, series, level, squeeze, maxworkers, buffersize, mode, name, offset, size, pattern, axesorder, categories, imread, sort, container, chunkshape, dtype, axestiled, ioworkers, chunkmode, fillvalue, zattrs, multiscales, omexml, out, out_inplace, _multifile, _useframes, **kwargs)\u001b[0m\n\u001b[1;32m 1104\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mstore\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1105\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mzarr_selection\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstore\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mselection\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1106\u001b[0;31m return tif.asarray(\n\u001b[0m\u001b[1;32m 1107\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1108\u001b[0m \u001b[0mseries\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mseries\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/usr/local/lib/python3.10/site-packages/tifffile/tifffile.py\u001b[0m in \u001b[0;36masarray\u001b[0;34m(self, key, series, level, squeeze, out, maxworkers, buffersize)\u001b[0m\n\u001b[1;32m 4344\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mpage0\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4345\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'page is None'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 4346\u001b[0;31m result = page0.asarray(\n\u001b[0m\u001b[1;32m 4347\u001b[0m \u001b[0mout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mout\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmaxworkers\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmaxworkers\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbuffersize\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mbuffersize\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4348\u001b[0m )\n", + "\u001b[0;32m/usr/local/lib/python3.10/site-packages/tifffile/tifffile.py\u001b[0m in \u001b[0;36masarray\u001b[0;34m(self, out, squeeze, lock, maxworkers, buffersize)\u001b[0m\n\u001b[1;32m 9139\u001b[0m \u001b[0;31m# pass # corrupted file, for example, with too many strips\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9140\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 9141\u001b[0;31m for _ in self.segments(\n\u001b[0m\u001b[1;32m 9142\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9143\u001b[0m \u001b[0mlock\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlock\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/usr/local/lib/python3.10/site-packages/tifffile/tifffile.py\u001b[0m in \u001b[0;36msegments\u001b[0;34m(self, lock, maxworkers, func, sort, buffersize, _fullsize)\u001b[0m\n\u001b[1;32m 8935\u001b[0m \u001b[0mflat\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8936\u001b[0m ):\n\u001b[0;32m-> 8937\u001b[0;31m \u001b[0;32myield\u001b[0m \u001b[0mdecode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msegment\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8938\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8939\u001b[0m \u001b[0;31m# reduce memory overhead by processing chunks of up to\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/usr/local/lib/python3.10/site-packages/tifffile/tifffile.py\u001b[0m in \u001b[0;36mdecode\u001b[0;34m(args, decodeargs, decode)\u001b[0m\n\u001b[1;32m 8922\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8923\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mdecode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdecodeargs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdecodeargs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdecode\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mkeyframe\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdecode\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 8924\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdecode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mdecodeargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# type: ignore\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8925\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8926\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mmaxworkers\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mmaxworkers\u001b[0m \u001b[0;34m<\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/usr/local/lib/python3.10/site-packages/tifffile/tifffile.py\u001b[0m in \u001b[0;36mdecode_raise_compression\u001b[0;34m(exc, *args, **kwargs)\u001b[0m\n\u001b[1;32m 8346\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8347\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mdecode_raise_compression\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexc\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mstr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mexc\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 8348\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf'{exc}'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8349\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8350\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mcache\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdecode_raise_compression\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mValueError\u001b[0m: requires the 'imagecodecs' package" + ] + } + ] }, { "cell_type": "markdown", @@ -457,6 +636,15 @@ }, "execution_count": null, "outputs": [] + }, + { + "cell_type": "code", + "source": [], + "metadata": { + "id": "QX76NdaFKWRn" + }, + "execution_count": null, + "outputs": [] } ] } \ No newline at end of file