-
Notifications
You must be signed in to change notification settings - Fork 100
Method to detect specimens in H&E images #1044
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
Method to detect specimens in H&E images #1044
Conversation
selmanozleyen
left a comment
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 these are some initial feedbacks I will get into more details tomorrow
|
Notes to self: Works fine in the happy path (white bg, rgb specimen) but fails when the specimen is weird. Potential other idea: Use https://scikit-image.org/docs/0.25.x/auto_examples/segmentation/plot_trainable_segmentation.html
|
…generate-tissue-masks-in-he
|
Re-requesting also from @flying-sheep because I had to make changes to the hatch logic for stuff to even work. Not sure how the tests passed beforehand but if I'm not mistaken, certain actions just didn't exist? |
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.
there were no commands missing, hatch pre-defines them: https://hatch.pypa.io/latest/config/internal/testing/#scripts
unfortunately adding the diff-cover command means you have to re-define everything, since you can’t just override individual scripts in an environment (known hatch issue).
To explain how things should work:
- all test/coverage dependencies should be in one spot (here the
testextra) - the
hatch-testenv should define the commands as explained in the link above:runshould run the tests usingpytest ...run-covshould run the tests usingcoverage run -m pytest ...cov-combineshould combine the.coverage-xyzfiles written from the subprocesses spawned bypytest-xdistcov-reportshould do all the reporting
- locally, you should use
hatch test [-c] [-p] ...which will use these commands behind the scenes- VS Code only understands
pytest-cov, which is therefore only needed for VS Code’s test running GUI.
- VS Code only understands
- in CI, we sadly need to use
matrix_name, so we can’t use the nicehatch testcommand and need to manually use therun*andcov*commands
|
hmm, strange, upload successful, but the link doesn’t work, and I don’t see the “codecov” CI job below: |
|
Should Selmans handle be in that link? Shouldn't it be something at the org level? |
|
yeah, that confused me too. the uploads should definitely go to the |
|
Did Selman maybe overwrite the codecov token with a private one? |
|
possible, let’s make sure this isn’t the case. /edit: done |
|
True, there wasn't a CODECOV token because we now take it env variables from the gh repo settings and I just used mine. Thought it would use the orgs since I was part of it. Nice catch |
* mvp for function; without testgs * added option to retain holes * refactor + 1 test * added missing import * renamed test so that a plot would be generated * added img from runner; cross-os-data-cache * improved docstring * added data download script to correct location * updated hatch commands * modified coverage combine * removed superflous combine step * first download data, then run tests * attempt to simplify * aligned testing * updated toml * aligned __init__ files * no uv cache for data download * removed download step that'd never get hit * simplify * parallel * speed up tests --------- Co-authored-by: Phil Schaf <[email protected]>
For other downstream functions, such as #1036, one needs a function to robustly detect where in the image the tissue is and how many of those there are.
This function
a) implements two algorithms for identifying the tissue (otsu & felzenszwalb)
b) deals with arbitrary channel input
c) heuristically tries to identify what is a sample and what is either just random stuff (dirt, Visium frame etc). As a fallback, one can pass in the number of samples expected which should be more robust
d) adds the mask back to the sdata object with the same structure and transformations as the original image had
e) does everything in dask so it's quite fast
Todo