GithubHelp home page GithubHelp logo

brainglobe / brainrender-napari Goto Github PK

View Code? Open in Web Editor NEW
19.0 19.0 1.0 193 KB

A napari plugin to render BrainGlobe atlases and associated data as layers.

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%

brainrender-napari's Introduction

BrainGlobe

General information, resources, high-level issues and dicussions for the BrainGlobe project. For more details see brainglobe.info. For developer meeting summaries, see the Discussions tab - developer meetings are open to anyone, join the Zulip chat to participate.

brainrender-napari's People

Contributors

adamltyson avatar alessandrofelder avatar dstansby avatar k-meech avatar pre-commit-ci[bot] avatar willgraham01 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

willgraham01

brainrender-napari's Issues

[BUG] mesh default colouring mostly shows as white

Describe the bug
Almost all mesh-adding to napari results in a white-coloured mesh.

To Reproduce
Add meshes to napari via the atlas viewer widget.

Expected behaviour
Default colour specified in structures.json should propagate to napari mesh vertex colouring when a mesh is added.

Additional context
This happens because we are missing a conversion from RGB (in structures.json) to rgb (what napari expects).

Windows tests are super slow suddenly.

Something is wrong with them (Linux and Mac tests take < 10mins, but Windows takes 1h+!)
Opening this so we can merge PRs that pass all tests other than the Windows one in good conscience, because we'll remember to address this.

[BUG] hacky tooltip can persist sometimes

Describe the bug
Moving the mouse too quickly can leave the hacky tooltip from #85 lying around.

Additional context
Maybe fixable by adding a callback to any layer (selection) change to hide all tooltips

Initial user feedback

This issue will be addressed when we've

  • asked users at SWC and other friends to try brainrender-napari 0.0.1 and the relevant tutorial on the website.
  • taken their feedback and organised it into new issues

Cache atlas details

It's a bit laggy moving from one atlas to another. I guess this is because the atlas class needs to be initiated. Until bg-atlasapi V2 is complete, it would be useful to cache atlas details to speed things up.

Ideas for the integration of BrainGlobe atlases within napari

Currently BrainGlobe atlases are used by napari plugins (e.g. brainreg, brainreg-segment), but these are not accessible by napari plugins directly (only by using bg-atlasapi in the plugin code). It would be useful to be able to load, visualise and manipulate these atlases for many reasons, e.g.:

  • To visualise atlas data
  • To use the atlases as a target for third party registration libraries
  • To define coordinate spaces for other analysis tools

As a first pass, my idea is to create a napari plugin that will include some of the functionality of the brainglobe atlas API and CLI, including:

  • Query available atlases
  • Inspect atlas metadata
  • Load (and visualise) atlases

bg-atlasapi represents atlases as an abstract object. It would also be useful to do the same within napari. i.e. represent all the information within an atlas object as a "thing". It won't be a new layer type, but as close to this as possible (layer group?).

A sketch of my idea:
brainglobe-napari-sketch

cc @alessandrofelder @dstansby

[Feature] Make downloading an atlas robust

While an atlas is being downloaded, double-clicking on said atlas should not break anything. I'm not sure it does currently, but I think it might?

Describe the solution you'd like
Full robustness and good UI for this. Maybe disabling and greying out the row of the atlas currently being download. Related to #62

Describe alternatives you've considered
None yet, but open to suggestions

Additional context
Continuation of #7

Display more columns in Atlas table view

bg-atlas API shows more info when calling show_atlases but this info is generated on the fly by the function, and not accessible directly elsewhere (so maybe that should be refactored before tackling this). That info should also be displayed and kept up-to-date in the Atlas viewer's table view.

[meta-issue] waiting on napari

A place to track where we are waiting on changes in napari

  • ability to add group layers (see lower left corner of image in #1)
  • ability to add custom viewer tooltips (see #85 )
  • ability to add callbacks to layer deletion (should be possible via napari/napari#5967, but not in a stable release at time of writing) so we can reset hacky tooltips (may not be needed if we get custom viewer tooltips earlier) - see #88

Think about exposing a Python API

As this package accrues more and more features, it would be useful to be able to build up a scene without necessarily using the GUI. I think two features would be useful to think about:

  • Expose a Python API
  • Provide functionality to save the current state of the scene e.g. layers loaded
    • Potentially also export a script to recreate the scene

How to best let (advanced) users customise user data and config locations?

IIUC there are currently several ways to customise where downloaded atlases are stored

  • by passing brainglobe_dir as an argument to the BrainGlobeAtlas constructor
  • by passing config_dir as an argument to the BrainGlobeAtlas constructor
  • by setting the BRAINGLOBE_CONFIG_DIR environmental variable and storing a config file there.

This has some consequences that can

  • if both brainglobe_dir and config_dir are passed, brainglobe_dir takes precendence (I think, but this is undocumented!)
  • if brainglobe_dir is passed to BrainGlobeAtlas() (and therefore an atlas is downloaded), that atlas will not be part of the output of get_downloaded_versions().
  • it's unclear how widgets should best deal with customisable user data and config folders.

Additionally, code interacting with the bg_atlasapi API will need to remember to pass the right arguments, making this susceptible to having to change things in many different places if bg_atlasapi changes.

  • we should also think about, and document, backwards compatibility and/or migration if we do decide on a new way of doing this.

This is possibly a more-fleshed-out duplicate of brainglobe/brainglobe-atlasapi#150 and should replace it in that repo?

Allow user to hover over a brain region and see the metadata.

This is currently implemented within brainreg-segment:

https://github.com/brainglobe/brainreg-segment/blob/a84d4b2fab53c256590b79d57beb1eac5810ef0f/brainreg_segment/segment.py#L91-L105

Ideally this would:

  1. use tooltips instead (brainglobe/brainglobe-segmentation#89)
  2. Be visible regardless of what layers are added/visible (as long as one is!), not just the annotations layer

I think for 1. the metadata would have to be added to the annotation layer itself

Avoid tests messing with user installation of BG

For the tests, maybe the brainglobe atlas directory should be set to somewhere in tmp_dir?

The syntax is:

atlas = BrainGlobeAtlas("atlas_name", brainglobe_dir="/path/to/dir")

We could therefore pass brainglobe_dir as a fixture to the relevant methods during tests so that the tests don't interfere with any existing brainglobe installation. We could even detect being in a GitHub actions environment and pass None in this case to test everything in the default location.

Implement logic to deal with new atlas versions

This issue will be addressed once

  • the atlas table view widget shows the columns drawn in the top right of image below (re-used from #1 )
  • tests have been added that check the updating-an-atlas functionality

brainrender napari sketch

Cache atlases in GHA workflow

  • at least some of them, so we test that widget triggers download on at least one.
  • will help with accelerating tests.

Decide on naming.

brainrender is pretty popular, has a published paper, and Fede has spent a long time working on it. For this reason I think the napari port of BrainGlobe's 3D visualisation should keep the brainrender name. I can see two options:

  • Rename this plugin to brainrender-napari and any other (non-visualisation) functionality lives elsewhere
  • Keep the brainrender-napari name as a general plugin, but make sure there's a widget or something that is specifically named brainrender.

Any thoughts @alessandrofelder

Make plugin robust to lack of internet connection

Currently opening this widget offline crashes, because get_all_atlases_lastversions() errors without an internet connection. We should be robust to this case, and display a warning and local versions of downloaded atlases instead!

[BUG] Clicking on name of structure causes crash

Describe the bug
Trying to add a structure via its name instead of its acronym crashes

To Reproduce

  • open brainrender napari
  • select a downloaded atlas
  • check "show structure names" checkbox
  • double-click on name column somewhere

Expected behaviour

Log file
n/a

Computer used (please complete the following information):
not relevant here

Additional context
Fix is to change StructureView.selected_structure_name() to return the data in sibling index at column 0

Integrate napari layer group into atlas viewer plugin

Currently, we just add each part of the atlas we are interested in as a separate layer to napari. In the future, the napari representation of a BG Atlas should be a layer group containing all the layers of one atlas together.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.