Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ ipython_config.py
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock

# uv
uv.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Thank you for your interest in contributing to PixelMap!

### Bug Reports

Found a bug? Please [open an issue](https://github.com/m-beau/channelmap_generator/issues) with:
Found a bug? Please [open an issue](https://github.com/m-beau/pixelmap/issues) with:

- A clear, descriptive title
- Steps to reproduce the issue
Expand All @@ -15,7 +15,7 @@ Found a bug? Please [open an issue](https://github.com/m-beau/channelmap_generat

### Feature Requests

Have an idea? [Open an issue](https://github.com/m-beau/channelmap_generator/issues) describing the problem and your proposed solution.
Have an idea? [Open an issue](https://github.com/m-beau/pixelmap/issues) describing the problem and your proposed solution.

### Pull Requests

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ cd pixelmap
uv run pixelmap # installs dependencies automatically and launches the GUI
```

Also available via [pip, conda, or Docker](https://pixelmap.readthedocs.io/en/latest/getting-started.html).
Also available via [pip, conda, or Docker](https://pixelmap-neuropixels.readthedocs.io/en/latest/getting-started.html).

## Quick Start

Expand Down Expand Up @@ -65,7 +65,7 @@ imro_list = cmg.generate_imro_channelmap(
cmg.save_to_imro_file(imro_list, "my_channelmap.imro")
```

See the [full documentation](https://pixelmap.readthedocs.io) for the complete API reference, GUI guide, preset reference, and troubleshooting.
See the [full documentation](https://pixelmap-neuropixels.readthedocs.io) for the complete API reference, GUI guide, preset reference, and troubleshooting.

## Supported Probes

Expand Down
18 changes: 9 additions & 9 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ This guide is for contributors and developers who want to work on PixelMap.
### Installation

```bash
git clone https://github.com/m-beau/channelmap_generator.git
cd channelmap_generator
git clone https://github.com/m-beau/pixelmap.git
cd pixelmap

# Install with dev dependencies
uv sync
Expand All @@ -26,27 +26,27 @@ pip install -e ".[dev]"

```bash
# Launch the GUI
uv run cmap_gui
uv run pixelmap

# Or if installed with pip
cmap_gui
pixelmap
```

## Architecture Overview

```
channelmap_generator/
pixelmap/
├── __init__.py # Public API exports
├── backend.py # Core electrode selection logic
├── constants.py # Probe configurations and presets
├── types.py # Data classes (Electrode, etc.)
├── gui/
│ ├── gui.py # NiceGUI frontend
│ ├── gui.py # Panel frontend
│ ├── app_util.py # GUI helper functions
│ └── assets/ # Images and static files
├── utils/
│ └── imro.py # IMRO file reading/writing
└── wiring_maps/ # CSV files defining electrode-ADC wiring
└── wiring_maps/ # CSV/JSON files defining electrode-ADC wiring
```

### Key Modules
Expand All @@ -73,7 +73,7 @@ channelmap_generator/
pytest

# Run with coverage
pytest --cov=channelmap_generator
pytest --cov=pixelmap

# Run specific test file
pytest tests/test_backend.py
Expand Down Expand Up @@ -128,4 +128,4 @@ To contribute:
3. Make your changes and run tests: `pytest`
4. Push to your fork and open a pull request **to the `dev` branch**

See [CONTRIBUTING.md](https://github.com/m-beau/channelmap_generator/blob/main/CONTRIBUTING.md) for full guidelines on reporting bugs, requesting features, and code style.
See [CONTRIBUTING.md](https://github.com/m-beau/pixelmap/blob/main/CONTRIBUTING.md) for full guidelines on reporting bugs, requesting features, and code style.
30 changes: 21 additions & 9 deletions paper/paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ tags:
- Neuroscience
- Electrophysiology
- Neuropixels
authors:"fixe paper
- Panel
authors:
- name: Maxime Beau
orcid: 0000-0002-8907-6612
corresponding: true
Expand Down Expand Up @@ -39,21 +40,21 @@ PixelMap is a browser-based application for creating custom channelmaps for Neur

Neuropixels probes have revolutionised systems neuroscience by enabling simultaneous recordings from hundreds of neurons across multiple brain regions at any depth [@jun2017; @beau2021; @steinmetz2021; @bondy2024; @ye2025; @beau2025]. However, configuring these probes presents challenges. Limited by the number of readout channels and integrated analogue-to-digital converters (ADCs), Neuropixels probes contain 960–5120 electrodes but can only record from 384–1536 channels simultaneously (Table 1). Users must therefore select a subset of electrodes to activate for each recording, a "channelmap". Researchers often need to create custom channelmaps to target specific brain regions, and sometimes must adjust them rapidly based on feedback from ongoing recordings. Because the electrode-to-ADC wiring follows complex, probe version-dependent patterns, manual channelmap design is error-prone and time-consuming.

[SpikeGLX](https://billkarsh.github.io/SpikeGLX) is the reference acquisition software for Neuropixels recordings and uses the `.imro` file format to encode channelmaps. While SpikeGLX provides tools to edit channelmaps, it requires a desktop app, comes with limited preset channelmaps, and does not easily allow selection of fully arbitrary electrode geometries or anatomical-guided design. Other acquisition software like Open Ephys also support `.imro` files but also require desktop app and does not allow anatomical-guided design. Researchers often resort to hand-engineering `.imro` files or using custom scripts, which can lead to errors and inefficiencies.
[SpikeGLX](https://billkarsh.github.io/SpikeGLX) is the reference acquisition software for Neuropixels recordings and uses the `.imro` file format to encode channelmaps. While SpikeGLX provides tools to edit channelmaps, it requires a desktop app, comes with limited preset channelmaps, and does not easily allow selection of fully arbitrary electrode geometries or anatomical-guided design. Other acquisition software like Open Ephys also support `.imro` files but also require desktop installation and do not allow anatomical-guided design. Researchers often resort to hand-engineering `.imro` files or using custom scripts, which can lead to errors and inefficiencies.

PixelMap addresses these needs by:

1. **Being available on any machine installation-free**: The tool is available both as a browser-based web application at [https://pixelmap.pni.princeton.edu](https://pixelmap.pni.princeton.edu), as a Docker image, and a Python package.
2. **Visualising wiring constraints interactively**: When users select electrodes, the interface immediately shows which other electrodes become unavailable (marked in black) due to shared ADC lines, preventing invalid configurations.
3. **Supporting arbitrary electrode geometries**: Users can select electrodes by choosing from common preset geometries, entering electrode ranges as text for reproducibility, directly clicking or dragging on the probe visualization, or loading pre-existing `.imro` files. These four selection methods are fully intercompatible and can be combined.
2. **Visualising in real time Neuropixels wiring constraints, interactively**: When users select electrodes, the interface immediately shows which other electrodes become unavailable (marked in black) due to shared ADC lines, preventing invalid configurations.
3. **Supporting arbitrary electrode geometries**: Users can select electrodes by choosing from common preset geometries, entering electrode ranges as text for reproducibility, directly clicking or dragging on the probe visualization, or loading pre-existing `.imro` files. These four selection methods are fully intercompatible and can be combined. See the [documentation](https://pixelmap-neuropixels.readthedocs.io/en/latest/) for details on supported preset geometries and selection methods, in particular the five different dragging boxes that enable great flexibility in electrode selection.
4. **Guiding channelmap design with activity and anatomy information**: Users can overlay a SpikeGLX activity survey heatmap to identify the most spiking-active channels after probe implantation, and independently overlay anatomical region boundaries from any brain atlas available through BrainGlobe [@claudi2020] to plan recordings around specific brain regions of interest.

| Probe Version | Physical Channels | Simultaneously Recordable Channels |
|---------------|-------------------|-------------------------------------|
| Neuropixels 1.0 | 960 | 384 |
| Neuropixels 2.0 (single shank) | 1,280 | 384 |
| Neuropixels 2.0 (4-shank) | 5,120 (1,280 per shank) | 384 |
| Neuropixels 2.0 Quad Base | 5,120 (1,280 per shank) | 1,536 |
| Neuropixels 2.0 Quad Base | 5,120 (1,280 per shank) | 1,536 (384 max per shank)|

**Table 1**: Number of physical and simultaneously addressable electrodes across Neuropixels probe versions supported by PixelMap.

Expand All @@ -69,7 +70,17 @@ Third, the **core logic** at `./backend.py` implements the constraint-checking a

Finally, the **graphical user interface** at `./gui/gui.py` was built with Holoviz Panel. The interface provides real-time visualisation of the probe layout with electrodes colour-coded by selection state (available in grey, selected in red, or unavailable in black). The interface supports the four selection modes described above, including interactive single-click and drag-box selection and deselection. Five distinct box tools cover the most common channelmap patterns: a standard selection box, a deselection box, a zigzag (checkerboard) selector for dense interleaved coverage, an interleaved-pairs selector that selects alternating row pairs, and a "deselect dependents" box that identifies and releases the selected electrodes that are blocking a target region of unavailable electrodes. User interactions trigger immediate recalculation of available electrodes, ensuring users receive instant feedback about constraint violations.

The GUI also supports two powerful overlay modes displayed alongside the probe visualization. The **activity survey overlay** reads a per-contact activity file exported from SpikeGLX and renders a coloured bar beside each electrode, allowing users to identify channels with high spiking activity (typically grey matter) and adjust their channelmap accordingly. The **anatomical overlay** computes the brain region traversed by each electrode along a user-specified insertion trajectory—accounting for pitch, yaw, and multi-shank orientation—using any atlas registered in the BrainGlobe atlas API [@claudi2020]. It renders colour-coded depth bands on the probe and displays three orthogonal atlas slices (sagittal, coronal, horizontal) through the probe tip. Both overlays are preserved when downloading the PDF rendering of the channelmap, providing a complete experimental record.
Notably, the GUI supports two powerful overlay modes displayed alongside the probe visualization. The **activity survey overlay** reads a per-contact activity file exported from SpikeGLX and renders a coloured bar beside each electrode, allowing users to identify channels with high spiking activity (typically grey matter) and adjust their channelmap accordingly. The **anatomical overlay** computes the brain region traversed by each electrode along a user-specified insertion trajectory—accounting for pitch, yaw, and multi-shank orientation—using any atlas registered in the BrainGlobe atlas API [@claudi2020]. It renders colour-coded depth bands on the probe and displays three orthogonal atlas slices (sagittal, coronal, horizontal) through the probe tip. Both overlays are preserved when downloading the PDF rendering of the channelmap, providing a complete experimental record.

## Forward Compatibility and Extensibility

PixelMap's architecture is designed to accommodate new hardware and atlas resources with minimal effort, lowering the barrier for both maintainers and contributors.

**Probe support.** Wiring constraints are encoded as standalone CSV files (`wiring_maps/*.csv`), one per probe type, and probe metadata (part numbers, readout counts, electrode pitches) is derived directly from the authoritative JSON maintained by SpikeGLX developer Bill Karsh. Adding support for a new Neuropixels probe released by IMEC requires only a new wiring CSV and an updated entry in the Bill Karsh JSON—no changes to the constraint-checking backend are needed, since it operates generically over hash-map lookups.

**Atlas support.** The anatomical overlay is built on the BrainGlobe Atlas API [@claudi2020], which provides a growing catalogue of brain atlases across species. Any atlas registered with BrainGlobe is automatically available to PixelMap users without code changes. In the Docker deployment, the two most widely used atlases—Allen Mouse Brain Common Coordinate Framework at 25 µm (`allen_mouse_25um`) and Waxholm Space Atlas of the Sprague Dawley Rat at 39 µm (`whs_sd_rat_39um`)—are pre-downloaded into the container image so they are available instantly. Additional atlases are downloaded on demand: when a user selects an atlas that has not yet been cached, the button label changes to "Download & compute atlas" to indicate a one-time download is in progress. Downloaded atlases are stored in a shared Docker volume (`brainglobe_cache`) that persists across container restarts, so each atlas only needs to be fetched once and is then available to all subsequent users of the server.

**Contributor extensibility.** The codebase separates concerns into independent modules—anatomy, wiring, GUI, and backend — with clean interfaces between them. New selection presets can be added to the constants module, new overlay types can follow the pattern established by the activity-survey and anatomy overlays, and the GUI layer can be extended or replaced without modifying the core constraint logic. This modular design, together with comprehensive tests and a contributor guide (`CONTRIBUTING.md`), is intended to make it straightforward for the community to contribute features that serve their specific experimental workflows.

![PixelMap's browser-based graphical user interface.\
**Center:** Main panel featuring the probe's physical layout with one or four shanks that exhibit the 960 (Neuropixels 1.0) or 1,280 (Neuropixels 2.0) physical electrodes per shank to be selected from. Electrodes available for selection are light grey, selected electrodes turn red, and electrodes that become unavailable due to hardware wiring constraints turn black. In this example, 384 electrodes have been selected (matching the maximum simultaneous recording capacity), with a distributed pattern across multiple banks, illustrating that PixelMap allows selection of arbitrary channelmap geometries. An anatomical overlay (colored depth bands with region labels) and is shown as an optional layers that guides channelmap design.\
Expand Down Expand Up @@ -107,9 +118,10 @@ AI assistance was used for (1) optimization suggestions and documentation improv
| | Maxime Beau | Julie Fabre | Christian Tabedzki | Jorge Janar | Carlos D. Brody |
|------------------------------------|:-----------:|:-----------:|:------------------:|:-----------:|:---------------:|
| Conceptualisation | X | | | | |
| Backend and GUI | X | | | | |
| Anatomical overlay | | X | | | |
| Activity survey overlay | | | | X | |
| Backend | X | | | | |
| GUI - general | X | X | | | |
| GUI - Anatomical overlay | | X | | | |
| GUI - Activity survey overlay | | | | X | |
| App hosting | | | X | | |
| Supervision and funding | | | | | X |

Expand Down
Binary file modified paper/paper.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion pixelmap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

from .backend import *

__version__ = "1.0.3"
__version__ = "1.0.5"
__author__ = "Maxime Beau"
__email__ = "maxime@princeton.edu"
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pixelmap = "pixelmap.gui.app_util:main"

[project.urls]
Homepage = "https://github.com/m-beau/pixelmap"
Documentation = "https://pixelmap.readthedocs.io"
Documentation = "https://pixelmap-neuropixels.readthedocs.io"
Repository = "https://github.com/m-beau/pixelmap"
Issues = "https://github.com/m-beau/pixelmap/issues"

Expand All @@ -54,9 +54,10 @@ include = ["pixelmap*"]
[tool.setuptools.package-data]
pixelmap = [
"wiring_maps/*.csv",
"wiring_maps/*.json",
"wiring_maps/*.pkl",
"gui/*/*.png",
"gui/*/*.svg",
"example_layouts/*.pdf",
]

[project.optional-dependencies]
Expand Down
Loading
Loading