Skip to content

Commit

Permalink
Rename to brainglobe-segmentation (#139)
Browse files Browse the repository at this point in the history
* Revert "Mark as deprecated and add import warning"

This reverts commit e6bf8e2.

* Rename source folder

* Fix test imports

* Update package metadata

* Another source code pass
  • Loading branch information
willGraham01 committed Nov 6, 2023
1 parent 04bc1a2 commit a3d0d0c
Show file tree
Hide file tree
Showing 39 changed files with 89 additions and 92 deletions.
41 changes: 18 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,39 @@
# This package is deprecated!

Please use [`brainglobe-segmentation` instead](https://github.com/brainglobe/brainglobe-segmentation).

The old README can be found below.

---

[![Python Version](https://img.shields.io/pypi/pyversions/brainreg-segment.svg)](https://pypi.org/project/brainreg-segment)
[![PyPI](https://img.shields.io/pypi/v/brainreg-segment.svg)](https://pypi.org/project/brainreg-segment)
[![Wheel](https://img.shields.io/pypi/wheel/brainreg-segment.svg)](https://pypi.org/project/brainreg-segment)
[![Development Status](https://img.shields.io/pypi/status/brainreg-segment.svg)](https://github.com/brainglobe/brainreg-segment)
[![Tests](https://img.shields.io/github/workflow/status/brainglobe/brainreg-segment/tests)](
https://github.com/brainglobe/brainreg-segment/actions)
[![codecov](https://codecov.io/gh/brainglobe/brainreg-segment/branch/master/graph/badge.svg?token=WP9KTPZE5R)](https://codecov.io/gh/brainglobe/brainreg-segment)[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black)
[![Python Version](https://img.shields.io/pypi/pyversions/brainglobe-segmentation.svg)](https://pypi.org/project/brainglobe-segmentation)
[![PyPI](https://img.shields.io/pypi/v/brainglobe-segmentation.svg)](https://pypi.org/project/brainglobe-segmentation)
[![Wheel](https://img.shields.io/pypi/wheel/brainglobe-segmentation.svg)](https://pypi.org/project/brainglobe-segmentation)
[![Development Status](https://img.shields.io/pypi/status/brainglobe-segmentation.svg)](https://github.com/brainglobe/brainglobe-segmentation)
[![Tests](https://img.shields.io/github/workflow/status/brainglobe/brainglobe-segmentation/tests)](
https://github.com/brainglobe/brainglobe-segmentation/actions)
[![codecov](https://codecov.io/gh/brainglobe/brainglobe-segmentation/branch/master/graph/badge.svg?token=WP9KTPZE5R)](https://codecov.io/gh/brainglobe/brainglobe-segmentation)[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black)
[![Twitter](https://img.shields.io/twitter/follow/brain_globe?style=social)](https://twitter.com/brain_globe)

# brainreg-segment
# brainglobe-segmentation

Segmentation of 1/2/3D brain structures in a common anatomical space

`brainreg-segment` is a companion to [`brainreg`](https://github.com/brainglobe/brainreg) allowing manual segmentation of regions/objects within the brain (e.g. injection sites, probes etc.) allowing for automated analysis of brain region distribution, and visualisation (e.g. in [brainrender](https://github.com/brainglobe/brainrender)).
`brainglobe-segmentation` is a companion to [`brainreg`](https://github.com/brainglobe/brainreg) allowing manual segmentation of regions/objects within the brain (e.g. injection sites, probes etc.) allowing for automated analysis of brain region distribution, and visualisation (e.g. in [brainrender](https://github.com/brainglobe/brainrender)).
`brainglobe-segmentation` is the successor to [`brainreg-segment`](https://github.com/brainglobe/brainreg-segmentation).

`brainreg-segment` and `brainreg` were developed by [Adam Tyson](https://github.com/adamltyson) and [Charly Rousseau](https://github.com/crousseau) in the [Margrie Lab](https://www.sainsburywellcome.org/web/groups/margrie-lab), based on [aMAP](https://doi.org/10.1038/ncomms11879) by [Christian Niedworok](https://github.com/cniedwor). The work was generously supported by the [Sainsbury Wellcome Centre](https://www.sainsburywellcome.org/web/).
`brainglobe-segmentation` and `brainreg` were developed by [Adam Tyson](https://github.com/adamltyson) and [Charly Rousseau](https://github.com/crousseau) in the [Margrie Lab](https://www.sainsburywellcome.org/web/groups/margrie-lab), based on [aMAP](https://doi.org/10.1038/ncomms11879) by [Christian Niedworok](https://github.com/cniedwor). The work was generously supported by the [Sainsbury Wellcome Centre](https://www.sainsburywellcome.org/web/).

## Installation

brainreg-segment comes bundled with [`brainreg`](https://github.com/brainglobe/brainreg), so see the [brainreg installation instructions](https://brainglobe.info/documentation/brainreg/index.html).
brainglobe-segmentation comes bundled with [`brainreg`](https://github.com/brainglobe/brainreg), so see the [brainreg installation instructions](https://brainglobe.info/documentation/brainreg/index.html).

brainreg-segment can be installed on it's own (`pip install brainreg-segment`), but you will need to register your data with brainreg first.
brainglobe-segmentation can be installed on it's own (`pip install brainglobe-segmentation`), but you will need to register your data with brainreg first.

## Usage

See [user guide](https://brainglobe.info/documentation/brainreg-segment/index.html).
See [user guide](https://brainglobe.info/documentation/brainglobe-segmentation/index.html).

If you have any questions, head over to the [image.sc forum](https://forum.image.sc/tag/brainglobe).

## Contributing

Contributions are very welcome. Please see the [developers guide](https://brainglobe.info/developers/index.html).

### Citing brainreg-segment
### Citing brainglobe-segmentation

If you find brainreg-segment useful, and use it in your research, please let us know and also cite the paper:
If you find brainglobe-segmentation useful, and use it in your research, please let us know and also cite the paper:

> Tyson, A. L., Vélez-Fort, M., Rousseau, C. V., Cossell, L., Tsitoura, C., Lenzi, S. C., Obenhaus, H. A., Claudi, F., Branco, T., Margrie, T. W. (2022). Accurate determination of marker location within whole-brain microscopy images. Scientific Reports, 12, 867 [doi.org/10.1038/s41598-021-04676-9](https://doi.org/10.1038/s41598-021-04676-9)
10 changes: 10 additions & 0 deletions brainglobe_segmentation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from importlib.metadata import PackageNotFoundError, version
from . import *

__author__ = "Adam Tyson"

try:
__version__ = version("brainglobe-segmentation")
except PackageNotFoundError:
# package is not installed
pass
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions brainglobe_segmentation/napari.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: brainglobe-segmentation
schema_version: 0.1.0
contributions:
commands:
- id: brainglobe-segmentation.SegmentationWidget
title: Open segmentation widget
python_name: brainglobe_segmentation.segment:SegmentationWidget

widgets:
- command: brainglobe-segmentation.SegmentationWidget
display_name: Region/track segmentation
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from napari.qt.threading import thread_worker
from skimage.measure import regionprops_table

from brainreg_segment.atlas.utils import lateralise_atlas_image
from brainglobe_segmentation.atlas.utils import lateralise_atlas_image


@thread_worker
Expand Down
File renamed without changes.
24 changes: 15 additions & 9 deletions brainreg_segment/segment.py → brainglobe_segmentation/segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
from qtpy import QtCore
from qtpy.QtWidgets import QFileDialog, QGridLayout, QGroupBox, QLabel, QWidget

from brainreg_segment.atlas.utils import (
from brainglobe_segmentation.atlas.utils import (
get_available_atlases,
structure_from_viewer,
)
from brainreg_segment.layout.gui_constants import (
from brainglobe_segmentation.layout.gui_constants import (
BOUNDARIES_STRING,
COLUMN_WIDTH,
DISPLAY_REGION_INFO,
Expand All @@ -23,15 +23,21 @@
WINDOW_HEIGHT,
WINDOW_WIDTH,
)
from brainreg_segment.layout.gui_elements import add_button, add_combobox
from brainreg_segment.layout.utils import display_warning
from brainreg_segment.paths import Paths
from brainreg_segment.regions.IO import export_label_layers, save_label_layers
from brainglobe_segmentation.layout.gui_elements import (
add_button,
add_combobox,
)
from brainglobe_segmentation.layout.utils import display_warning
from brainglobe_segmentation.paths import Paths
from brainglobe_segmentation.regions.IO import (
export_label_layers,
save_label_layers,
)

### SEGMENTATION
from brainreg_segment.segmentation_panels.regions import RegionSeg
from brainreg_segment.segmentation_panels.tracks import TrackSeg
from brainreg_segment.tracks.IO import export_splines, save_track_layers
from brainglobe_segmentation.segmentation_panels.regions import RegionSeg
from brainglobe_segmentation.segmentation_panels.tracks import TrackSeg
from brainglobe_segmentation.tracks.IO import export_splines, save_track_layers

### LAYOUT HELPERS

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# RegionSeg
from qtpy.QtWidgets import QGridLayout, QGroupBox

from brainreg_segment.layout.gui_constants import (
from brainglobe_segmentation.layout.gui_constants import (
BRUSH_SIZE,
CALCULATE_VOLUMES_DEFAULT,
COLUMN_WIDTH,
Expand All @@ -11,13 +11,13 @@
SEGM_METHODS_PANEL_ALIGN,
SUMMARIZE_VOLUMES_DEFAULT,
)
from brainreg_segment.layout.gui_elements import (
from brainglobe_segmentation.layout.gui_elements import (
add_button,
add_checkbox,
)
from brainreg_segment.layout.utils import display_info, display_warning
from brainreg_segment.regions.analysis import region_analysis
from brainreg_segment.regions.layers import (
from brainglobe_segmentation.layout.utils import display_info, display_warning
from brainglobe_segmentation.regions.analysis import region_analysis
from brainglobe_segmentation.regions.layers import (
add_existing_region_segmentation,
add_new_region_layer,
add_region_from_existing_layer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import numpy as np
from qtpy.QtWidgets import QGridLayout, QGroupBox

from brainreg_segment.image.utils import create_KDTree_from_image
from brainreg_segment.layout.gui_constants import (
from brainglobe_segmentation.image.utils import create_KDTree_from_image
from brainglobe_segmentation.layout.gui_constants import (
COLUMN_WIDTH,
FIT_DEGREE_DEFAULT,
POINT_SIZE,
Expand All @@ -17,15 +17,15 @@
SUMMARISE_TRACK_DEFAULT,
TRACK_FILE_EXT,
)
from brainreg_segment.layout.gui_elements import (
from brainglobe_segmentation.layout.gui_elements import (
add_button,
add_checkbox,
add_float_box,
add_int_box,
)
from brainreg_segment.layout.utils import display_info, display_warning
from brainreg_segment.tracks.analysis import track_analysis
from brainreg_segment.tracks.layers import (
from brainglobe_segmentation.layout.utils import display_info, display_warning
from brainglobe_segmentation.tracks.analysis import track_analysis
from brainglobe_segmentation.tracks.layers import (
add_existing_track_layers,
add_new_track_layer,
add_track_from_existing_layer,
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
import pandas as pd

from brainreg_segment.tracks.fit import spline_fit
from brainglobe_segmentation.tracks.fit import spline_fit


def track_analysis(
Expand Down
File renamed without changes.
File renamed without changes.
17 changes: 0 additions & 17 deletions brainreg_segment/__init__.py

This file was deleted.

11 changes: 0 additions & 11 deletions brainreg_segment/napari.yaml

This file was deleted.

16 changes: 8 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "brainreg-segment"
name = "brainglobe-segmentation"
description = "Manual segmentation of 3D brain structures in a common anatomical space"
readme = "README.md"
authors = [
Expand Down Expand Up @@ -35,9 +35,9 @@ dynamic = ["version"]

[project.urls]
Homepage = "https://brainglobe.info/"
"Source Code" = "https://github.com/brainglobe/brainreg-segment"
"Bug Tracker" = "https://github.com/brainglobe/brainreg-segment/issues"
Documentation = "https://docs.brainglobe.info/brainreg-segment"
"Source Code" = "https://github.com/brainglobe/brainglobe-segmentation"
"Bug Tracker" = "https://github.com/brainglobe/brainglobe-segmentation/issues"
Documentation = "https://docs.brainglobe.info/brainglobe-segmentation"
"User Support" = "https://forum.image.sc/tag/brainglobe"

[project.optional-dependencies]
Expand All @@ -53,13 +53,13 @@ dev = [
]

[project.entry-points."napari.manifest"]
cellfinder-napari = "brainreg_segment:napari.yaml"
cellfinder-napari = "brainglobe_segmentation:napari.yaml"

[project.scripts]
brainreg-segment = "brainreg_segment.segment:main"
brainglobe-segmentation = "brainglobe_segmentation.segment:main"

[project.entry-points."napari.plugin"]
brainreg-segment = "brainreg_segment.plugins"
brainglobe-segmentation = "brainglobe_segmentation.plugins"

[build-system]
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.2"]
Expand All @@ -69,7 +69,7 @@ build-backend = "setuptools.build_meta"
include-package-data = true

[tool.setuptools.packages.find]
include = ["brainreg_segment*"]
include = ["brainglobe_segmentation*"]

[tool.setuptools_scm]

Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest
from bg_atlasapi import BrainGlobeAtlas

from brainreg_segment.segment import SegmentationWidget
from brainglobe_segmentation.segment import SegmentationWidget

atlas_name = "allen_mouse_50um"
brainreg_dir = Path.cwd() / "tests" / "data" / "brainreg_output"
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/test_integration/test_gui/test_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_load_atlas_space(segmentation_widget):
def test_layer_deletion(segmentation_widget):
"""
Check that remove_layers() doesn't remove any layers that were present
before brainreg-segment added layers
before brainglobe-segmentation added layers
"""
assert len(segmentation_widget.viewer.layers) == 0
segmentation_widget.viewer.add_points(np.array([[1, 1], [2, 2]]))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
import pandas as pd

from brainreg_segment.tracks.analysis import run_track_analysis
from brainglobe_segmentation.tracks.analysis import run_track_analysis

tracks_dir = Path.cwd() / "tests" / "data" / "tracks"

Expand Down
2 changes: 1 addition & 1 deletion tests/tests/test_unit/test_atlas/test_atlas_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np

from brainreg_segment.atlas import utils as atlas_utils
from brainglobe_segmentation.atlas import utils as atlas_utils

atlas_name = "allen_mouse_50um"

Expand Down
2 changes: 1 addition & 1 deletion tests/tests/test_unit/test_image/test_image_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np

from brainreg_segment.image.utils import create_KDTree_from_image
from brainglobe_segmentation.image.utils import create_KDTree_from_image

image = np.array(
(
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/test_unit/test_regions/test_region_IO.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import tifffile

from brainreg_segment.regions import IO as region_IO
from brainglobe_segmentation.regions import IO as region_IO

regions_dir = Path.cwd() / "tests" / "data" / "regions"
VOXEL_SIZE = 100
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/test_unit/test_regions/test_region_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import tifffile
from napari.layers import Labels

from brainreg_segment.regions.analysis import (
from brainglobe_segmentation.regions.analysis import (
check_list_only_nones,
summarise_brain_regions,
summarise_single_brain_region,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
from napari.layers import Labels

from brainreg_segment.segmentation_panels.regions import (
from brainglobe_segmentation.segmentation_panels.regions import (
check_segmentation_in_correct_space,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/tests/test_unit/test_tracks/test_track_IO.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
import pandas as pd

from brainreg_segment.tracks import IO
from brainglobe_segmentation.tracks import IO

tracks_dir = Path.cwd() / "tests" / "data" / "tracks"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
import pytest
from pandas import read_csv

from brainreg_segment.tracks.analysis import analyse_track_anatomy, spline_fit
from brainglobe_segmentation.tracks.analysis import (
analyse_track_anatomy,
spline_fit,
)


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ deps =
pyqt5
magicgui

commands = pytest -v --color=yes --cov=brainreg_segment --cov-report=xml -W ignore::DeprecationWarning
commands = pytest -v --color=yes --cov=brainglobe_segmentation --cov-report=xml

0 comments on commit a3d0d0c

Please sign in to comment.