Open yxdragon opened 4 years ago
@yxdragon hello again! Long time no see! 😊
I’m not sure what this function is supposed to do? Is this the same as this scikit-image function?
https://github.com/scikit-image/scikit-image/blob/master/skimage/morphology/_util.py#L54
What we do is precompute this in Python then pass the resulting array into Numba/Cython as an input.
@jni there are some functions using numba in imagepy.ipyalg. As numba update to 0.43, these functions do not work now. I want to repair them, but it seems not easy to me.
As the function "neighbors" upon, (that is the code in sknw, I learn from your skan. the function count the neighbors pixel's index in ravel coordinate)
It works well in numba0.41, and very fast. but now, it doesnot work. So did your skan works now? And can you help to modify it? or give some guide?
did your skan works now?
Yes, it's working with the latest numba, I just checked. The trick is that I never or rarely use NumPy functions inside my Numba code. Everything NumPy I precompute in a non-compiled function, and then I pass in pre-allocated arrays to Numba. Only simple for-loops are involved in Numba.
The above function should not need to be jitted: it creates a very small array that you can reuse. So, make that a pure Python function, return the array, and and pass the resulting array to the jitted functions that need it.
ok, split the all function into python part and jit part. now all function can work with numba 0.46, thanks!
as numba update a lot, many function does not work now. I want to modify all functions in jit(nopython=True) mode.
But I failed to modify a function (spend two hours) @jni I think you are aware of numba, can you help to rewrite the function below? https://github.com/Image-Py/imagepy/blob/master/imagepy/ipyalg/graph/sknw.py
in the old version, this function need not jit, but now, if function a call function b and a is a jit function, then b must be jit too. thanks!