Skip to content

Commit

Permalink
Use space definitions from niworkflows (#378)
Browse files Browse the repository at this point in the history
* Pin Niworkflows version.

* Use Niworkflows' spaces.

* Fix init file.

* Run isort.
  • Loading branch information
tsalo authored Dec 18, 2023
1 parent d6c868c commit a2b41da
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 773 deletions.
4 changes: 2 additions & 2 deletions aslprep/cli/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ def _build_parser():
from functools import partial
from pathlib import Path

from niworkflows.utils.spaces import OutputReferencesAction, Reference
from packaging.version import Version

from aslprep.cli.version import check_latest, is_flagged
from aslprep.utils.spaces import OutputReferencesAction, Reference

def _path_exists(path, parser):
"""Ensure a given path exists."""
Expand Down Expand Up @@ -624,7 +624,7 @@ def parse_args(args=None, namespace=None):
"""Parse args and run further checks on the command line."""
import logging

from aslprep.utils.spaces import Reference, SpatialReferences
from niworkflows.utils.spaces import Reference, SpatialReferences

parser = _build_parser()
opts = parser.parse_args(args, namespace)
Expand Down
6 changes: 3 additions & 3 deletions aslprep/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def load(cls, settings, init=True, ignore=None):
@classmethod
def get(cls):
"""Return defined settings."""
from aslprep.utils.spaces import Reference, SpatialReferences
from niworkflows.utils.spaces import Reference, SpatialReferences

out = {}
for k, v in cls.__dict__.items():
Expand Down Expand Up @@ -548,7 +548,7 @@ class workflow(_Config):
"""Skip brain extraction of the T1w image (default is ``force``, meaning that
*ASLPrep* will run brain extraction of the T1w)."""
spaces = None
"""Keeps the :py:class:`~aslprep.utils.spaces.SpatialReferences`
"""Keeps the :py:class:`~niworkflows.utils.spaces.SpatialReferences`
instance keeping standard and nonstandard spaces."""
use_bbr = None
"""Run boundary-based registration for ASL-to-T1w registration."""
Expand Down Expand Up @@ -745,7 +745,7 @@ def to_filename(filename):

def init_spaces(checkpoint=True):
"""Initialize the :attr:`~workflow.spaces` setting."""
from aslprep.utils.spaces import Reference, SpatialReferences
from niworkflows.utils.spaces import Reference, SpatialReferences

spaces = execution.output_spaces or SpatialReferences()
if not isinstance(spaces, SpatialReferences):
Expand Down
13 changes: 1 addition & 12 deletions aslprep/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
"""Utility functions for aslprep."""
from aslprep.utils import (
asl,
atlas,
bids,
cbf,
confounds,
misc,
plotting,
sentry,
spaces,
)
from aslprep.utils import asl, atlas, bids, cbf, confounds, misc, plotting, sentry

__all__ = [
"asl",
Expand All @@ -20,5 +10,4 @@
"misc",
"plotting",
"sentry",
"spaces",
]
Loading

0 comments on commit a2b41da

Please sign in to comment.