{ "cells": [ { "attachments": {}, "cell_type": "markdown", "id": "e378188a-4b7d-4aba-838c-37c3b9594a25", "metadata": {}, "source": [ "# More Image Processing Options: Cellpose and Denoising\n", "\n", "Be sure to have gone through the main ImageProcessing notebook in PalmettoBUG before executing this one! This notebook depends on the directory being set up from there.\n", "\n", "No other notebooks depend on this one -- but outputs from this notebook (like cellpose masks in the /masks/cellpose folder) could be inserted into those other notebooks to replace corresponding default inputs in other notebooks (such as deepcell masks)." ] }, { "cell_type": "code", "execution_count": 1, "id": "4910f6b2-b598-44f4-b0b1-154463b00fd7", "metadata": {}, "outputs": [], "source": [ "import os\n", "from pathlib import Path\n", "import numpy as np\n", "import pandas as pd\n", "import matplotlib.pyplot as plt\n", "import tifffile as tf\n", "\n", "import isosegdenoise as iSD" ] }, { "cell_type": "markdown", "id": "5d72ce1d-4f1e-4c92-bd83-e2dd3c916d92", "metadata": {}, "source": [ "### CHANGE The following directory to match an existing directory on your computer if you are testing this tutorial on your own machine!" ] }, { "cell_type": "code", "execution_count": 2, "id": "f75bee36-8a22-4084-b0a2-e8d70a645c07", "metadata": {}, "outputs": [], "source": [ "my_computer_path = \"C:/Users/Default/Desktop\" " ] }, { "cell_type": "markdown", "id": "71389406-3aec-4ae1-9f42-f6e462d599bd", "metadata": {}, "source": [ "## Load into isosegdenoise:\n", "\n", "NOTE!: This notebook depends on the CORE_mcd_to_analysis notebook to have already been run / the example palmettobug project must already be setup in the project_directory! \n", " The isosegdenoise package cannot setup its own example data project (nor is the example data bundled with it), instead that must be done manually or through palmettobug. " ] }, { "cell_type": "code", "execution_count": 3, "id": "1490219e-e552-44bf-851d-4eeea3dfed8b", "metadata": {}, "outputs": [], "source": [ "## initialize denoise / esgmentation experiment:\n", "project_directory = f\"{my_computer_path}/Example_IMC\"\n", "resolutions = [1.0, 1.0] ## in micrometers. 1 micron is standard IMC resolution\n", "iSD_object = iSD.imc_entrypoint(directory = project_directory, resolutions = resolutions, from_mcds = True)" ] }, { "cell_type": "code", "execution_count": 4, "id": "ded5b388-d624-4143-b828-d1b3511de3ab", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | channel | \n", "name | \n", "keep | \n", "segmentation | \n", "
|---|---|---|---|---|
| 0 | \n", "I127 | \n", "127I | \n", "0 | \n", "NaN | \n", "
| 1 | \n", "Xe131 | \n", "131Xe | \n", "0 | \n", "NaN | \n", "
| 2 | \n", "Ba132 | \n", "132Ba | \n", "0 | \n", "NaN | \n", "
| 3 | \n", "Ba138 | \n", "138Ba | \n", "0 | \n", "NaN | \n", "
| 4 | \n", "Pr141 | \n", "aSMA | \n", "1 | \n", "NaN | \n", "
| 5 | \n", "Nd142 | \n", "p-selectin | \n", "1 | \n", "NaN | \n", "
| 6 | \n", "Nd143 | \n", "Vimentin | \n", "1 | \n", "NaN | \n", "
| 7 | \n", "Nd144 | \n", "CD14 | \n", "1 | \n", "NaN | \n", "
| 8 | \n", "Nd145 | \n", "CD31 | \n", "1 | \n", "NaN | \n", "
| 9 | \n", "Nd146 | \n", "CD16 | \n", "1 | \n", "NaN | \n", "
| 10 | \n", "Nd148 | \n", "Pan-Keratin | \n", "1 | \n", "NaN | \n", "
| 11 | \n", "Sm149 | \n", "CD11b | \n", "1 | \n", "NaN | \n", "
| 12 | \n", "Eu151 | \n", "CD163 | \n", "1 | \n", "NaN | \n", "
| 13 | \n", "Sm152 | \n", "CD45 | \n", "1 | \n", "NaN | \n", "
| 14 | \n", "Eu153 | \n", "CD206 | \n", "1 | \n", "NaN | \n", "
| 15 | \n", "Sm154 | \n", "CCL2 | \n", "1 | \n", "NaN | \n", "
| 16 | \n", "Gd155 | \n", "FoxP3 | \n", "1 | \n", "NaN | \n", "
| 17 | \n", "Gd156 | \n", "CD4 | \n", "1 | \n", "NaN | \n", "
| 18 | \n", "Gd158 | \n", "E-cadherin | \n", "1 | \n", "NaN | \n", "
| 19 | \n", "Tb159 | \n", "CD68 | \n", "1 | \n", "NaN | \n", "
| 20 | \n", "Gd160 | \n", "CD66b | \n", "1 | \n", "NaN | \n", "
| 21 | \n", "Dy161 | \n", "CD20 | \n", "1 | \n", "NaN | \n", "
| 22 | \n", "Dy162 | \n", "CD8 | \n", "1 | \n", "NaN | \n", "
| 23 | \n", "Dy163 | \n", "Vitrionectin | \n", "1 | \n", "NaN | \n", "
| 24 | \n", "Dy164 | \n", "CD32b | \n", "1 | \n", "NaN | \n", "
| 25 | \n", "Er167 | \n", "GranzymeB | \n", "1 | \n", "NaN | \n", "
| 26 | \n", "Er168 | \n", "Ki-67 | \n", "1 | \n", "NaN | \n", "
| 27 | \n", "Tm169 | \n", "Collagen-1 | \n", "1 | \n", "NaN | \n", "
| 28 | \n", "Er170 | \n", "CD3 | \n", "1 | \n", "NaN | \n", "
| 29 | \n", "Yb171 | \n", "HistoneH3 | \n", "1 | \n", "1.0 | \n", "
| 30 | \n", "Yb172 | \n", "Beta-Catenin | \n", "1 | \n", "NaN | \n", "
| 31 | \n", "Yb173 | \n", "CD45RO | \n", "1 | \n", "NaN | \n", "
| 32 | \n", "Yb174 | \n", "HLA-DR | \n", "1 | \n", "NaN | \n", "
| 33 | \n", "BCKG190 | \n", "190BCKG | \n", "0 | \n", "NaN | \n", "
| 34 | \n", "Ir191 | \n", "DNA1 | \n", "1 | \n", "1.0 | \n", "
| 35 | \n", "Ir193 | \n", "DNA2 | \n", "1 | \n", "1.0 | \n", "
| 36 | \n", "Pt195 | \n", "Seg1 | \n", "1 | \n", "2.0 | \n", "
| 37 | \n", "Pt196 | \n", "Seg2 | \n", "1 | \n", "2.0 | \n", "
| 38 | \n", "Pt198 | \n", "Seg3 | \n", "1 | \n", "2.0 | \n", "