Posted by
Gabriel Landini on
Aug 22, 2010; 8:57am
URL: http://imagej.273.s1.nabble.com/pruning-tp3687155p3687160.html
On Sunday 22 August 2010, you wrote:
> Is there a plugin which will prune a skeleton such that the longest
> nonbranched distance remains?
> The skeleton analyzer will provide endpoints and triple points, so what
> I need is to remove the shortest branch coming off of each triple point.
> Before I do this, I am wondering if it is already done (and I welcome
> any comments on the best way to do it).
Here I assume that the object is 8 connected and the image has been
skeletonised (there are no filled areas).
For the branches you need the endpoints and all the 2-neighbour points.
The binary connectivity plugin gives you an image labelled according to the
number of pixels connected to the centre pixels in a 3x3 kernel.
If you threshold this result for the values 1 and 2, then you could use the
Lines8 plugin to measure the lengths of the thresholded segments and either
use the magic wand or Binary Reconstruction to keep the largest one.
For the latter scan throught the Results table, find the longest segment, get
its XStart YStart coordinates, then create an empty image (same dimensions)
and set those corrdinates in the image. That is your seed, while the
thresholded image is the mask and then reconstruct.
Note that the Lines8 plugin gives 2 different estimates of the segment
lengths.
Both plugins are in the Morphology zip file in my page.
http://www.dentistry.bham.ac.uk/landinig/software/software.htmlI fgorgot to say that this is all for 2D. For 3D I assume that one can appply
a similar approach but the plugins above work for 2D only.
Cheers
G.