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

Add offset to account separated scales #11

Merged
merged 2 commits into from
Nov 17, 2023

Conversation

andy-sweet
Copy link
Collaborator

Given the way the tomograms were downsampled, the visualized extent of the different multi-scale level volumes should match. Also given napari's preference, the visualized extent of the volumes should start at (-0.5, -0.5, -0.5).

This PR adds an extra offset via Layer.translate to ensure that both these things happen. The related bug explains why the annotations previously looked slightly offset at the lower resolution scales.

Thanks to @kephale for helping to catch and debug this!

@andy-sweet andy-sweet added the bug Something isn't working label Oct 23, 2023
@@ -133,6 +143,10 @@ def _loadTomogram(
image_attrs["scale"] = tuple(
resolution.scale * s for s in image_attrs["scale"]
)
image_translate = image_attrs.get("translate", (0,) * len(image_attrs["scale"]))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@kephale : I believe the tomograms don't have translations at the moment, but this assumes they could to a bit of future-proofing. What do you think?

Copy link

Choose a reason for hiding this comment

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

I think this needs to be sensitive to the downsampling method (average over bin, top-left corner, etc.). Since we're processing these zarrs, I guess we can make an assumption about the methd...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I'm fine assuming the method here for now.

OME-NGFF does have a place for downsampling method, but looks like we don't currently fill it.

@codecov
Copy link

codecov bot commented Oct 23, 2023

Codecov Report

Merging #11 (003552b) into main (2f0bff4) will decrease coverage by 0.43%.
The diff coverage is 40.00%.

@@            Coverage Diff             @@
##             main      #11      +/-   ##
==========================================
- Coverage   87.34%   86.91%   -0.43%     
==========================================
  Files          13       13              
  Lines         553      558       +5     
==========================================
+ Hits          483      485       +2     
- Misses         70       73       +3     
Files Coverage Δ
src/napari_cryoet_data_portal/_open_widget.py 81.31% <40.00%> (-2.41%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link

@kephale kephale left a comment

Choose a reason for hiding this comment

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

LGTM

@andy-sweet andy-sweet merged commit 62bb220 into chanzuckerberg:main Nov 17, 2023
9 of 11 checks passed
@andy-sweet andy-sweet deleted the fix-multiscale-offset branch November 17, 2023 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants