[go: nahoru, domu]

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

Trialling different parameters for orthoslice merging #26

Open
GenevieveBuckley opened this issue Sep 21, 2022 · 2 comments
Open

Trialling different parameters for orthoslice merging #26

GenevieveBuckley opened this issue Sep 21, 2022 · 2 comments

Comments

@GenevieveBuckley
Copy link

Is there a good way to try out different parameters for combining orthoslice predictions into a single volume? I'd like to test a few different things without needing to re-run the whole computation.

Once I have the saved XY, XZ, YZ orthoslice predictions, is there a function entrypoint I can use to jump to the right spot? It doesn't have to be accessible from the GUI, scripting is fine. I had a quick look through the code base but didn't find what I was looking for - can you help point me in the right direction?

@conradry
Copy link
Contributor
conradry commented Oct 5, 2022

Hi Genevieve,

The orthoplane consensus algorithm works on run length encoded segmentations, which makes it very fast but requires conversion from the regular labelmap. Normally the run length encodings are generated on 2D slices immediately after model inference and then discarded when the consensus algorithm finishes (there's no reason I couldn't add an option to save them though).

Before getting started, I recommend upgrading to the newest version of empanada:

pip install --upgrade empanada-napari==0.2.3

Here are two scripts that should work for you assuming you used one of the MitoNet models and stored the results in zarr.

This one converts a labelmap stored in zarr to a run length encoding json file:
https://gist.github.com/conradry/7376e7504456e9c194638c78d009523e

The only parameter to watch out for is the label_divisor. This is the value of "Max objects per class in 3D" from the napari plugin. Probably this was left as default so either 1,000,000 or 100,000 depending on your version (you'll get an error if you guess incorrectly).

This one accepts a list of json files and runs the consensus algorithm.
https://gist.github.com/conradry/67691f226093539edf60f0e4265191b2

A sneaky secret about the consensus algorithm is that it works for as many segmentations as you give it. (E.g. you can mix-and-match segmentations from different models, downsampling factors, confidence thresholds, etc.)

For help with the parameters see:
https://github.com/volume-em/empanada/blob/01c6e7aa3ad0e3c3334df8b129b0122724b6ad2e/empanada/consensus.py#L348-L377

Let me know if anything is unclear or doesn't work.

Best,
Ryan

@GenevieveBuckley
Copy link
Author

Thanks for the suggestions Ryan!

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