-
Notifications
You must be signed in to change notification settings - Fork 96
MVP for morpohology module #866
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
Closed
Closed
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
b99fa5f
MVP for internal calling of extra props
timtreis bbecec3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 6e3d652
Added option to externally feed in functions
timtreis 7b21fda
merge conflict resolved
timtreis 753ec3a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] c9a3cc9
Merge branch 'main' into feature/add_morphology_toolbox
timtreis 34f745f
add rough functionality to write regionprops into sdata["table"].obsm…
npeschke 07606e2
DataFrame now written to obsm instead of numpy array
npeschke 0f0ea7c
add granularity measurement from afermg/cp_measurements
npeschke b33895b
add border_occupied_factor
npeschke ebc08d8
add sanity checks and make multiple coordinate systems work
npeschke 50d58d2
fix assertion to accommodate new interface
npeschke 328ba16
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] f7b5270
add possibility for granularity to return multiple values per channel…
npeschke 5c1d70f
Merge remote-tracking branch 'origin/feature/add_morphology_toolbox' …
npeschke 112d1a9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 0ba44d2
Merge branch 'main' into feature/add_morphology_toolbox
npeschke 8047dde
add "all" option for regionprops through using methods=None
npeschke 39f9db8
add granularity and border_occupied_factor to _all_regionprops_names
npeschke 02d21c8
refactor quantify_morphology
npeschke 59d8137
add zernike
npeschke bc035d2
status update
npeschke cde0526
handle dict returns from calculate_* features
npeschke 9a9511f
add _sdata_image_features_helper
npeschke 78c0f67
Merge branch 'main' into feature/add_morphology_toolbox
timtreis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @npeschke @timtreis was just taking a look at this, was wondering why the duplication of the function? It seems that
quantify_morphology
does something very similar tocalculate_image_features
. Do you plan to discontinue the latter? wouldn't it be better to adapt the latter to use spatialdata + adapt? thank youThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tbh not sure yet what the optimal solution will be. There is clear redundancy and a strong overlap, but when I wrote the original MVP, it didn't clearly fit with the current
calculate_image_features
. On the one hand, some of these features don't need an image but only the label, but then also the structure of the function was going to be quite different.Even if we merge them into the calculate_image_features function, the parameters of that function would have to change. So yeah, not fully sure yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I generally wanted to have sth that takes an arbitrary callable with a region_props like footprint so we could also inject f.e. some HugginfFace featuriser or sth
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, that's a good point. The
calculate_image_features
does support arbitrary functions, see https://squidpy.readthedocs.io/en/stable/api/squidpy.im.calculate_image_features.html and https://squidpy.readthedocs.io/en/stable/api/squidpy.im.calculate_image_features.html and I understand that the current implementation doesn't operate on masks (or not only on mask), but maybe it would be ok to just change the input to "image" to not be just an Image but also a Label?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the parallelization/out of core functionality I think it's also important. The current implementation relies on joblib parallel to iterate over spots, and understand it's not optimal (e.g. how to do it with raster labels and raster image?). But maybe a combination of that and dask, e.g. https://examples.dask.org/applications/image-processing.html could be useful. Basically I think we should strive to implement scalability in time/memory.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking at this, not maintained but maybe some ideas could be reused
https://github.com/jrussell25/dask-regionprops/blob/main/dask_regionprops/regionprops.py
EDIT: looking more deeply, not sure anymore 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this ties into the larger topic of moving things to the GPU
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for context, the current implementation takes 20 seconds on my machine to calculate all available features of the MIBI-TOF dataset. So parallelization might not need to be that urgent.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'll be if we add more, potentially more expensive to compute, features and analyse datasets like Xenium with 100k+ cells ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @npeschke , thanks for sharing the time. If the mibi-tof dataset you are referring to is the one from squidpy, that is a toy dataset that does not really recapitulate real data complexity and size. I'd be curious to see the performance on a e.g. xenium dataset.