{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Install notebook dependencies\n",
    "import sys\n",
    "!{sys.executable} -m pip install itk-ioscanco tqdm pooch 'itkwidgets[all]>=1.0a21'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pooch\n",
    "\n",
    "from itkwidgets import view\n",
    "\n",
    "import itk"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "file_name = 'C0004255.ISQ'\n",
    "file_url = 'https://data.kitware.com/api/v1/file/591e56178d777f16d01e0d20/download'\n",
    "file_sha256 = 'c2a3750c75826cb077d92093d43976cc0350198b55edecd681265eebabfb438b'\n",
    "file_path = pooch.retrieve(file_url, file_sha256, fname=file_name, progressbar=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "image = itk.imread(file_path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "                <img id=\"screenshot_imjoy_window_f4b14673-e3d2-44b7-85d1-a0ae59284dcd\" src=data:image/png;base64,[encoded data, 1192476 characters]>\n",
       "                <script type=\"text/javascript\">\n",
       "                    var image = document.getElementById(\"screenshot_imjoy_window_f4b14673-e3d2-44b7-85d1-a0ae59284dcd\");\n",
       "                    image.src = \"data:image/png;base64,[encoded data, 1192476 characters]\";\n",
       "                    var viewer = document.getElementById(\"imjoy_window_f4b14673-e3d2-44b7-85d1-a0ae59284dcd\");\n",
       "                    // Hide the static image if the Viewer is visible\n",
       "                    image.style.display = viewer ? \"none\" : \"block\";\n",
       "                </script>\n",
       "            "
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "window.connectPlugin && window.connectPlugin(\"268f936d-91fb-48a4-af3f-e27de70d428f\")"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div id=\"0573edf5-64a2-4ea5-8f24-790d8745ae50\"></div>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "<itkwidgets.viewer.Viewer at 0x7f68422f7f40>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "view(image)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "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.10.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
