harpy.externals.ilastik.run_object_classification#
- harpy.externals.ilastik.run_object_classification(sdata, image_name, labels_name, table_name, output_table_name, path_to_classifier, path_to_ilastik_executable, obs_key='ilastik_label', export_source='Object Predictions', instance_key='cell_ID', region_key='fov_labels', overwrite=False, output_dir=None, runtime_dir=None, lazyflow_threads=8, lazyflow_total_ram_mb=16000, unmapped_label=0, raise_on_unmapped_instance=False)#
Run ilastik headless object classification and add predicted labels to a table element.
- Parameters:
sdata (
SpatialData) – Backed SpatialData object stored as a Zarr v2 store.image_name (
str) – Image element used as ilastik raw input.labels_name (
str) – Labels element used as ilastik segmentation input and to map predictions back to table instances.table_name (
str|None) – Table element from which the annotated cells are selected. IfNone, a new table is created from the non-zero instance ids inlabels_name.output_table_name (
str) – Output table element receiving the predicted ilastik labels inadata.obs[obs_key].path_to_classifier (
str|Path) – Path to the ilastik project.ilpfile.path_to_ilastik_executable (
str|Path) – Path to the ilastik executable, or to the app directory containing the executable. Example:".../ilastik".obs_key (
str(default:'ilastik_label')) – Column name added toadata.obswith the predicted ilastik labels.export_source (
Literal['Blockwise Object Predictions','Object Predictions'] (default:'Object Predictions')) – ilastik export source passed to--export_source. This must match the export source configured in the ilastik GUI/project, i.e. choose either"Blockwise Object Predictions"or"Object Predictions"consistently in both places.instance_key (
str(default:'cell_ID')) – Name of the instance id column inadata.obs. Only used iftable_nameisNone.region_key (
str(default:'fov_labels')) – Name of the region column inadata.obs. Only used iftable_nameisNone.overwrite (
bool(default:False)) – Whether to overwriteoutput_table_nameif it already exists.output_dir (
str|Path|None(default:None)) – Directory for ilastik exported files. IfNone, a temporary directory is created.runtime_dir (
str|Path|None(default:None)) – Directory for ilastik runtime logs. IfNone, a temporary directory is created.lazyflow_threads (
int(default:8)) – Value for theLAZYFLOW_THREADSenvironment variable.lazyflow_total_ram_mb (
int(default:16000)) – Value for theLAZYFLOW_TOTAL_RAM_MBenvironment variable.unmapped_label (
int(default:0)) – Label assigned to table rows whoseinstance_keyis not present in the segmentation-to-prediction mapping. This only applies whenraise_on_unmapped_instanceisFalse.raise_on_unmapped_instance (
bool(default:False)) – IfTrue, raise when a table instance id is not present in the segmentation mask instead of assigningunmapped_label.
- Return type:
- Returns:
: The updated
SpatialDataobject.