Skip to content

Commit

Permalink
Merge pull request #32 from jluethi/fractal-roi-tables
Browse files Browse the repository at this point in the history
  • Loading branch information
imagejan authored Sep 14, 2023
2 parents d106436 + 723208d commit 6a1cd2b
Show file tree
Hide file tree
Showing 7 changed files with 564 additions and 144 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"outputs": [],
"source": [
"from faim_hcs.io.MolecularDevicesImageXpress import parse_single_plane_multi_fields\n",
"from faim_hcs.Zarr import build_zarr_scaffold, write_cyx_image_to_well, PlateLayout\n",
"from faim_hcs.Zarr import build_zarr_scaffold, write_cyx_image_to_well, PlateLayout, write_roi_table\n",
"from faim_hcs.MetaSeriesUtils import get_well_image_CYX, montage_grid_image_YX\n",
"from faim_hcs.UIntHistogram import UIntHistogram\n",
"import shutil\n",
Expand Down Expand Up @@ -131,8 +131,8 @@
" <td>Projection-Mix</td>\n",
" <td>E08</td>\n",
" <td>s2</td>\n",
" <td>w2</td>\n",
" <td>66923EBB-9960-4952-8955-D1721D112EE2</td>\n",
" <td>w1</td>\n",
" <td>B38C01F5-0D36-4A29-9F5A-BE62B6F7F73F</td>\n",
" <td>.tif</td>\n",
" <td>../resources/Projection-Mix/2023-02-21/1334/Pr...</td>\n",
" </tr>\n",
Expand All @@ -141,10 +141,10 @@
" <td>2023-02-21</td>\n",
" <td>1334</td>\n",
" <td>Projection-Mix</td>\n",
" <td>E07</td>\n",
" <td>s2</td>\n",
" <td>w1</td>\n",
" <td>DCFD1526-D063-4F8B-9E51-F1BD2EBD9F1A</td>\n",
" <td>E08</td>\n",
" <td>s1</td>\n",
" <td>w2</td>\n",
" <td>81928711-999D-41F6-B88C-999513D4C092</td>\n",
" <td>.tif</td>\n",
" <td>../resources/Projection-Mix/2023-02-21/1334/Pr...</td>\n",
" </tr>\n",
Expand All @@ -153,10 +153,10 @@
" <td>2023-02-21</td>\n",
" <td>1334</td>\n",
" <td>Projection-Mix</td>\n",
" <td>E07</td>\n",
" <td>s1</td>\n",
" <td>w1</td>\n",
" <td>E94C24BD-45E4-450A-9919-257C714278F7</td>\n",
" <td>E08</td>\n",
" <td>s2</td>\n",
" <td>w3</td>\n",
" <td>CCE83D85-0912-429E-9F18-716A085BB5BC</td>\n",
" <td>.tif</td>\n",
" <td>../resources/Projection-Mix/2023-02-21/1334/Pr...</td>\n",
" </tr>\n",
Expand All @@ -166,9 +166,9 @@
" <td>1334</td>\n",
" <td>Projection-Mix</td>\n",
" <td>E07</td>\n",
" <td>s1</td>\n",
" <td>w2</td>\n",
" <td>B14915F6-0679-4494-82D1-F80894B32A66</td>\n",
" <td>s2</td>\n",
" <td>w3</td>\n",
" <td>B0A47337-5945-4B26-9F5F-4EBA468CDBA9</td>\n",
" <td>.tif</td>\n",
" <td>../resources/Projection-Mix/2023-02-21/1334/Pr...</td>\n",
" </tr>\n",
Expand All @@ -177,10 +177,10 @@
" <td>2023-02-21</td>\n",
" <td>1334</td>\n",
" <td>Projection-Mix</td>\n",
" <td>E08</td>\n",
" <td>E07</td>\n",
" <td>s1</td>\n",
" <td>w3</td>\n",
" <td>DD77D22D-07CB-4529-A1F5-DCC5473786FA</td>\n",
" <td>w2</td>\n",
" <td>B14915F6-0679-4494-82D1-F80894B32A66</td>\n",
" <td>.tif</td>\n",
" <td>../resources/Projection-Mix/2023-02-21/1334/Pr...</td>\n",
" </tr>\n",
Expand All @@ -189,10 +189,10 @@
" <td>2023-02-21</td>\n",
" <td>1334</td>\n",
" <td>Projection-Mix</td>\n",
" <td>E08</td>\n",
" <td>E07</td>\n",
" <td>s2</td>\n",
" <td>w3</td>\n",
" <td>CCE83D85-0912-429E-9F18-716A085BB5BC</td>\n",
" <td>w2</td>\n",
" <td>607EE13F-AB5E-4E8C-BC4B-52E1118E7723</td>\n",
" <td>.tif</td>\n",
" <td>../resources/Projection-Mix/2023-02-21/1334/Pr...</td>\n",
" </tr>\n",
Expand All @@ -201,10 +201,10 @@
" <td>2023-02-21</td>\n",
" <td>1334</td>\n",
" <td>Projection-Mix</td>\n",
" <td>E07</td>\n",
" <td>E08</td>\n",
" <td>s1</td>\n",
" <td>w3</td>\n",
" <td>BB87F860-FC67-4B3A-A740-A9EACF8A8F5F</td>\n",
" <td>DD77D22D-07CB-4529-A1F5-DCC5473786FA</td>\n",
" <td>.tif</td>\n",
" <td>../resources/Projection-Mix/2023-02-21/1334/Pr...</td>\n",
" </tr>\n",
Expand All @@ -226,9 +226,9 @@
" <td>1334</td>\n",
" <td>Projection-Mix</td>\n",
" <td>E07</td>\n",
" <td>s2</td>\n",
" <td>w3</td>\n",
" <td>B0A47337-5945-4B26-9F5F-4EBA468CDBA9</td>\n",
" <td>s1</td>\n",
" <td>w1</td>\n",
" <td>E94C24BD-45E4-450A-9919-257C714278F7</td>\n",
" <td>.tif</td>\n",
" <td>../resources/Projection-Mix/2023-02-21/1334/Pr...</td>\n",
" </tr>\n",
Expand All @@ -239,8 +239,8 @@
" <td>Projection-Mix</td>\n",
" <td>E07</td>\n",
" <td>s2</td>\n",
" <td>w2</td>\n",
" <td>607EE13F-AB5E-4E8C-BC4B-52E1118E7723</td>\n",
" <td>w1</td>\n",
" <td>DCFD1526-D063-4F8B-9E51-F1BD2EBD9F1A</td>\n",
" <td>.tif</td>\n",
" <td>../resources/Projection-Mix/2023-02-21/1334/Pr...</td>\n",
" </tr>\n",
Expand All @@ -250,9 +250,9 @@
" <td>1334</td>\n",
" <td>Projection-Mix</td>\n",
" <td>E08</td>\n",
" <td>s1</td>\n",
" <td>s2</td>\n",
" <td>w2</td>\n",
" <td>81928711-999D-41F6-B88C-999513D4C092</td>\n",
" <td>66923EBB-9960-4952-8955-D1721D112EE2</td>\n",
" <td>.tif</td>\n",
" <td>../resources/Projection-Mix/2023-02-21/1334/Pr...</td>\n",
" </tr>\n",
Expand All @@ -261,10 +261,10 @@
" <td>2023-02-21</td>\n",
" <td>1334</td>\n",
" <td>Projection-Mix</td>\n",
" <td>E08</td>\n",
" <td>s2</td>\n",
" <td>w1</td>\n",
" <td>B38C01F5-0D36-4A29-9F5A-BE62B6F7F73F</td>\n",
" <td>E07</td>\n",
" <td>s1</td>\n",
" <td>w3</td>\n",
" <td>BB87F860-FC67-4B3A-A740-A9EACF8A8F5F</td>\n",
" <td>.tif</td>\n",
" <td>../resources/Projection-Mix/2023-02-21/1334/Pr...</td>\n",
" </tr>\n",
Expand All @@ -274,32 +274,32 @@
],
"text/plain": [
" date acq_id name well field channel \\\n",
"0 2023-02-21 1334 Projection-Mix E08 s2 w2 \n",
"1 2023-02-21 1334 Projection-Mix E07 s2 w1 \n",
"2 2023-02-21 1334 Projection-Mix E07 s1 w1 \n",
"3 2023-02-21 1334 Projection-Mix E07 s1 w2 \n",
"4 2023-02-21 1334 Projection-Mix E08 s1 w3 \n",
"5 2023-02-21 1334 Projection-Mix E08 s2 w3 \n",
"6 2023-02-21 1334 Projection-Mix E07 s1 w3 \n",
"0 2023-02-21 1334 Projection-Mix E08 s2 w1 \n",
"1 2023-02-21 1334 Projection-Mix E08 s1 w2 \n",
"2 2023-02-21 1334 Projection-Mix E08 s2 w3 \n",
"3 2023-02-21 1334 Projection-Mix E07 s2 w3 \n",
"4 2023-02-21 1334 Projection-Mix E07 s1 w2 \n",
"5 2023-02-21 1334 Projection-Mix E07 s2 w2 \n",
"6 2023-02-21 1334 Projection-Mix E08 s1 w3 \n",
"7 2023-02-21 1334 Projection-Mix E08 s1 w1 \n",
"8 2023-02-21 1334 Projection-Mix E07 s2 w3 \n",
"9 2023-02-21 1334 Projection-Mix E07 s2 w2 \n",
"10 2023-02-21 1334 Projection-Mix E08 s1 w2 \n",
"11 2023-02-21 1334 Projection-Mix E08 s2 w1 \n",
"8 2023-02-21 1334 Projection-Mix E07 s1 w1 \n",
"9 2023-02-21 1334 Projection-Mix E07 s2 w1 \n",
"10 2023-02-21 1334 Projection-Mix E08 s2 w2 \n",
"11 2023-02-21 1334 Projection-Mix E07 s1 w3 \n",
"\n",
" md_id ext \\\n",
"0 66923EBB-9960-4952-8955-D1721D112EE2 .tif \n",
"1 DCFD1526-D063-4F8B-9E51-F1BD2EBD9F1A .tif \n",
"2 E94C24BD-45E4-450A-9919-257C714278F7 .tif \n",
"3 B14915F6-0679-4494-82D1-F80894B32A66 .tif \n",
"4 DD77D22D-07CB-4529-A1F5-DCC5473786FA .tif \n",
"5 CCE83D85-0912-429E-9F18-716A085BB5BC .tif \n",
"6 BB87F860-FC67-4B3A-A740-A9EACF8A8F5F .tif \n",
"0 B38C01F5-0D36-4A29-9F5A-BE62B6F7F73F .tif \n",
"1 81928711-999D-41F6-B88C-999513D4C092 .tif \n",
"2 CCE83D85-0912-429E-9F18-716A085BB5BC .tif \n",
"3 B0A47337-5945-4B26-9F5F-4EBA468CDBA9 .tif \n",
"4 B14915F6-0679-4494-82D1-F80894B32A66 .tif \n",
"5 607EE13F-AB5E-4E8C-BC4B-52E1118E7723 .tif \n",
"6 DD77D22D-07CB-4529-A1F5-DCC5473786FA .tif \n",
"7 17654C10-92F1-4DFD-98AA-6A01BBD77557 .tif \n",
"8 B0A47337-5945-4B26-9F5F-4EBA468CDBA9 .tif \n",
"9 607EE13F-AB5E-4E8C-BC4B-52E1118E7723 .tif \n",
"10 81928711-999D-41F6-B88C-999513D4C092 .tif \n",
"11 B38C01F5-0D36-4A29-9F5A-BE62B6F7F73F .tif \n",
"8 E94C24BD-45E4-450A-9919-257C714278F7 .tif \n",
"9 DCFD1526-D063-4F8B-9E51-F1BD2EBD9F1A .tif \n",
"10 66923EBB-9960-4952-8955-D1721D112EE2 .tif \n",
"11 BB87F860-FC67-4B3A-A740-A9EACF8A8F5F .tif \n",
"\n",
" path \n",
"0 ../resources/Projection-Mix/2023-02-21/1334/Pr... \n",
Expand Down Expand Up @@ -327,7 +327,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 8,
"id": "948904be",
"metadata": {},
"outputs": [],
Expand All @@ -347,14 +347,14 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 9,
"id": "37f65e50",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d39b97703a4f4214b3c1618843c8f481",
"model_id": "cca2a3f86a72410ca69527e3a9b46e26",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -372,20 +372,26 @@
"for well in tqdm(files['well'].unique()):\n",
" well_files = files[files['well'] == well]\n",
" \n",
" img, hists, ch_metadata, metadta = get_well_image_CYX(\n",
" img, hists, ch_metadata, metadata, roi_tables = get_well_image_CYX(\n",
" well_files=well_files,\n",
" channels=channels,\n",
" assemble_fn=montage_grid_image_YX,\n",
" )\n",
" \n",
" well_group = plate[well[0]][str(int(well[1:]))][0]\n",
" write_cyx_image_to_well(img, hists, ch_metadata, metadta, well_group)"
" write_cyx_image_to_well(img, hists, ch_metadata, metadata, well_group)\n",
" \n",
" # Write all ROI tables\n",
" for roi_table in roi_tables:\n",
" write_roi_table(roi_tables[roi_table], roi_table, well_group)"
]
},
{
"cell_type": "markdown",
"id": "7f5a8f42",
"metadata": {},
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"# Inspect ome-zarr plate\n",
"The data can be opened with the [ome-zarr Napari plugin](https://www.napari-hub.org/plugins/napari-ome-zarr)."
Expand All @@ -408,7 +414,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.0"
"version": "3.9.16"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 6a1cd2b

Please sign in to comment.