Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Make sure metadata is attached to loaded napari Layers #38

Merged
merged 7 commits into from
Jun 29, 2022

Conversation

dstansby
Copy link
Member

@dstansby dstansby commented Jun 24, 2022

Description

This updates the way layers are added to make sure the brainreg metadata is stored in the layers. This is done by using the following code to add the layers:

for layer in layers:
    viewer.add_layer(napari.layers.Layer.create(*layer))

Why is this PR needed?
A widget that takes brainreg output as input (e.g. brainglobe/cellfinder-napari#117) needs access to this metadata.

How has this PR been tested?

I've extended the current test to check for the right layers being added, and that metadata is stored on the labels layer.

Is this a breaking change?

No

Does this PR require an update to the documentation?

If any features have changed, or have been added. Please explain how the documentation has been updated (and link to the associated PR). See here for details.

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality (unit & integration)
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

@deprecated-napari-hub-preview-bot
Copy link

deprecated-napari-hub-preview-bot bot commented Jun 24, 2022

Preview page for your plugin is ready here:
https://preview.napari-hub.org/brainglobe/brainreg-napari/38
Updated: 2022-06-27T15:07:24.920238

@dstansby dstansby marked this pull request as ready for review June 24, 2022 13:45
@dstansby dstansby requested a review from a team June 24, 2022 13:46
@dstansby dstansby force-pushed the brainreg-metadata branch from f67d380 to e44a051 Compare June 27, 2022 09:54
@codecov-commenter
Copy link

codecov-commenter commented Jun 27, 2022

Codecov Report

Merging #38 (af19744) into master (2779b78) will increase coverage by 8.83%.
The diff coverage is 97.29%.

@@            Coverage Diff             @@
##           master      #38      +/-   ##
==========================================
+ Coverage   59.25%   68.09%   +8.83%     
==========================================
  Files           5        5              
  Lines         189      210      +21     
==========================================
+ Hits          112      143      +31     
+ Misses         77       67      -10     
Impacted Files Coverage Δ
brainreg_napari/register.py 58.25% <95.23%> (+12.89%) ⬆️
brainreg_napari/tests/test_brainreg_napari.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2779b78...af19744. Read the comment docs.

@dstansby dstansby force-pushed the brainreg-metadata branch from a7e5aea to af19744 Compare June 27, 2022 15:03
labels = viewer.layers[1]
assert isinstance(labels, napari.layers.Labels)
assert labels.name == "example_mouse_100um"
for key in ["orientation", "atlas"]:
Copy link
Contributor

Choose a reason for hiding this comment

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

tuple marginally faster here

@dstansby dstansby merged commit bf8b5ec into brainglobe:master Jun 29, 2022
@dstansby dstansby deleted the brainreg-metadata branch June 29, 2022 09:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants