Skip to content

Commit a797378

Browse files
authored
Merge pull request #957 from fractal-analytics-platform/roi_table_index
Add safety check for masked loading of ROI tables to support ngio masked ROI tables
2 parents 15dc669 + 4c25a48 commit a797378

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
**Note**: Numbers like (\#123) point to closed Pull Requests on the fractal-tasks-core repository.
22

3+
# 1.5.2
4+
* Library
5+
* Update masked loading wrapper to support loading masking ROIs written by ngio (\#957).
6+
37
# 1.5.1
48
* Tasks:
59
* In `Convert Cellvoyager to OME-Zarr` & `Convert Cellvoyager Multiplexing to OME-Zarr` tasks, handle unset window start & end better (\#953).

fractal_tasks_core/masked_loading.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,14 @@ def _preprocess_input(
105105

106106
# Check that ROI_table.obs has the right column and extract label_value
107107
if column_name not in ROI_table.obs.columns:
108-
raise ValueError(
109-
'In _preprocess_input, "{column_name}" '
110-
f" missing in {ROI_table.obs.columns=}"
111-
)
108+
if ROI_table.obs.index.name == column_name:
109+
# Workaround for new ngio table
110+
ROI_table.obs[column_name] = ROI_table.obs.index
111+
else:
112+
raise ValueError(
113+
f"In _preprocess_input, {column_name=} "
114+
f" missing in {ROI_table.obs.columns=}"
115+
)
112116
label_value = int(
113117
float(ROI_table.obs[column_name].iloc[ROI_positional_index])
114118
)

0 commit comments

Comments
 (0)