Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update main wtih dev changes #55

Merged
merged 12 commits into from
Aug 16, 2024
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
Loading