Closed kaczmarj closed 4 months ago
similar issue is that 'hierarchy' can sometimes be None (if no tissue detected)
Traceback (most recent call last):
File "/home/jkaczmarzyk/miniforge3/envs/wsinfer/lib/python3.10/site-packages/wsinfer/patchlib/__init__.py", line 361, in segment_and_patch_directory_of_slides
segment_and_patch_one_slide(
File "/home/jkaczmarzyk/miniforge3/envs/wsinfer/lib/python3.10/site-packages/wsinfer/patchlib/__init__.py", line 161, in segment_and_patch_one_slide
polygon, contours, hierarchy = get_multipolygon_from_binary_arr(
File "/home/jkaczmarzyk/miniforge3/envs/wsinfer/lib/python3.10/site-packages/wsinfer/patchlib/patch.py", line 44, in get_multipolygon_from_binary_arr
hierarchy = hierarchy.squeeze(0)
AttributeError: 'NoneType' object has no attribute 'squeeze'
see here:
https://github.com/SBU-BMI/wsinfer/blob/d5057345ef0948a3f53488a03331d3b061b36953/wsinfer/modellib/run_inference.py#L164
it is possible that we wrote an h5 file with an empty array. we should catch this and not write the h5 file if no patches were detected.