I think you'd have to do it from scratch. Googling brings up too many
alternatives to list here.
*
For implementation, you have 2 options
1) Cython, like:
while thin_more:
for i in xrange(im.shape[0]):
for j in xrange(im.shape[1]):
for k in xrange(im.shape[2]):
thin_here(im, i, j, k)
This would be the easiest to implement. Look at skimage code for examples.
2) C/C++. mahotas has a very efficient method to the thinning in 2D. It peeks at
the ndarray structure to get arrays of pointer offsets and then does multiple
passes as fast at possible.
This is harder to get right (at least it was for me—a whole day just
transforming this function into this form), but significantly faster (I
obsessively measured it while coding it).
So, it depends on your computer time/programmer time tradeoffs.
HTH
Luis
--
Luis Pedro Coelho | Institute for Molecular Medicine | http://luispedro.org
Thank you
2012/3/27 Luis Pedro Coelho <lu...@luispedro.org>:
https://github.com/thouis/CellProfiler/blob/master/cellprofiler/cpmath/haralick.py#L110
This is what mahotas does for 2D.
If you have the right templates for 3D thinning, you can just have a wrapper
around hitmiss() and call it. This works well and my first implementation of
thinning for 2D worked like that.
It's just not especially fast (you have to loop in Python for the multiple
hitmiss() calls and each of those computes filter offsets).
HTH,
--
Luis Pedro Coelho | Institute for Molecular Medicine | http://luispedro.org
LxMLS 2012: Lisbon Machine Learning School
http://lxmls.it.pt
You need to measure it.
hitmiss() [at least from mahotas] is C++, so it's fast. What is slow is that
you won't be calling it optimally and doing some extra computation in every
loop.
Still, you might not need the fastest possible code, if you have less than
hundreds of thousands of images.