brainglobe / brainglobe/brainrender-napari

[Feature]Search / Filter Bar for Structure Tree View

Open
#231 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
24
Forks
22
Avg merge
15h 3m
Merged PRs (30d)
1

Description

## Is your feature request related to a problem? Please describe.

Yes. Navigating the Structure Tree View is currently a significant bottleneck for users, especially when working with high-resolution atlases which contain a lot brain structures nested in a deep hierarchy.

Users currently have to manually expand multiple layers of folders (e.g., `root -> grey -> cerebrum -> ...`) to find a specific region of interest (e.g., **"Hippocampus"** or **"TH"**). This process is tedious, error-prone, and difficult for users who may know the region name or acronym but not its exact location in the specific atlas ontology.

---

## Describe the solution you'd like

I propose adding a **Search / Filter Bar** above the Structure Tree View widget to allow users to quickly find regions by **name or acronym**.

### Proposed Implementation

#### UI
- Add a `QLineEdit` widget above the Structure Tree in `BrainrenderViewerWidget`
- Placeholder text: `search region(name or acronym)...`

#### Logic
- Wrap the existing `StructureTreeModel` in a `QSortFilterProxyModel`

#### Behavior
- As the user types (e.g., `TH` or `Thalamus`), the tree automatically filters to show only matching nodes
- Parent nodes of matching items automatically expand so results are always visible
- Matching should support:
- Acronym (e.g., `VISp`)
- Full region name (e.g., `Primary visual area`)
- Filtering should be **case-insensitive** and support **partial matches**

---

## Describe alternatives you've considered

### Flat List
Displaying a flat list of all brain regions instead of a tree. While this improves searchability, it removes the valuable hierarchical context provided by the tree structure.

---

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect BrainrenderViewerWidget and the existing StructureTreeModel to locate the Structure Tree View implementation. Start by tracing how the tree is built, then evaluate the QLineEdit and QSortFilterProxyModel behavior described in the issue. Done means case-insensitive partial matches by region name or acronym, with matching parents expanded and the search bar shown above the tree.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.