seung-lab / fastmorph

Multilabel and Grey 3D morphological image processing functions. Dilate, Erode, Opening, Closing.
GNU General Public License v3.0
13 stars 3 forks source link

feat: add grey dilation and erosion operators #3

Closed william-silversmith closed 8 months ago

william-silversmith commented 8 months ago

Did all this work for multi-label, why not add grayscale as well (spelled as the British English "grey" to harmonize with SciPy and Scikit-Image, what a headache that would be if they didn't agree!).

I decided to go with an enum for selecting the mode. Multi-label is the default. You can select grey with mode=fastmorph.Mode.grey.

william-silversmith commented 8 months ago

Performance tests on random 8-bit uint labels.

scipy grey_dilation: 17.8 sec fastmorph grey_dilate / 1 thread: 4.0 sec (4.5x) fastmorph grey_dilate / 2 threads: 2.9 sec (6.1x) fastmorph grey_dilate / 4 threads: 2.5 sec (7.1x)

scipy grey_erosion: 19.1 sec fastmorph grey_erode / 1 thread: 4.0 sec (4.8x) fastmorph grey_erode / 2 threads: 2.9 sec (6.6x) fastmorph grey_erode / 4 threads: 2.6 sec (7.3x)