diff --git a/.circleci/config.yml b/.circleci/config.yml index 0238845e..83dd1b6a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -518,7 +518,9 @@ jobs: - checkout - run: name: Update build tools - command: python -m pip install pip build twine hatch + command: | + python -m pip install -U pip + python -m pip install -U build twine hatch - run: name: Build nibabies command: python -m build @@ -527,8 +529,7 @@ jobs: - run: name: Check sdist distribution command: | - THISVERSION=$( python -m hatch version ) - THISVERSION=${THISVERSION%.d*} + THISVERSION=$( python -m hatch version | tail -n1 ) THISVERSION=${CIRCLE_TAG:-$THISVERSION} python -m twine check dist/nibabies*.tar.gz virtualenv --python=python sdist @@ -546,7 +547,6 @@ jobs: name: Check wheel distribution command: | THISVERSION=$( python -m hatch version ) - THISVERSION=${THISVERSION%.d*} THISVERSION=${CIRCLE_TAG:-$THISVERSION} python -m twine check dist/nibabies*.whl virtualenv --python=python wheel @@ -563,7 +563,6 @@ jobs: name: Build nibabies-wrapper command: | THISVERSION=$( python -m hatch version ) - THISVERSION=${THISVERSION%.d*} python -m build wrapper/ - store_artifacts: path: /tmp/src/nibabies/wrapper/dist @@ -583,7 +582,6 @@ jobs: name: Build nibabies-wrapper command: | THISVERSION=$( python -m hatch version ) - THISVERSION=${THISVERSION%.d*} python -m build wrapper/ - run: name: Upload packages to PyPI diff --git a/CHANGES.md b/CHANGES.md index 65c11d29..77fd2521 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,21 @@ +23.0.0 (January 23, 2023) +========================= +New year, new *NiBabies* minor series! +Some of the highlights of this release include: +- New run-wise BOLD reference generation, prioritizing single-band references if available, unless avoided with the `--ignore sbrefs` flag. +- New output: Preprocessed T2w in T1w space. + +A full list of changes can be found below. + +## Full Changelog + * ENH: Runwise bold reference generation (#268) + * ENH: Add preprocessed T2w volume to outputs (#271) + * MAINT: Drop versioneer for hatch backend, fully embrace pyproject.toml (#265) + * MAINT: Rotate CircleCI secrets and setup up org-level context (#266) + * CI: Bump convenience images, limit datalad (#267) + * FIX: Remove legacy CIFTI variant support (#264) + + 22.2.0 (December 13, 2022) ========================== The final *NiBabies* minor series of 2022! diff --git a/nibabies/utils/bids.py b/nibabies/utils/bids.py index ffe139aa..0f1ea15c 100644 --- a/nibabies/utils/bids.py +++ b/nibabies/utils/bids.py @@ -127,111 +127,6 @@ def _unique(inlist): return {k: _unique(v) for k, v in entities.items()} -def group_bolds_ref(*, layout, subject, sessions=None): - """ - Extracts BOLD files from a BIDS dataset and combines them into buckets. - Files in a bucket share: - 1) Session - 2) Phase-encoding direction (PEdir) - 3) Total readout time (TRT) - - Any files with missing data for (2) or (3) are put in their own bucket. - - Parameters - ---------- - layout : pybids.layout.BIDSLayout - Initialized BIDSLayout - subject : str - The subject ID - sessions : None - - Outputs - ------- - combinations : list of tuples - Each tuple is composed of (session, PEdir, TRT) - files : list of lists - Files matching each combination. - - Limitations - ----------- - Single-band reference (sbref) are excluded. - """ - import re - from contextlib import suppress - from itertools import product - - from sdcflows.utils.epimanip import get_trt - - base_entities = { - "subject": subject, - "extension": (".nii", ".nii.gz"), - "scope": "raw", # Ensure derivatives are not captured - } - # dictionary containing unique Groupings and files - groupings = {} - # list of all BOLDS encountered - all_bolds = [] - - sessions = sessions if sessions else layout.get_sessions(subject=subject, scope="raw") - - for ses, suffix in sorted(product(sessions or (None,), {"bold"})): - # bold files same session - bolds = layout.get(suffix=suffix, session=ses, **base_entities) - # some sessions may not have BOLD scans - if bolds is None: - continue - - for i, bold in enumerate(bolds): - multiecho_id = None - # multi-echo should be grouped together - if 'echo' in bold.entities: - # create unique id by dropping "_echo-{i}" - multiecho_id = re.sub(r"_echo-\d+", "", bold.filename) - - # session, pe, ro - meta = bold.get_metadata() - pe_dir = meta.get("PhaseEncodingDirection") - - ro = None - with suppress(ValueError): - ro = get_trt(meta, bold.path) - if ro is not None: - meta.update({"TotalReadoutTime": ro}) - - grouping = BOLDGrouping( - session=ses, - pe_dir=pe_dir, - readout=ro, - multiecho_id=multiecho_id, - ) - - if any(v is None for v in (pe_dir, ro)): - # cannot be certain so treat as unique - grouping.add_file(bold.path) - groupings[f'unknown{i}'] = grouping - else: - try: - grouping = groupings[grouping.name] - except KeyError: - groupings[grouping.name] = grouping - - grouping.add_file(bold.path) - - all_bolds += bolds - - if len(all_bolds) != sum([len(g.files) for _, g in groupings.items()]): - msg = f"""Error encountered when grouping BOLD runs. -Combinations: {groupings} -BOLD files: {bolds} - -Please file a bug-report with the nibabies developers at: -https://github.com/nipreps/nibabies/issues/new/choose -""" - raise RuntimeError(msg) - - return groupings - - def validate_input_dir(exec_env, bids_dir, participant_label): # Ignore issues and warnings that should not influence NiBabies import subprocess diff --git a/nibabies/workflows/base.py b/nibabies/workflows/base.py index e8de1818..2f97ca32 100644 --- a/nibabies/workflows/base.py +++ b/nibabies/workflows/base.py @@ -51,7 +51,6 @@ from .. import config from ..interfaces import DerivativesDataSink from ..interfaces.reports import AboutSummary, SubjectSummary -from ..utils.bids import group_bolds_ref from .bold import init_func_preproc_wf diff --git a/pyproject.toml b/pyproject.toml index 18bf623f..3fa293ef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,15 +24,15 @@ dependencies = [ "nipype >= 1.8.1", "nitime", "nitransforms >= 21.0.0", - "niworkflows @ git+https://github.com/nipreps/niworkflows.git@master", + "niworkflows ~= 1.7.1", "numpy >= 1.21.0", "packaging", "pandas", "psutil >= 5.4", "pybids >= 0.15.0", "requests", - "sdcflows @ git+https://github.com/nipreps/sdcflows.git@master", - "smriprep @ git+https://github.com/nipreps/smriprep.git@master", + "sdcflows ~= 2.2.2", + "smriprep ~= 0.10.0", "tedana ~= 0.0.12", "templateflow >= 0.6", "toml",