I was just browsing through some repos that are using cc3d and I saw that you might benefit from some performance improvements. I am not sure how crucial this is to your project, but the following code can be made much faster.
This code requires repeated calculation on the image and has bilinear performance. You can get the same result much faster by using cc3d.statistics
cc_out = cc3d.connected_components(labels_out, connectivity=connectivity)
stats = cc3d.statistics(cc_out) # calculates centroids, bboxes, and voxel counts in one pass
voxels_per_label = stats["voxel_counts"] # ndarray, index is CCL ID
Thanks for reading and I hope I'm not intruding. Good luck on your project!
Hi there!
I was just browsing through some repos that are using cc3d and I saw that you might benefit from some performance improvements. I am not sure how crucial this is to your project, but the following code can be made much faster.
https://github.com/yuki-biology/nuclei-volume-calc/blob/23b9362c39ef8507ed6b138d55e1534b2d6ccb2c/module/cc3d.py#L23-L28
This code requires repeated calculation on the image and has bilinear performance. You can get the same result much faster by using
cc3d.statistics
Thanks for reading and I hope I'm not intruding. Good luck on your project!
Will