Open hey2homie opened 3 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 56.27%. Comparing base (
cc4e62c
) to head (0975ecf
). Report is 14 commits behind head on main.:exclamation: Current head 0975ecf differs from pull request most recent head 8ea29d3. Consider uploading reports for the commit 8ea29d3 to get more accurate results
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@hey2homie Can you post some example image/masks to demonstrate this issue?
Sure, this usually gets quite prominent with the ramified glia cells like on this two crops (left is grey-scale, right are masks with holes):
I've also added the possibility to filter out holes based on their area as single pixel holes are quite prominent. Need a bit more time to test though.
@mrariden, I've also added options to fill in holes that are less than certain threshold.
I've also added in the same PR option to save masks with/without holes in geojson
format instead of using save_txt
. This dramatically speeds up the exporting of the polygonal representation of the masks. Also allows to import segmentation results directly into QuPath without any extra hassle. Slightly modified part for saving outlines to account for possible holes in the masks.
I'll add tomorrow some tests and time measurements.
Here is example of plotted outlines:
Time it takes to save tiff
, write coordinates and plot outlines for a single mask 512 by 512:
2024-03-21 17:17:04,229 [INFO] Started saving masks
2024-03-21 17:17:07,615 [INFO] Finished saving masks
2024-03-21 17:17:34,865 [INFO] Started saving masks 2024-03-21 17:17:38,305 [INFO] Finished saving masks
2024-03-21 17:17:41,645 [INFO] Started saving masks 2024-03-21 17:17:45,201 [INFO] Finished saving masks
* After
2024-03-21 16:08:24,113 [INFO] Started saving masks 2024-03-21 16:08:24,225 [INFO] Finished saving masks
2024-03-21 16:08:24,469 [INFO] Started saving masks 2024-03-21 16:08:24,495 [INFO] Finished saving masks
2024-03-21 16:08:24,526 [INFO] Started saving masks 2024-03-21 16:08:24,555 [INFO] Finished saving masks
Time it takes to save `tiff`, write coordinates and plot outlines for a single mask 26609 by 20824 with 28k objects:
* Before
2024-03-22 11:37:51,037 [INFO] Started saving masks 2024-03-22 12:25:36,460 [INFO] Finished saving masks
* After
2024-03-21 17:01:48,731 [INFO] Started saving masks 2024-03-21 17:02:43,550 [INFO] Finished saving masks
Often with the glial cells Cellpose fills in masks where the hole between processes is present. This affects the downstream morphological analysis and intensities computations. Added an option to disable this behaviour when calling
eval
.Also, noticed that saved masks in
.tif
or.tiff
format are quite large in size, so added compression which significantly reduced the size of the file.