{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "652e86bd",
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import matplotlib.patches as patches\n",
    "from pathlib import Path\n",
    "import numpy as np\n",
    "import os\n",
    "import sys\n",
    "import glob\n",
    "import pandas as pd\n",
    "import xml.etree.ElementTree as et\n",
    "import datetime\n",
    "from skimage.io import imread, imsave\n",
    "from imageio import volread as imread\n",
    "\n",
    "import tifffile\n",
    "import pystackreg\n",
    "from pystackreg import StackReg\n",
    "from skimage.filters import threshold_otsu\n",
    "\n",
    "from pystackreg.util import to_uint16   # make sure version 0.2.5 (not anything below)\n",
    "#from ims_to_tiff import convert_to_tif   "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "37c4ccb9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'/mnt/disks/store/102022_D10_Coverslip2_Reimage_Processed'"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "os.getcwd()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "2b4e5308",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['0', '8', '9']"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Define input params, directories\n",
    "allfiles = sorted(glob.glob('tif/*'))\n",
    "allCycles = []\n",
    "for x in allfiles:\n",
    "    if x.startswith('tif/Cycle_'):\n",
    "        allCycles.append(x.split('_')[-1])\n",
    "\n",
    "_allFOVs = sorted(glob.glob('tif/Cycle_0/*'))\n",
    "allFOVs = []\n",
    "for x in _allFOVs:\n",
    "    allFOVs.append(x.split('F')[-1][0:3])\n",
    "    \n",
    "allCycles\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "13798511",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "194\n"
     ]
    }
   ],
   "source": [
    "print(len(allFOVs))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "51648795",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "194\n"
     ]
    }
   ],
   "source": [
    "_allFOVs = sorted(glob.glob('tif/Cycle_8/*'))\n",
    "allFOVs_8 = []\n",
    "for x in _allFOVs:\n",
    "    allFOVs_8.append(x.split('F')[-1][0:3])\n",
    "print(len(allFOVs_8))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "473eab96",
   "metadata": {},
   "outputs": [],
   "source": [
    "_allFOVs = sorted(glob.glob('tif/Cycle_8/*'))\n",
    "allFOVs_8 = []\n",
    "for x in _allFOVs:\n",
    "    allFOVs_8.append(x.split('F')[-1][0:3])\n",
    "print(len(allFOVs_8))"
   ]
  }
 ],
 "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.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
