Skip to content

Commit

Permalink
Use source metadata instead of images to build metadata
Browse files Browse the repository at this point in the history
Also, pre-commit went off on the workflows
  • Loading branch information
tkkuehn committed Jan 25, 2023
1 parent 72b6a4b commit a173e24
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 33 deletions.
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
20 changes: 16 additions & 4 deletions labelmerge/workflow/scripts/labelmerge.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from argparse import ArgumentParser
from os import PathLike
from pathlib import Path
from typing import Optional

import nibabel as nib
import numpy as np
Expand All @@ -15,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 @@ -49,14 +50,25 @@ def split_labels(
atlas: np.ndarray,
metadata: pd.DataFrame,
prefix: str = "",
exceptions: list[str] = [],
exceptions: Optional[list[str]] = None,
) -> list[xr.Dataset]:
if exceptions is None:
exceptions = []
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(
[
assemble_mask(atlas, metadata, label, prefix)
for label in unique_vals
for label in all_labels
if label not in exceptions
]
)
Expand All @@ -67,7 +79,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 a173e24

Please sign in to comment.