CellViT icon indicating copy to clipboard operation
CellViT copied to clipboard

edge_information["edge_patches"] can be None in cell_detection.py

Open PingjunChen opened this issue 1 year ago • 1 comments

Describe the bug Inside the function _clean_edge_cells of class CellPostProcessor inside cell_detection.py, it directly indexes the first element of edge_information["edge_patches"] via "edge_information["edge_patches"][0]", which can lead to an error, since the value of edge_information["edge_patches"] can be None, thus not subscriptable.

Screenshots Screenshot 2024-08-15 at 3 11 14 PM

Additional context This bug shall easily be resolved by adding a None value check before indexing the first element:

if edge_information["edge_patches"] is None:
    continue

PingjunChen avatar Aug 15 '24 20:08 PingjunChen

Thanks for checking, I will put this on my list and check if this resolves the problem without any downstream error

FabianHoerst avatar Aug 16 '24 05:08 FabianHoerst