Skip to content

Commit

Permalink
Allow free rotation of the atlas (#36)
Browse files Browse the repository at this point in the history
* Fixed contents margins

* Scaling of sample image added to adjust moving image dropdown

* Added brainglobe-utils as dependency

* Added error message when no images selected

* Atlas rotation working using scipy

* Pitch, yaw, roll implemented using one affine transform

* Dask loading for both the reference atlas and the rotation

* Added a 'Reset Atlas' button, blocked while dask computes the rotation to avoid race conditions

* Rotate atlas button also greyed out while daks processes the rotation

* Use the update upload_pypi action (#29)

See neuroinformatics-unit/movement#108

* Added elastix Logs directory to .gitignore

* Fixed tests

* Moved run_registration to be imported just as run button is clicked to avoid long boot times

* Atlas rotation works again (might relate to napari 0.4.19

* Added test for atlas_rotation_signal from AdjustMovingImage view

* [pre-commit.ci] pre-commit autoupdate (#30)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.1.9 → v0.2.0](astral-sh/ruff-pre-commit@v0.1.9...v0.2.0)
- [github.com/psf/black: 23.12.1 → 24.1.1](psf/black@23.12.1...24.1.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* [pre-commit.ci] pre-commit autoupdate (#31)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.2.0 → v0.3.5](astral-sh/ruff-pre-commit@v0.2.0...v0.3.5)
- [github.com/psf/black: 24.1.1 → 24.3.0](psf/black@24.1.1...24.3.0)
- [github.com/pre-commit/mirrors-mypy: v1.8.0 → v1.9.0](pre-commit/mirrors-mypy@v1.8.0...v1.9.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Import header from brainglobe-utils (#33)

* import header from brainglobe-utils

* split package name over two lines

* remove brainglobe png from manifest

* add brainglobe-utils dependency

* Update requirements (#34)

* import header from brainglobe-utils

* split package name over two lines

* remove brainglobe png from manifest

* add brainglobe-utils dependency

* Switched from bg-atlasapi to brainglobe-atlasapi

* Added lxml_html_clean explicitly to requirements

* Pinned itk to 5.4rc2 for now as 5.4rc3 cased a seg fault

* Undo itk pin

---------

Co-authored-by: Kimberly Meechan <24316371+K-Meech@users.noreply.github.com>

* add codecov token (#35)

* Added tests for calculate_rotated_bounding_box

* Fixed docstrings for functions in utils.py

* Keep track of napari layers for the atlas and atlas annotations in the napari widget class

* Added tests for atlas rotation

* Fixed pre-commit

* Add test for reset_atlas in adjust_moving_image_view

* Add caching

* Update the function calls in test_adjust_moving_image_view

* Apply suggestions from code review

Co-authored-by: Alessandro Felder <alessandrofelder@users.noreply.github.com>

* Applied suggestions from code review

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Applied suggestions from code review

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kimberly Meechan <24316371+K-Meech@users.noreply.github.com>
Co-authored-by: Alessandro Felder <alessandrofelder@users.noreply.github.com>
  • Loading branch information
4 people authored Jul 26, 2024
1 parent a09d4e6 commit 1b664b6
Show file tree
Hide file tree
Showing 15 changed files with 508 additions and 119 deletions.
27 changes: 20 additions & 7 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,28 @@ jobs:
with:
qt: true

# cache atlases needed by the tests
- name: Cache Atlases
id: atlas-cache
uses: actions/cache@v3
with:
path: | # ensure we don't cache any interrupted atlas download and extraction!
~/.brainglobe/*
!~/.brainglobe/atlas.tar.gz
key: ${{ runner.os }}-cached-atlases
enableCrossOsArchive: false # ~ and $HOME evaluate to different places across OSs!

- if: ${{ steps.atlas-cache.outputs.cache-hit == 'true' }}
name: List files in brainglobe data folder # good to be able to sanity check that user data is as expected
run: |
ls -af ~/.brainglobe/
# Run tests
- uses: neuroinformatics-unit/actions/test@v2
with:
python-version: ${{ matrix.python-version }}
secret-codecov-token: ${{ secrets.CODECOV_TOKEN }}

build_sdist_wheels:
name: Build source distribution
Expand All @@ -66,11 +84,6 @@ jobs:
needs: [build_sdist_wheels]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@v1.5.0
- uses: neuroinformatics-unit/actions/upload_pypi@v2
with:
user: __token__
password: ${{ secrets.TWINE_API_KEY }}
secret-pypi-key: ${{ secrets.TWINE_API_KEY }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,6 @@ venv/

# written by setuptools_scm
**/_version.py

# Elastix related files
/Logs/
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ repos:
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
rev: v0.3.5
hooks:
- id: ruff
- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.3.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.9.0
hooks:
- id: mypy
additional_dependencies:
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ include README.md
include .napari-hub/DESCRIPTION.md
include .napari-hub/config.yml
include brainglobe_registration/napari.yaml
include brainglobe_registration/resources/brainglobe.png
exclude .pre-commit-config.yaml

recursive-include brainglobe_registration/parameters *.txt
Expand Down
2 changes: 1 addition & 1 deletion brainglobe_registration/elastix/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import itk
import numpy as np
from bg_atlasapi import BrainGlobeAtlas
from brainglobe_atlasapi import BrainGlobeAtlas


def get_atlas_by_name(atlas_name: str) -> BrainGlobeAtlas:
Expand Down
Loading

0 comments on commit 1b664b6

Please sign in to comment.