Skip to content

Commit db0bed8

Browse files
committed
Add safety check for masked loading of ROI tables to support ngio masked ROI tables
1 parent 560cca0 commit db0bed8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

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)