{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "5ad811af",
   "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": "91ac9b13",
   "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": "5ecce1b5",
   "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": "555a56ab",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "194\n"
     ]
    }
   ],
   "source": [
    "print(len(allFOVs))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "6102f123",
   "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": 8,
   "id": "a0d00064",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "194\n"
     ]
    }
   ],
   "source": [
    "_allFOVs = sorted(glob.glob('tif/Cycle_9/*'))\n",
    "allFOVs_9 = []\n",
    "for x in _allFOVs:\n",
    "    allFOVs_9.append(x.split('F')[-1][0:3])\n",
    "print(len(allFOVs_9))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "cbf7a2a0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['000',\n",
       " '001',\n",
       " '002',\n",
       " '003',\n",
       " '004',\n",
       " '005',\n",
       " '006',\n",
       " '007',\n",
       " '008',\n",
       " '009',\n",
       " '010',\n",
       " '011',\n",
       " '012',\n",
       " '013',\n",
       " '014',\n",
       " '015',\n",
       " '016',\n",
       " '017',\n",
       " '018',\n",
       " '019',\n",
       " '020',\n",
       " '021',\n",
       " '022',\n",
       " '023',\n",
       " '024',\n",
       " '025',\n",
       " '026',\n",
       " '027',\n",
       " '028',\n",
       " '029',\n",
       " '030',\n",
       " '031',\n",
       " '032',\n",
       " '033',\n",
       " '034',\n",
       " '035',\n",
       " '036',\n",
       " '037',\n",
       " '038',\n",
       " '039',\n",
       " '040',\n",
       " '041',\n",
       " '042',\n",
       " '043',\n",
       " '044',\n",
       " '045',\n",
       " '046',\n",
       " '047',\n",
       " '048',\n",
       " '049',\n",
       " '075',\n",
       " '076',\n",
       " '077',\n",
       " '078',\n",
       " '079',\n",
       " '080',\n",
       " '081',\n",
       " '082',\n",
       " '084',\n",
       " '085',\n",
       " '086',\n",
       " '087',\n",
       " '088',\n",
       " '089',\n",
       " '090',\n",
       " '091',\n",
       " '092',\n",
       " '093',\n",
       " '094',\n",
       " '095',\n",
       " '096',\n",
       " '097',\n",
       " '098',\n",
       " '099',\n",
       " '100',\n",
       " '101',\n",
       " '102',\n",
       " '103',\n",
       " '104',\n",
       " '105',\n",
       " '106',\n",
       " '107',\n",
       " '108',\n",
       " '109',\n",
       " '110',\n",
       " '112',\n",
       " '113',\n",
       " '114',\n",
       " '115',\n",
       " '116',\n",
       " '117',\n",
       " '118',\n",
       " '119',\n",
       " '120',\n",
       " '121',\n",
       " '122',\n",
       " '123',\n",
       " '124',\n",
       " '125',\n",
       " '126',\n",
       " '127',\n",
       " '128',\n",
       " '129',\n",
       " '130',\n",
       " '132',\n",
       " '133',\n",
       " '134',\n",
       " '135',\n",
       " '136',\n",
       " '137',\n",
       " '138',\n",
       " '139',\n",
       " '140',\n",
       " '141',\n",
       " '142',\n",
       " '143',\n",
       " '144',\n",
       " '145',\n",
       " '146',\n",
       " '147',\n",
       " '148',\n",
       " '149',\n",
       " '150',\n",
       " '151',\n",
       " '152',\n",
       " '153',\n",
       " '154',\n",
       " '155',\n",
       " '156',\n",
       " '157',\n",
       " '158',\n",
       " '159',\n",
       " '160',\n",
       " '161',\n",
       " '162',\n",
       " '163',\n",
       " '164',\n",
       " '165',\n",
       " '166',\n",
       " '167',\n",
       " '168',\n",
       " '169',\n",
       " '170',\n",
       " '171',\n",
       " '173',\n",
       " '174',\n",
       " '175',\n",
       " '176',\n",
       " '177',\n",
       " '178',\n",
       " '179',\n",
       " '180',\n",
       " '181',\n",
       " '182',\n",
       " '183',\n",
       " '184',\n",
       " '185',\n",
       " '186',\n",
       " '187',\n",
       " '188',\n",
       " '189',\n",
       " '190',\n",
       " '191',\n",
       " '192',\n",
       " '193',\n",
       " '194',\n",
       " '195',\n",
       " '196',\n",
       " '197',\n",
       " '198',\n",
       " '200',\n",
       " '201',\n",
       " '203',\n",
       " '204',\n",
       " '205',\n",
       " '206',\n",
       " '207',\n",
       " '208',\n",
       " '209',\n",
       " '210',\n",
       " '211',\n",
       " '212',\n",
       " '213',\n",
       " '214',\n",
       " '215',\n",
       " '216',\n",
       " '217',\n",
       " '218',\n",
       " '219',\n",
       " '220',\n",
       " '221',\n",
       " '222',\n",
       " '223',\n",
       " '224']"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "allFOVs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "07b3fb51",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "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
}
