FilFinder icon indicating copy to clipboard operation
FilFinder copied to clipboard

Some attributes are not described in the docs

Open e-koch opened this issue 6 years ago • 8 comments

Some properties in FilFinder2D are not described in the docs (i.e. FilFinder2D.skeleton_longpath).

e-koch avatar Mar 02 '19 12:03 e-koch

Hi I am trying to make use of your nice tool (would say more than just a tool) , I am using basic exaples just to find FilFinder2D.skeleton_longpath, is there any way to get the lenght of it in pixels ? I tried branch_lenghts but is just sizes of the various segment found and cannot use them because I dont know which were selected for theh skelethon_longpath , unless I need tu sum them all because these are just the ones selected to create the seleton ? I can get the number of pixels with np.where(skeleton.longpath == 1) or np.sum(mask) but that won't be the Euclidean distance for pixel neighbor on a diagonal (1,4 vs 1)

pippo1990 avatar Feb 17 '24 14:02 pippo1990

Hi @pippo1990 -- you're looking for this function to get the longest path lengths: https://fil-finder.readthedocs.io/en/latest/api/fil_finder.FilFinder2D.html#fil_finder.FilFinder2D.lengths

e-koch avatar Feb 19 '24 12:02 e-koch

dodgy I can run print('\nfil.branch_lenghts() : ' , fil.branch_lengths()) but print('\nfil.lenghts() : ' , fil.lenghts()) gives AttributeError: 'FilFinder2D' object has no attribute 'lenghts' I am on fil_finder.version : 1.7.2

pippo1990 avatar Feb 22 '24 17:02 pippo1990

Just checking: was the lenghts a typo in the comment above?

e-koch avatar Feb 22 '24 18:02 e-koch

yep sorry, my right hand is faster than the left one sorry, It's working now

pippo1990 avatar Feb 22 '24 19:02 pippo1990

for one of my test fil.lengths is in between the number of pixel and the geometric distance calculated on the skeleton_longpath by hand (pixel_to_pixel) i.e. : my measures length 1315.8813844421359 vs number of pixels 1128 while fil.lengths is fil.lenghts() : [1298.91082169] pix any reason about that , is it geometric lenght ? I am not able to interpret the filament.py part describing lenght: line 331 filament.py

pippo1990 avatar Feb 22 '24 19:02 pippo1990

There can be a moderate discrepancy between the geometric length and the one filfinder finds from the longest path. FilFinder generalizes the identification of the intersections between branches along the longest path to allow them to be made up of several pixels. The distance it uses if then a median of the intersection pixels, added to the geometric distances along each branch.

There's also an option when running FilFinder2D.find_widths where 2 * width is added to the filament length to account for the shortening from the skeletonization process: https://fil-finder.readthedocs.io/en/latest/api/fil_finder.FilFinder2D.html#fil_finder.FilFinder2D.find_widths. If you are running that step, you can disable this with add_width_to_length=False

e-koch avatar Feb 22 '24 22:02 e-koch

thanks for your nice and complete explanation

pippo1990 avatar Feb 22 '24 23:02 pippo1990