Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execution from folder #6

Merged
merged 7 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 3 additions & 55 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,58 +82,6 @@ venv/

# written by setuptools_scm
**/_version.py
demo/crops/2021-5-7_wt_72hpf_lysosensor_1.czi
demo/crops/2022-8-19 et358 pnp4a gRNA 72hpf 1.czi
demo/crops/Crop vs. CZI file.ipynb
demo/delete/3. Merge individual images to stack.ipynb
demo/imgs/1. mutant images/img2_20220520_mutant_56hpf_2.tif
demo/imgs/1. mutant images/img3_l3_20220520_mutant_56hpf_3.tif
demo/imgs/1. mutant images/img3_l5_20220520_mutant_56hpf_3.tif
demo/imgs/1. mutant images/img4_l2_20220520_mutant_56hpf_4.tif
demo/imgs/1. mutant images/img4_l4_20220520_mutant_56hpf_4.tif
demo/imgs/1. mutant images/img5_l1_20220520_mutant_56hpf_5.tif
demo/imgs/2. normalized images/img2_20220520_mutant_56hpf_2.tif
demo/imgs/2. normalized images/img3_l3_20220520_mutant_56hpf_3.tif
demo/imgs/2. normalized images/img3_l5_20220520_mutant_56hpf_3.tif
demo/imgs/2. normalized images/img4_l2_20220520_mutant_56hpf_4.tif
demo/imgs/2. normalized images/img4_l4_20220520_mutant_56hpf_4.tif
demo/imgs/2. normalized images/img5_l1_20220520_mutant_56hpf_5.tif
demo/imgs/3. segmentation labels/img2_20220520_mutant_56hpf_2.tif
demo/imgs/3. segmentation labels/img3_l3_20220520_mutant_56hpf_3.tif
demo/imgs/3. segmentation labels/img3_l5_20220520_mutant_56hpf_3.tif
demo/imgs/3. segmentation labels/img4_l2_20220520_mutant_56hpf_4.tif
demo/imgs/3. segmentation labels/img4_l4_20220520_mutant_56hpf_4.tif
demo/imgs/3. segmentation labels/img5_l1_20220520_mutant_56hpf_5.tif
demo/imgs/4. dataframes of segmentation labels/img2_20220520_mutant_56hpf_2.tif.csv
demo/imgs/4. dataframes of segmentation labels/img3_l3_20220520_mutant_56hpf_3.tif.csv
demo/imgs/4. dataframes of segmentation labels/img3_l5_20220520_mutant_56hpf_3.tif.csv
demo/imgs/4. dataframes of segmentation labels/img4_l2_20220520_mutant_56hpf_4.tif.csv
demo/imgs/4. dataframes of segmentation labels/img4_l4_20220520_mutant_56hpf_4.tif.csv
demo/imgs/4. dataframes of segmentation labels/img5_l1_20220520_mutant_56hpf_5.tif.csv
demo/imgs/5. classification labels/img2_20220520_mutant_56hpf_2.tif
demo/imgs/5. classification labels/img3_l3_20220520_mutant_56hpf_3.tif
demo/imgs/5. classification labels/img3_l5_20220520_mutant_56hpf_3.tif
demo/imgs/5. classification labels/img4_l2_20220520_mutant_56hpf_4.tif
demo/imgs/5. classification labels/img4_l4_20220520_mutant_56hpf_4.tif
demo/imgs/5. classification labels/img5_l1_20220520_mutant_56hpf_5.tif
demo/imgs/6. bad-label-excluded labels/img2_20220520_mutant_56hpf_2.tif
demo/imgs/6. bad-label-excluded labels/img3_l3_20220520_mutant_56hpf_3.tif
demo/imgs/6. bad-label-excluded labels/img3_l5_20220520_mutant_56hpf_3.tif
demo/imgs/6. bad-label-excluded labels/img4_l2_20220520_mutant_56hpf_4.tif
demo/imgs/6. bad-label-excluded labels/img4_l4_20220520_mutant_56hpf_4.tif
demo/imgs/6. bad-label-excluded labels/img5_l1_20220520_mutant_56hpf_5.tif
demo/imgs/7. dataframes of DL/img2_20220520_mutant_56hpf_2.tif.csv
demo/imgs/7. dataframes of DL/img3_l3_20220520_mutant_56hpf_3.tif.csv
demo/imgs/7. dataframes of DL/img3_l5_20220520_mutant_56hpf_3.tif.csv
demo/imgs/7. dataframes of DL/img4_l2_20220520_mutant_56hpf_4.tif.csv
demo/imgs/7. dataframes of DL/img4_l4_20220520_mutant_56hpf_4.tif.csv
demo/imgs/7. dataframes of DL/img5_l1_20220520_mutant_56hpf_5.tif.csv
demo/imgs/7. dataframes of PL/img2_20220520_mutant_56hpf_2.tif.csv
demo/imgs/7. dataframes of PL/img3_l3_20220520_mutant_56hpf_3.tif.csv
demo/imgs/7. dataframes of PL/img3_l5_20220520_mutant_56hpf_3.tif.csv
demo/imgs/7. dataframes of PL/img4_l2_20220520_mutant_56hpf_4.tif.csv
demo/imgs/7. dataframes of PL/img4_l4_20220520_mutant_56hpf_4.tif.csv
demo/imgs/7. dataframes of PL/img5_l1_20220520_mutant_56hpf_5.tif.csv
demo/imgs/df_PL.csv
img/img06_20220513_ET358_56hpf_2.tif
img/img06_20220513_ET358_56hpf_2.tif
*.tif
*.csv
*.czi
178 changes: 178 additions & 0 deletions demo/1. Working with czi-files.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "bd8803c6-ba71-44c0-a009-20e0dd6627ef",
"metadata": {},
"source": [
"# 1. Working with czi-files"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "102fccdb-71e4-40ec-a8bd-d505cf0826b5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<Intel(R) UHD Graphics 620 on Platform: Intel(R) OpenCL HD Graphics (1 refs)>"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import os\n",
"import pyclesperanto_prototype as cle\n",
"import napari\n",
"from aicsimageio import AICSImage\n",
"from aicsimageio.readers import BioformatsReader\n",
"\n",
"cle.select_device(\"Intel(R) Iris(TM) Plus Graphics 640\")"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "cafd56ae-6051-48f6-8de6-dcc59fd45071",
"metadata": {},
"outputs": [],
"source": [
"image_folder = 'crops/'\n",
"tif_folder = 'crops/tif-files/'"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "de607dcb-a0a8-4d53-8f85-ab61d7944558",
"metadata": {},
"outputs": [],
"source": [
"os.makedirs(tif_folder, exist_ok=True)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "8962be97-6f36-49ae-bb10-9ec3f5718bee",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['.ipynb_checkpoints',\n",
" '2021-5-7_wt_72hpf_lysosensor_1.czi',\n",
" '2022-8-19 et358 pnp4a gRNA 72hpf 1.czi',\n",
" 'Crop vs. CZI file.ipynb',\n",
" 'tif-files']"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"file_list = os.listdir(image_folder)\n",
"file_list"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "6885ae59-9bbe-486b-828f-d2fe192ea8e2",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING: QWindowsWindow::setGeometry: Unable to set geometry 1090x686+7+31 (frame: 1108x733-2-7) on QWidgetWindow/\"_QtMainWindowClassWindow\" on \"\\\\.\\DISPLAY1\". Resulting geometry: 1365x859+8+38 (frame: 1383x906-1+0) margins: 9, 38, 9, 9 minimum size: 612x589 MINMAXINFO maxSize=0,0 maxpos=0,0 mintrack=630,636 maxtrack=0,0)\n"
]
}
],
"source": [
"viewer = napari.Viewer()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "bbf5cbe3-8f26-4253-83dc-73f7f7f3db6c",
"metadata": {},
"outputs": [],
"source": [
"def data_selection(filename, image_folder, viewer, channel):\n",
" '''\n",
" this function loads one channel of an image slice by slice in napari\n",
" '''\n",
" \n",
" from aicsimageio import AICSImage\n",
" from aicsimageio.readers import BioformatsReader\n",
" \n",
" #load image\n",
" image = AICSImage(image_folder + filename, reader = BioformatsReader)\n",
" original = image.data\n",
" \n",
" #select reflection channel\n",
" channel_specified = original[0, channel]\n",
" \n",
" #add every slice of the stack to napari\n",
" for slc in range(channel_specified.shape[0]):\n",
" layer = viewer.add_image(channel_specified[slc], colormap = 'cyan', blending = 'translucent')"
]
},
{
"cell_type": "markdown",
"id": "d3b2dd75-2ac4-42ac-b5da-dbe012aac151",
"metadata": {},
"source": [
"Now you can say which image inside the `file_list` you want to display in napari. When you just say `filename = file_list`, you will open all images slice by slice."
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "4bfb64ab-e5b7-4e03-bf78-07d463811f39",
"metadata": {},
"outputs": [],
"source": [
"data_selection(filename=file_list[2], image_folder=image_folder, viewer=viewer, channel = 2)"
]
},
{
"cell_type": "markdown",
"id": "ad37d69b-4b9e-4f40-8840-449ee4b56662",
"metadata": {},
"source": [
"You can save the slices of the stack you want to keep under File -> Save Selected Layer(s) (Shortcut: `Ctrl + S`) and direct into the tif_folder"
]
}
],
"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.9.15"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
1,263 changes: 1,263 additions & 0 deletions demo/2. Executing guanine-crystal-analysis-plugin from a jupyter notebook.ipynb

Large diffs are not rendered by default.

Loading