How ucl/nextbrain works
NextBrain is an interactive browser for correlating patient MRI projections with standard/high-resolution histology and labels. The main workflow starts in the atlas view: users select a patient or atlas location, navigate MRI or histology, and the application updates corresponding coordinates and images. Separate capabilities include MRI projection synchronization, block-to-histology mapping, image-channel and resolution controls, and label overlays. Source excerpts show the atlas orchestration and several image/coordinate calls; relationships for unsampled components are included only where the SOURCE INDEX or README supports them.
Main entry points: AtlasImages.tsx Atlas image coordinator · AtlasOptions.tsx Atlas options · Atlas.tsx Atlas page · AtlasNavigation.tsx Atlas navigation
Components 23
App navigation
- Application routes
ui/src/App.tsx - Home
ui/src/pages/Home.tsx - Atlas page
ui/src/pages/Atlas.tsx
Atlas controls
- Atlas options
ui/src/components/atlas/atlasOptions/AtlasOptions.tsx - Atlas navigation
ui/src/components/atlas/atlasOptions/AtlasNavigation.tsx - Patient selection
ui/src/components/atlas/atlasOptions/PatientSelect.tsx - Image controls
ui/src/components/atlas/atlasOptions - Label display
ui/src/components/atlas/atlasOptions/Label.tsx
Imaging and coordinates
- Atlas image coordinator
ui/src/components/atlas/atlasImages/AtlasImages.tsx - MRI projections
ui/src/components/atlas/atlasImages/MriImages.tsx - Histology images
ui/src/components/atlas/atlasImages/HistologyImages.tsx - Image layers
ui/src/components/atlas/atlasImages - Histology scrollbar
ui/src/components/atlas/scrollbars/Scrollbars.tsx - MRI coordinate transforms
ui/src/components/utils/calculateMriImageCoords.ts - Histology coordinate mapping
ui/src/components/utils/calculateHistologyImageCoords.ts - Matrix access and math
ui/src/components/utils/getMatrix.ts - Histology label lookup
ui/src/components/utils/histologyLabelParser.ts - NPZ data parser
ui/src/components/utils/npzParser.ts - Coordinate and image models
ui/src/models - Block finder utility
src/block_finder.py
Shared runtime
- Loading and errors
ui/src/components/shared/LoadingSpinner.tsx
Other components
- Atlas user
- Remote atlas assets
Connections 31
- Atlas user → Application routes: opens
- Application routes → Home: routes to
ui/src/App.tsx - Application routes → Atlas page: routes to
ui/src/App.tsx - Atlas user → Atlas page: browses
- Atlas page → Atlas image coordinator: renders
ui/src/pages/Atlas.tsx - Atlas page → Atlas options: renders
ui/src/pages/Atlas.tsx - Atlas page → Remote atlas assets: fetches dimensions
ui/src/pages/Atlas.tsx - Atlas options → Atlas navigation: renders
ui/src/components/atlas/atlasOptions/AtlasOptions.tsx - Atlas options → Patient selection: renders
ui/src/components/atlas/atlasOptions/AtlasOptions.tsx - Atlas options → Image controls: renders
ui/src/components/atlas/atlasOptions/AtlasOptions.tsx - Atlas options → Label display: renders
ui/src/components/atlas/atlasOptions/AtlasOptions.tsx - Atlas navigation → Remote atlas assets: fetches ontology
ui/src/components/atlas/atlasOptions/AtlasNavigation.tsx - Atlas navigation → Matrix access and math: uses
ui/src/components/atlas/atlasOptions/AtlasNavigation.tsx - Atlas navigation → Atlas image coordinator: provides navigation coordinates
- Atlas image coordinator → MRI projections: renders
ui/src/components/atlas/atlasImages/AtlasImages.tsx - Atlas image coordinator → Histology images: renders
ui/src/components/atlas/atlasImages/AtlasImages.tsx - Atlas image coordinator → Histology scrollbar: renders
ui/src/components/atlas/atlasImages/AtlasImages.tsx - Atlas image coordinator → MRI coordinate transforms: calculates MRI coordinates
ui/src/components/atlas/atlasImages/AtlasImages.tsx - Atlas image coordinator → Histology coordinate mapping: calculates histology coordinates
ui/src/components/atlas/atlasImages/AtlasImages.tsx - Atlas image coordinator → Histology label lookup: looks up labels
ui/src/components/atlas/atlasImages/AtlasImages.tsx - Atlas image coordinator → Matrix access and math: loads matrices
ui/src/components/atlas/atlasImages/AtlasImages.tsx - Histology images → Image layers: renders
ui/src/components/atlas/atlasImages/HistologyImages.tsx - Histology images → Remote atlas assets: fetches image layers
ui/src/components/atlas/atlasImages/HistologyImages.tsx - Histology images → Atlas image coordinator: sends click coordinates
ui/src/components/atlas/atlasImages/HistologyImages.tsx - Histology label lookup → NPZ data parser: loads label arrays
ui/src/components/utils/histologyLabelParser.ts - Histology label lookup → Remote atlas assets: loads label data
ui/src/components/utils/histologyLabelParser.ts - Matrix access and math → Remote atlas assets: loads matrices
ui/src/components/utils/getMatrix.ts - Atlas image coordinator → Loading and errors: shows loading and errors
ui/src/components/atlas/atlasImages/AtlasImages.tsx - Atlas image coordinator → Coordinate and image models: uses coordinate state
ui/src/components/atlas/atlasImages/AtlasImages.tsx - MRI projections → Coordinate and image models: uses MRI coordinates
ui/src/components/atlas/atlasImages/MriImages.tsx - Histology scrollbar → Coordinate and image models: uses histology coordinates
ui/src/components/atlas/scrollbars/Scrollbars.tsx