Skip to content

Commit

Permalink
Update main wtih dev changes (#55)
Browse files Browse the repository at this point in the history
* Moving from tabs to a dropdown style widget (#25)

* Fixed contents margins

* Added brainglobe-utils as dependency

* Added min dependency version for brainglobe-utils

* Add option to scale sample image (#26)

* 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

* Added tests for scaling

* Added tests to check multiple scale_factors

* Cache the moving image data to allow scaling image multiple times

* Fixed tests by removing (0,0) case add guard in _on_scale_image in registration_widget.py

* Fixed tests

* Add docstring to _on_scale_moving_image

* Replaced all curr_ variable names with current_

* Added units to pixel size selection, set max range to be 100

* Allow free rotation of the atlas (#36)

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>
Co-authored-by: Alessandro Felder <[email protected]>

* Cleaned up a few things

* Mark 'Advanced Settings' as optional (#48)

* Info message when running BrainGlobe Registration plugin with no atlas installed (#46)

* added error when no atlas found

* added error when no atlas found

* Update brainglobe_registration/registration_widget.py

Co-authored-by: Igor Tatarnikov <[email protected]>

* Update brainglobe_registration/registration_widget.py

Co-authored-by: Igor Tatarnikov <[email protected]>

* changes to info message

* Update brainglobe_registration/utils/utils.py

Co-authored-by: Igor Tatarnikov <[email protected]>

* Update brainglobe_registration/utils/utils.py

Co-authored-by: Igor Tatarnikov <[email protected]>

* Update brainglobe_registration/utils/utils.py

Co-authored-by: Igor Tatarnikov <[email protected]>

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

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

* Update brainglobe_registration/utils/utils.py

Co-authored-by: Igor Tatarnikov <[email protected]>

* Update brainglobe_registration/utils/utils.py

Co-authored-by: Igor Tatarnikov <[email protected]>

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

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

* Update brainglobe_registration/utils/utils.py

Co-authored-by: Igor Tatarnikov <[email protected]>

* Update brainglobe_registration/utils/utils.py

Co-authored-by: Igor Tatarnikov <[email protected]>

* Update brainglobe_registration/registration_widget.py

Co-authored-by: Igor Tatarnikov <[email protected]>

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

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

* parent_widget

* parent_widget

---------

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

* Clean up widget (#51)

* Cleaned up rogue widget duplication

* Added parent to parameters_tab

* Fix slow plugin loading (#54)

* Filter Images (#52)

* work_in_progress

* filter_images

* filter_images

* filter_images

* filter_images

* Update brainglobe_registration/utils/utils.py

Co-authored-by: Igor Tatarnikov <[email protected]>

* Update brainglobe_registration/utils/utils.py

Co-authored-by: Igor Tatarnikov <[email protected]>

* Update brainglobe_registration/utils/utils.py

Co-authored-by: Igor Tatarnikov <[email protected]>

* Update brainglobe_registration/utils/utils.py

Co-authored-by: Igor Tatarnikov <[email protected]>

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

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

---------

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

* Communicate napari layer deletions appropriately to the plugin (#49)

* layer_deletion

* Update brainglobe_registration/registration_widget.py

Co-authored-by: Igor Tatarnikov <[email protected]>

* layer_deletion_edits

* Made pytest happy

* Update brainglobe_registration/registration_widget.py

Co-authored-by: Igor Tatarnikov <[email protected]>

* Update brainglobe_registration/registration_widget.py

Co-authored-by: Igor Tatarnikov <[email protected]>

* Update brainglobe_registration/registration_widget.py

Co-authored-by: Igor Tatarnikov <[email protected]>

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

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

* updated_layer

* fixed manual vs automatic deletion

* fixed manual vs automatic deletion

* Refactored some old code to avoid duplication

* add comments

---------

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kimberly Meechan <[email protected]>
Co-authored-by: Alessandro Felder <[email protected]>
Co-authored-by: saarah815 <[email protected]>
  • Loading branch information
5 people authored Aug 16, 2024
1 parent f365acf commit cc23983
Show file tree
Hide file tree
Showing 13 changed files with 891 additions and 95 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,23 @@ 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:
Expand Down
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/
17 changes: 10 additions & 7 deletions brainglobe_registration/elastix/register.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from typing import List
from typing import List, Tuple

import itk
import numpy as np
import numpy.typing as npt
from brainglobe_atlasapi import BrainGlobeAtlas


Expand All @@ -28,28 +29,30 @@ def run_registration(
atlas_image,
moving_image,
annotation_image,
parameter_lists: List[tuple[str, dict]],
) -> tuple[np.ndarray, itk.ParameterObject, np.ndarray]:
parameter_lists: List[Tuple[str, dict]],
) -> Tuple[npt.NDArray, itk.ParameterObject, npt.NDArray]:
"""
Run the registration process on the given images.
Parameters
----------
atlas_image : np.ndarray
atlas_image : npt.NDArray
The atlas image.
moving_image : np.ndarray
moving_image : npt.NDArray
The moving image.
annotation_image : np.ndarray
annotation_image : npt.NDArray
The annotation image.
parameter_lists : List[tuple[str, dict]], optional
The list of parameter lists, by default None
Returns
-------
np.ndarray
npt.NDArray
The result image.
itk.ParameterObject
The result transform parameters.
npt.NDArray
The transformed annotation image.
"""
# convert to ITK, view only
atlas_image = itk.GetImageViewFromArray(atlas_image).astype(itk.F)
Expand Down
Loading

0 comments on commit cc23983

Please sign in to comment.