xing-lab-pitt / livecellx

GNU General Public License v3.0
10 stars 1 forks source link

Optimizing the process of generating single-cell contour masks #90

Open dummyindex opened 1 month ago

dummyindex commented 1 month ago

Scenario When computing IoU and IoMin between different times, the speed for generating contour masks is the bottle neck. According to our profiling, skimage's polygon implementation takes long. This is also validated by the fact that after reducing the contour coordinate numbers, our scripts for calculating IoU/IoMin mappings run much faster.

Solution

On CX-A data with 577 time points and "max cell pair count for map computation: 7,968,040" (a lot of pairs are skipped because of no overlapping bounding boxes) With skimage Polygon implementation, it takes 3 hours and 44 minutes With PIL implementation, The task takes 43 minutes.

On a dataset with 322 time points and higher density, 127,826 cells PIL implementation takes 1.5 hours for calculating TD=1 IoU mappings. Skimage Implementation takes overnight.

dummyindex commented 1 month ago

Related issues: https://github.com/scikit-image/scikit-image/issues/5471 https://github.com/scikit-image/scikit-image/issues/5451#issuecomment-878416003

We may try PIL instead.