From 81d99ecdfd6ab468f999c9e5b68c0fd293584a85 Mon Sep 17 00:00:00 2001 From: David Young Date: Tue, 16 Apr 2024 11:41:41 -0700 Subject: [PATCH 01/12] Fix regex specification for converting ITK-SNAP labels to CSV Use a string literal for regex. --- magmap/atlas/ontology.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/magmap/atlas/ontology.py b/magmap/atlas/ontology.py index e3803cb74..0a119bc03 100644 --- a/magmap/atlas/ontology.py +++ b/magmap/atlas/ontology.py @@ -344,20 +344,22 @@ def load(self): return self -def convert_itksnap_to_df(path): - """Convert an ITK-SNAP labels description file to a CSV file - compatible with MagellanMapper. +def convert_itksnap_to_df(path: str): + """Convert an ITK-SNAP labels description file to a CSV file. + + MagellanMapper can read this type of CSV file. Args: path: Path to description file. Returns: Pandas data frame of the description file. + """ - # load description file and convert contiguous spaces to separators, + # load description file and convert contiguous spaces to separators, # remove comments, and add headers df = pd.read_csv( - path, sep="\s+", comment="#", + path, sep=r"\s+", comment="#", names=[e.value for e in config.ItkSnapLabels]) return df From 7014ca4e8b767862abe282037cc167fce0640b1c Mon Sep 17 00:00:00 2001 From: David Young Date: Tue, 16 Apr 2024 11:42:00 -0700 Subject: [PATCH 02/12] Bump project version to 1.6b5 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9f97f9024..3130c4e84 100644 --- a/setup.py +++ b/setup.py @@ -77,7 +77,7 @@ "url": "https://github.com/sanderslab/magellanmapper", "author_email": "david@textflex.com", "license": "BSD-3", - "version": "1.6b4", + "version": "1.6b5", "packages": setuptools.find_packages(), "scripts": [], "python_requires": ">=3.6", From 71ecab208e8291dca18d64dad78ddd4617147c33 Mon Sep 17 00:00:00 2001 From: David Young Date: Tue, 16 Apr 2024 11:42:41 -0700 Subject: [PATCH 03/12] Bump Venv setup script Python version compatibility to 3.12 Support Python 3.12 when setting up a Venv environment through the script. --- bin/setup_venv.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/setup_venv.sh b/bin/setup_venv.sh index df0990b46..162c1c88a 100755 --- a/bin/setup_venv.sh +++ b/bin/setup_venv.sh @@ -70,7 +70,7 @@ fi # check for Python availability and version requirement py_ver_majmin="" # found Python version in x.y format py_ver_min=(3 6) # minimum supported Python version -py_vers=(3.8 3.7 3.6 3.9 3.10 3.11) # range of versions currently supported +py_vers=(3.8 3.7 3.6 3.9 3.10 3.11 3.12) # range of versions currently supported py_vers_prebuilt_deps=(3.6 3.7 3.8 3.9 3.10 3.11) # vers with custom prebuilt deps for ver in "${py_vers[@]}"; do # prioritize specific versions in case "python" points to lower version, From 2928234fea95443079eb1dbc69eb3aba9805e7ec Mon Sep 17 00:00:00 2001 From: David Young Date: Tue, 16 Apr 2024 11:43:05 -0700 Subject: [PATCH 04/12] Bump readme year to 2024 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ae43934f..7bf7f24cd 100644 --- a/README.md +++ b/README.md @@ -110,4 +110,4 @@ To try out functions with sample images, download any of these files: Licensed under the open-source [BSD-3 license](LICENSE.txt) -Author: David Young, 2017, 2023, Stephan Sanders Lab +Author: David Young, 2017, 2024, Stephan Sanders Lab From 9f1e49afd233d372c16af8057f0d561f6fd9e26b Mon Sep 17 00:00:00 2001 From: David Young Date: Tue, 30 Apr 2024 15:24:54 -0700 Subject: [PATCH 05/12] Fix initializing `RangeEditor` in Python 3.12 - Fix error with initializing the GUI by setting high value for range control to a value above that of low value - Also set for brightness control for consistency, even though it is not currently triggering an error --- magmap/gui/visualizer.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/magmap/gui/visualizer.py b/magmap/gui/visualizer.py index 97ad4de9c..899f2a260 100644 --- a/magmap/gui/visualizer.py +++ b/magmap/gui/visualizer.py @@ -441,16 +441,16 @@ class Visualization(HasTraits): tooltip="Colormap for the channel. Start typing to search.") _imgadj_color_names = Instance(TraitsList) _imgadj_min = Float - _imgadj_min_low = Float(0) - _imgadj_min_high = Float + _imgadj_min_low = Float(0) # must have val in Python >= 3.10 + _imgadj_min_high = Float(1) # must have val > min in Python >= 3.12 _imgadj_min_auto = Bool _imgadj_max = Float _imgadj_max_low = Float(0) - _imgadj_max_high = Float + _imgadj_max_high = Float(1) _imgadj_max_auto = Bool _imgadj_brightness = Float _imgadj_brightness_low = Float(0) - _imgadj_brightness_high = Float + _imgadj_brightness_high = Float(1) _imgadj_contrast = Float _imgadj_alpha = Float _imgadj_alpha_blend = Float(0.5) From 91ca22832bd157790bc904cdde81015569d901ff Mon Sep 17 00:00:00 2001 From: David Young Date: Wed, 1 May 2024 10:29:34 -0700 Subject: [PATCH 06/12] Docs update on quick install and vignette - Add quick install instructions to the main install doc - Add more references to the vignette - Deprecate the pipeline script in the docs, instead pointing to vignette --- docs/install.md | 24 +++++++++++++++++++++--- docs/pipelines.md | 6 +++++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/docs/install.md b/docs/install.md index de1923293..0353a4502 100644 --- a/docs/install.md +++ b/docs/install.md @@ -14,7 +14,25 @@ MagellanMapper supports several Python setups. -### Install using Conda +### Quick Install + +Install MagellanMapper with its graphical interface and registration tools: + +```shell +pip install "magellanmapper[gui,itk]" +``` + +Then launch MagellanMapper: + +```shell +mm +``` + +See [below](#dependencies) for supported Python versions and adding install groups. + +See our [vignette](https://github.com/sanderslab/magellanmapper/blob/master/bin/sample_cmds_bash.ipynb) for getting started on MM! + +### Full install using Conda If you use Conda (available [here](https://docs.conda.io/en/latest/miniconda.html)), you can install MagellanMapper into a new environment named `mag` (or replace with desired name): @@ -33,7 +51,7 @@ Conda will also install Java, which we use to read proprietary image formats. The `mm` entry points was added in v1.6.0 to facilitate launching from installed packages. -### Install using Pip +### Full install using Pip Install using Pip with Python >= 3.6 (see [Python versions](#python-version-support); Python >= 3.9 and [virtual environment](https://realpython.com/python-virtual-environments-a-primer/) recommended): @@ -173,7 +191,7 @@ Sometimes a virtual environment update is required for new dependencies. | MagellanMapper Version | Python Versions Supported | Notes | |-----|-----|-----| | 1.7 (planned) | 3.9-3.11 | 3.6-3.8 to be removed | -| >=1.6b1 | 3.6-3.11 | Defaults to 3.9. GUI support added for 3.10-3.11 in MM 1.6b2. | +| >=1.6b1 | 3.6-3.11 | Defaults to 3.9. GUI support added for 3.10-3.11 in MM 1.6b2, 3.12 in MM 1.6b5. | | 1.6a1-a3 | 3.6-3.9 | GUI support added for 3.9; MM 1.6a2 base group no longer installs GUI | | 1.4-1.5 | 3.6-3.9 | No GUI support in 3.9 | | < 1.4 | 3.6 | Initial releases | diff --git a/docs/pipelines.md b/docs/pipelines.md index fdfc06023..ff628bb70 100644 --- a/docs/pipelines.md +++ b/docs/pipelines.md @@ -1,9 +1,13 @@ # Running Pipelines in MagellanMapper -TODO: update for new pipelines +## Vignette + +See our [vignette](https://github.com/sanderslab/magellanmapper/blob/master/bin/sample_cmds_bash.ipynb) for examples on using MM. ## Start a processing pipeline +**Note**: This pipeline script is deprecated. See our vignette above for running similar pipelines. + Automated processing will attempt to scale based on your system resources but may require some manual intervention. This pipeline has been tested on a Macbook Pro laptop and AWS EC2 Linux (RHEL and Amazon Linux based) instances. Optional dependencies: From fa675ac34efa35b22f67f285ee3be1f374bd563e Mon Sep 17 00:00:00 2001 From: David Young Date: Wed, 1 May 2024 10:56:28 -0700 Subject: [PATCH 07/12] Fix CI for `macos-latest` supported Python versions Python 3.6-3.9 is no longer supported on `macos-latest`, which was recently updated to `macos-14-arm64` (see https://github.com/actions/setup-python/issues/850#issuecomment-2072657610). - Target macOS runner platforms by supported Python version - Simplify specification of Ubuntu runners by moving `ubuntu-20.04` to an `include` statement --- .github/workflows/main.yml | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 911189ebe..0c9c85398 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,24 +22,33 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-20.04, ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] dependencies: - pinned - fresh exclude: - - os: ubuntu-20.04 + - os: ubuntu-latest + python-version: 3.6 + - os: macos-latest + python-version: 3.6 + - os: macos-latest python-version: 3.7 - - os: ubuntu-20.04 + - os: macos-latest python-version: 3.8 - - os: ubuntu-20.04 + - os: macos-latest python-version: 3.9 + include: - os: ubuntu-20.04 - python-version: "3.10" - - os: ubuntu-20.04 - python-version: "3.11" - - os: ubuntu-latest python-version: 3.6 + - os: macos-13 + python-version: 3.6 + - os: macos-13 + python-version: 3.7 + - os: macos-13 + python-version: 3.8 + - os: macos-13 + python-version: 3.9 env: # set requirements path based on Python version From 4b5981bb9f3386d84882186222d03576fc4f71b2 Mon Sep 17 00:00:00 2001 From: David Young Date: Wed, 1 May 2024 11:07:49 -0700 Subject: [PATCH 08/12] Test CI without Python 3.12 Remove Python 3.12 from CI since ITK does not currently support it. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0c9c85398..5fed3e783 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] dependencies: - pinned - fresh From 75f72a81deb6aa6de4791ef2bae86f8392738424 Mon Sep 17 00:00:00 2001 From: David Young Date: Wed, 1 May 2024 11:26:15 -0700 Subject: [PATCH 09/12] Test CI with multiple dependencies in `include` --- .github/workflows/main.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5fed3e783..d66fb8e56 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,14 +41,19 @@ jobs: include: - os: ubuntu-20.04 python-version: 3.6 + dependencies: ["pinned", "fresh"] - os: macos-13 python-version: 3.6 + dependencies: ["pinned", "fresh"] - os: macos-13 python-version: 3.7 + dependencies: ["pinned", "fresh"] - os: macos-13 python-version: 3.8 + dependencies: ["pinned", "fresh"] - os: macos-13 python-version: 3.9 + dependencies: ["pinned", "fresh"] env: # set requirements path based on Python version From 3bb2d7eecc5f4111b6d35556dad34bd7cfbc78d3 Mon Sep 17 00:00:00 2001 From: David Young Date: Wed, 1 May 2024 11:39:15 -0700 Subject: [PATCH 10/12] Test CI with fixed `include`/`exclude` for Ubuntu and macOS --- .github/workflows/main.yml | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d66fb8e56..3d825aaa7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,7 +22,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, macos-13, macos-latest, windows-latest] python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] dependencies: - pinned @@ -30,6 +30,10 @@ jobs: exclude: - os: ubuntu-latest python-version: 3.6 + - os: macos-13 + python-version: 3.10 + - os: macos-13 + python-version: 3.11 - os: macos-latest python-version: 3.6 - os: macos-latest @@ -41,19 +45,10 @@ jobs: include: - os: ubuntu-20.04 python-version: 3.6 - dependencies: ["pinned", "fresh"] - - os: macos-13 + dependencies: pinned + - os: ubuntu-20.04 python-version: 3.6 - dependencies: ["pinned", "fresh"] - - os: macos-13 - python-version: 3.7 - dependencies: ["pinned", "fresh"] - - os: macos-13 - python-version: 3.8 - dependencies: ["pinned", "fresh"] - - os: macos-13 - python-version: 3.9 - dependencies: ["pinned", "fresh"] + dependencies: fresh env: # set requirements path based on Python version From bb55b385f9ee359fc171b4f773a523a041889beb Mon Sep 17 00:00:00 2001 From: David Young Date: Wed, 1 May 2024 12:01:43 -0700 Subject: [PATCH 11/12] Bump ITK-Elastix to v0.19.2 to support macOS Arm64 --- envs/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/envs/requirements.txt b/envs/requirements.txt index d5b362552..5c21853c5 100644 --- a/envs/requirements.txt +++ b/envs/requirements.txt @@ -14,7 +14,7 @@ importlib_metadata==7.1.0 importlib_resources==6.4.0 itk==5.4rc3 itk-core==5.4rc3 -itk-elastix==0.19.1 +itk-elastix==0.19.2 itk-filtering==5.4rc3 itk-io==5.4rc3 itk-numerics==5.4rc3 From 6601e37c91dfcdfb159da5b580492525efac66a0 Mon Sep 17 00:00:00 2001 From: David Young Date: Thu, 2 May 2024 16:28:41 -0700 Subject: [PATCH 12/12] Release notes for extending support to Python 3.12 (#640) --- docs/release/release_v1.6.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/release/release_v1.6.md b/docs/release/release_v1.6.md index 58eb21f6b..5f8c0eab6 100644 --- a/docs/release/release_v1.6.md +++ b/docs/release/release_v1.6.md @@ -7,7 +7,7 @@ - Smoother, faster interactions with main plots, including atlas label name display, label editing, and pan and zoom navigation - Available as binary wheel to install without requiring the source code - Faster, lighter installation with fewer required dependency packages -- Extends suppor to Python 3.11 and defaults to Python 3.9 +- Extends support to Python 3.12 and defaults to Python 3.9 - Simpler entry point to launch MagellanMapper: `mm` - Supports ITK-Elastix for image registration - Atlases can be downloaded directly through [`BrainGlobe`](https://github.com/brainglobe/bg-atlasapi) (see the new "Atlases" panel) @@ -199,13 +199,13 @@ - Jupyter Notebook as a tutorial for running various tasks in the CLI (#122) - Documentation is now [hosted on ReadTheDocs](https://magellanmapper.readthedocs.io/en/latest/index.html), using the Furo theme (#225, #563) - Default arguments are documented in API auto-docs (#485) -- Expand continuous integration testing to both pinned and fresh dependencies across Python 3.6-3.11 (#75, #101, #252, #342, #538) +- Expand continuous integration testing to both pinned and fresh dependencies across Python 3.6-3.12 (#75, #101, #252, #342, #538, #640) ### Dependency Updates #### Python Dependency Changes -- Python 3.10-3.11 are now supported (#379, #517) +- Python 3.10-3.12 are now supported (#379, #517, #640) - Python 3.9 is the default version now that Python 3.6 has reached End-of-Life, and NumPy no longer supports Python 3.8 (#559, #563) - Python 3.6-8 have been deprecated for removal in MM v1.7 and have separate pinned dependencies (`envs/requirements_py3`) (#232, #379) - Custom dependency binaries are now built for Python 3.8-3.11 (#379)