Extend label and largest_connected_components to support any (valid) 3D kernel, based on what scipy does. From my timing, this results in no observable change in execution time for the star kernel (and eyeballing it, the only lost optimisation I can see is a possible unrolling the kernel_data loop). However, this is a more disruptive API change, so I could adjust things so that label keeps it's interface and I add another label_with_kernel function if you want.
Extend
label
andlargest_connected_components
to support any (valid) 3D kernel, based on what scipy does. From my timing, this results in no observable change in execution time for the star kernel (and eyeballing it, the only lost optimisation I can see is a possible unrolling thekernel_data
loop). However, this is a more disruptive API change, so I could adjust things so thatlabel
keeps it's interface and I add anotherlabel_with_kernel
function if you want.Tests run with rustc 1.72.0 and ndarray 0.15.6.