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

Downstream fiber analysis updates #974

Merged
merged 33 commits into from
May 11, 2023
Merged

Downstream fiber analysis updates #974

merged 33 commits into from
May 11, 2023

Conversation

camisowers
Copy link
Contributor

@camisowers camisowers commented Apr 18, 2023

If you haven't already, please read through our contributing guidelines before opening your PR

What is the purpose of this PR?

Fine tune the fiber segmentation to only pull out distinct fiber objects, rather than segmenting all collagen signal in the image. Also, implement functions to calculate more specific and useful biological statistics.

How did you implement your changes

  • Change the object filtering from the Meijering neuriteness filter, to the Frangi vesselness filter.
  • Add the calculate_fiber_alignment function which will add an alignment score column to the saved fiber object table.
    • This score is assigned for each individual fiber, and represents the inverse of the average change in fiber orientation among it's k nearest neighbors (default k=4). Using inverse implies that high scores imply high alignment, rather than than low alignment.
  • Add the calculate_density function, which calculates two types of densities:
    • pixel based = (fiber pixel area / total image area) x100
    • fiber number based = (number of fibers / total image area) x100
  • Generate a fov-level table and tile-level table consisting of stats for alignment, average length, pixel based density, and fiber number density. Tile size if specified by the user.

Remaining issues

  • add functionality to average the lengths, alignment scores, and determine the density of fibers within specified tile sizes within an image
  • add cell to notebook which computes summary stats

@camisowers camisowers added the enhancement New feature or request label Apr 18, 2023
@camisowers camisowers self-assigned this Apr 18, 2023
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@camisowers
Copy link
Contributor Author

@srivarra @alex-l-kong I've spent too long with this, could use some fresh eyes for code cleaning. 🙄

Copy link
Contributor

@alex-l-kong alex-l-kong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, a few semantic comments.

src/ark/segmentation/fiber_segmentation.py Show resolved Hide resolved
src/ark/segmentation/fiber_segmentation.py Outdated Show resolved Hide resolved
src/ark/segmentation/fiber_segmentation.py Outdated Show resolved Hide resolved
Copy link
Contributor

@srivarra srivarra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a few suggestions on cleaning things up.

src/ark/segmentation/fiber_segmentation.py Show resolved Hide resolved
src/ark/segmentation/fiber_segmentation.py Show resolved Hide resolved
src/ark/segmentation/fiber_segmentation.py Outdated Show resolved Hide resolved
Copy link
Contributor

@srivarra srivarra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

src/ark/segmentation/fiber_segmentation.py Show resolved Hide resolved
Copy link
Contributor

@alex-l-kong alex-l-kong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor comment, otherwise it looks good!

src/ark/segmentation/fiber_segmentation.py Outdated Show resolved Hide resolved
@camisowers camisowers marked this pull request as ready for review May 10, 2023 01:28
Copy link
Member

@ngreenwald ngreenwald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I think it would be useful to add the visualization you put together where each fiber is colored by one of the fiber stats. Either with the option for the user to specify multiple, or just the local alignment.

Can you also generate those for like 50-100 TONIC FOVs? I can't remember if you tweaked anything after we looked at the plots a couple weeks ago

src/ark/segmentation/fiber_segmentation.py Show resolved Hide resolved
Copy link
Member

@ngreenwald ngreenwald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, looks good

@ngreenwald ngreenwald enabled auto-merge May 11, 2023 01:36
@ngreenwald ngreenwald disabled auto-merge May 11, 2023 01:36
@ngreenwald ngreenwald merged commit 7917793 into main May 11, 2023
@ngreenwald ngreenwald deleted the frangi_fiber_filtering branch May 11, 2023 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants