Is your feature request related to a problem? Please describe.
The BrainGlobe brainrender tool is widely used to visualize brain data in a common coordinate space defined by a "brain atlas" (referred to as "atlas-registered" data). However, brainrender is inaccessible to people without programming skills. The brainrender-napari tool aims to make brainrender functionality available to more people through a plugin for the popular open-source graphical image viewer napari.
Although brainrender and brainrender-napari share some functionality, publicly available atlas-registered data is not yet available in brainrender-napari. Users currently cannot browse, download, or visualize atlas-registered datasets (such as neuron morphologies from Allen Brain Atlas, Janelia MouseLight, or NeuroMorpho.Org) directly within the napari interface, which limits the tool's utility for researchers who want to explore and visualize publicly available neuroanatomical data without writing Python code.
Describe the solution you'd like
A Python implementation of a napari widget that allows users to:
-
Browse and Search Public Databases(inspiration and use of https://github.com/brainglobe/morphapi):
- Search for atlas-registered datasets from multiple sources:
- Allen Brain Atlas (mouse neurons)
- Janelia MouseLight
- NeuroMorpho.Org
- Filter datasets by species, brain structure, cell type, and other metadata
- Display search results in an interactive table with dataset information
-
Download Datasets:
- Download datasets directly from external APIs with progress tracking
- Support for multiple data formats (SWC, NRRD, image files)
- Automatic metadata extraction and storage
- Track downloaded vs. available datasets with visual indicators
-
Visualize Datasets in napari:
- Automatically load and visualize downloaded datasets as appropriate napari layer types:
- Points layers for cell positions or individual points
- Shapes/Paths layers for connected neuron morphologies (streamlines)
- Image/Volume layers for volumetric data (projection densities, etc.)
- Maintain all original brainrender-napari features
-
User Interface:
- Integrated widget accessible from napari's plugin menu
- Clean separation between database search and dataset management
- Visual feedback for download progress and visualization status
- Contextual help and informative messages
Describe alternatives you've considered
-
Static Example Files: Instead of dynamic API integration, I considered providing static example files for testing. However, this approach is limiting and doesn't scale to the thousands of publicly available datasets.
-
Manual Dataset Registration: We could require users to manually register datasets with metadata files. However, this adds friction and doesn't leverage existing database APIs that already have rich metadata.
Additional context
Implementation Details
Key Components:
BrainrenderDatasetWidget: Main widget integrating database search and dataset management
DatabaseSearchWidget: UI for searching external databases with filtering capabilities
DatasetManagerView: Interactive table for browsing downloaded and available datasets
morphapi_integration.py: Integration layer for Allen Brain Atlas, MouseLight, and NeuroMorpho.Org APIs
visualize_datasets.py: Utilities for converting downloaded datasets into napari layers with proper coordinate handling
download_datasets.py: Dataset management, download orchestration, and file format handling
Technical Challenges Addressed:
-
File Format Detection: Some APIs return files with incorrect extensions (e.g., JPEG files with .nrrd extension). Implemented robust format detection by reading file headers.
-
Layer Visibility and Ordering: Ensured that when datasets are loaded before or after atlas layers, all layers remain visible and properly ordered (reference background → annotation → dataset layers).
-
3D Rotation Visibility: Configured layers with out_of_slice_display=True to ensure neurons remain visible during 3D rotation and zoom operations with touchpad gestures.
Preserved Original Features:
- All original brainrender-napari functionality remains intact
- Structure label tooltips on hover/zoom
- 3D view toggle (2D/3D display switching)
- Atlas region mesh visualization
- Additional reference image support
- Layer controls and visibility toggles
Testing:
- Unit tests for dataset table models, search results models, download utilities, and visualization functions
- Integration tests for widget initialization and user interactions
- Coordinate transformation validation tests
- File format detection tests
Dependencies Added:
morphapi: For programmatic access to neuron morphology databases
requests: For API interactions
pandas: For data handling in search results
Use Cases
-
Exploratory Analysis: Researchers can quickly browse and visualize neuron morphologies from different brain regions to understand spatial distributions.
-
Teaching and Demonstration: Educators can download and visualize example datasets to demonstrate neuroanatomical concepts without programming.
-
Data Validation: Users can compare their own data with publicly available datasets by loading both in the same napari viewer.
Future Enhancements
Currenlty i am uploading the neuron in the napari space itself and the user can drag it and fit it inside brain atlas, but I am not sure how to do this manually,it would be great if i get direction on this.
Is your feature request related to a problem? Please describe.
The BrainGlobe
brainrendertool is widely used to visualize brain data in a common coordinate space defined by a "brain atlas" (referred to as "atlas-registered" data). However,brainrenderis inaccessible to people without programming skills. Thebrainrender-naparitool aims to make brainrender functionality available to more people through a plugin for the popular open-source graphical image viewer napari.Although
brainrenderandbrainrender-naparishare some functionality, publicly available atlas-registered data is not yet available in brainrender-napari. Users currently cannot browse, download, or visualize atlas-registered datasets (such as neuron morphologies from Allen Brain Atlas, Janelia MouseLight, or NeuroMorpho.Org) directly within the napari interface, which limits the tool's utility for researchers who want to explore and visualize publicly available neuroanatomical data without writing Python code.Describe the solution you'd like
A Python implementation of a napari widget that allows users to:
Browse and Search Public Databases(inspiration and use of https://github.com/brainglobe/morphapi):
Download Datasets:
Visualize Datasets in napari:
User Interface:
Describe alternatives you've considered
Static Example Files: Instead of dynamic API integration, I considered providing static example files for testing. However, this approach is limiting and doesn't scale to the thousands of publicly available datasets.
Manual Dataset Registration: We could require users to manually register datasets with metadata files. However, this adds friction and doesn't leverage existing database APIs that already have rich metadata.
Additional context
Implementation Details
Key Components:
BrainrenderDatasetWidget: Main widget integrating database search and dataset managementDatabaseSearchWidget: UI for searching external databases with filtering capabilitiesDatasetManagerView: Interactive table for browsing downloaded and available datasetsmorphapi_integration.py: Integration layer for Allen Brain Atlas, MouseLight, and NeuroMorpho.Org APIsvisualize_datasets.py: Utilities for converting downloaded datasets into napari layers with proper coordinate handlingdownload_datasets.py: Dataset management, download orchestration, and file format handlingTechnical Challenges Addressed:
File Format Detection: Some APIs return files with incorrect extensions (e.g., JPEG files with .nrrd extension). Implemented robust format detection by reading file headers.
Layer Visibility and Ordering: Ensured that when datasets are loaded before or after atlas layers, all layers remain visible and properly ordered (reference background → annotation → dataset layers).
3D Rotation Visibility: Configured layers with
out_of_slice_display=Trueto ensure neurons remain visible during 3D rotation and zoom operations with touchpad gestures.Preserved Original Features:
Testing:
Dependencies Added:
morphapi: For programmatic access to neuron morphology databasesrequests: For API interactionspandas: For data handling in search resultsUse Cases
Exploratory Analysis: Researchers can quickly browse and visualize neuron morphologies from different brain regions to understand spatial distributions.
Teaching and Demonstration: Educators can download and visualize example datasets to demonstrate neuroanatomical concepts without programming.
Data Validation: Users can compare their own data with publicly available datasets by loading both in the same napari viewer.
Future Enhancements
Currenlty i am uploading the neuron in the napari space itself and the user can drag it and fit it inside brain atlas, but I am not sure how to do this manually,it would be great if i get direction on this.