Skip to content

Commit

Permalink
REL: 23.0.0 (#273)
Browse files Browse the repository at this point in the history
* RM: Unused bold grouping

* MNT: Prepare changes for next release

* CI: Update pip first, avoid any prepended messages when checking version

* CI: Remove erroneous substitution

* DEP: Set nipreps to releases
  • Loading branch information
mgxd authored Jan 23, 2023
1 parent b7c4e3c commit f8ca1ae
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 115 deletions.
10 changes: 4 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
18 changes: 18 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -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!
Expand Down
105 changes: 0 additions & 105 deletions nibabies/utils/bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion nibabies/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit f8ca1ae

Please sign in to comment.