Skip to content

Refactoring #232

@HARSHDIPSAHA

Description

@HARSHDIPSAHA

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

Yes. The codebase currently contains a significant amount of duplicate code related to the structure tree data models.

Specifically, the classes StructureTreeItem and StructureTreeModel are defined almost identically in two separate files:

  • brainrender_napari/widgets/structure_view.py
  • brainrender_napari/data_models/structure_tree_model.py

This introduces a clear maintenance risk. If a bug is fixed or a feature is added to one implementation, the same change must be manually applied to the other. This is error-prone and likely to result in inconsistent behavior over time.


Describe the solution you'd like

I propose refactoring the codebase to consolidate the structure tree model into a single source of truth.

Refactor Plan

  • Keep StructureTreeItem and StructureTreeModel definitions in
    brainrender_napari/data_models/structure_tree_model.py
    as the canonical implementation

  • Remove the redundant class definitions from:
    brainrender_napari/widgets/structure_view.py

  • Update structure_view.py to import the shared model instead:

from brainrender_napari.data_models.structure_tree_model import StructureTreeModel

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions