Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some attributes are not described in the docs #49

Open
e-koch opened this issue Mar 2, 2019 · 8 comments
Open

Some attributes are not described in the docs #49

e-koch opened this issue Mar 2, 2019 · 8 comments

Comments

@e-koch
Copy link
Owner

e-koch commented Mar 2, 2019

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

@pippo1990
Copy link

pippo1990 commented Feb 17, 2024

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)

@e-koch
Copy link
Owner Author

e-koch commented Feb 19, 2024

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

@pippo1990
Copy link

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

@e-koch
Copy link
Owner Author

e-koch commented Feb 22, 2024

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

@pippo1990
Copy link

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

@pippo1990
Copy link

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

@e-koch
Copy link
Owner Author

e-koch commented Feb 22, 2024

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

@pippo1990
Copy link

thanks for your nice and complete explanation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants