Skip to content

Commit

Permalink
Merge pull request #36 from khanlab/new-indexing
Browse files Browse the repository at this point in the history
New indexing
  • Loading branch information
tkkuehn authored Jan 26, 2023
2 parents f71f737 + 2ae5592 commit 3d57c27
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 31 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[flake8]
max-line-length = 79
extend-ignore = W503
27 changes: 7 additions & 20 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,15 @@ template: |
$CHANGES
categories:
- title: 🚀 Features
labels:
- breaking
- enhancement
labels: [breaking, enhancement]
- title: 🐛 Bug Fixes
labels:
- bug
labels: [bug]
- title: 🧰 Maintenance
labels:
- maintenance
- test
labels: [maintenance, test]
- title: 📝 Documentation
labels:
- documentation
labels: [documentation]

exclude-labels:
- skip_changelog
exclude-labels: [skip_changelog]

change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: \<*_& # You can add # and @ to disable mentions, and add ` to disable code blocks.
Expand All @@ -33,13 +26,7 @@ version-resolver:
# labels:
# - 'breaking'
minor:
labels:
- breaking
- enhancement
labels: [breaking, enhancement]
patch:
labels:
- maintenance
- bug
- test
- documentation
labels: [maintenance, bug, test, documentation]
default: patch
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ jobs:
# with:
# python-version: '3.9'

# #----------------------------------------------
# # ----- install & configure poetry -----
# #----------------------------------------------
# #----------------------------------------------
# # ----- install & configure poetry -----
# #----------------------------------------------
# - name: Install Poetry
# uses: snok/install-poetry@v1
# with:
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ name: Lint workflow

on:
push:
branches:
- '*'
- '!push-action/*'
branches: ['*', '!push-action/*']
pull_request:
branches:
- '*'
- '!push-action/*'
branches: ['*', '!push-action/*']

jobs:
quality:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Local poetry config
poetry.toml
**/__pycache__
13 changes: 11 additions & 2 deletions labelmerge/workflow/scripts/labelmerge.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
def load_atlas(atlas_path: PathLike):
"""Loading relevant atlas data"""
atlas = nib.load(atlas_path)
data = atlas.get_fdata().astype(np.ushort)
data = atlas.get_fdata().astype(np.int_)
header = atlas.header
affine = atlas.affine

Expand Down Expand Up @@ -58,6 +58,15 @@ def split_labels(
if drops is None:
drops = []
unique_vals = np.unique(atlas[atlas > 0])
all_labels: pd.Series[int] = metadata["index"]
if not set(unique_vals) <= set(all_labels):
unlabeled_vals = ", ".join(
str(val) for val in set(unique_vals) - set(all_labels)
)
raise MetadataError(
f"Labels with indices {unlabeled_vals} from {prefix}atlas not "
"found in metadata table"
)
normal_ds = xr.Dataset(
dict(
[
Expand All @@ -73,7 +82,7 @@ def split_labels(
dict(
[
assemble_mask(atlas, metadata, label, prefix)
for label in unique_vals
for label in all_labels
if label in exceptions
]
)
Expand Down

0 comments on commit 3d57c27

Please sign in to comment.