From 06d29a2cbe473ce4d6a2645a8607e32ba5b865c5 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Fri, 18 Aug 2023 12:25:00 -0400 Subject: [PATCH 1/9] DOC: Use latest sphinx to fix bad sphinx/furo interaction Backport gh-390 --- .circleci/config.yml | 7 +++---- docs/requirements.txt | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e5c49d2028..08ad765478 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -349,8 +349,7 @@ jobs: flags: unittests build_docs: - docker: - - image: python:3.8.5 + <<: *python_defaults working_directory: /tmp/gh-pages environment: - FSLOUTPUTTYPE: NIFTI @@ -363,8 +362,8 @@ jobs: - run: name: Install Graphviz command: | - apt-get update -y - apt-get install -y --no-install-recommends graphviz + sudo apt-get update -y + sudo apt-get install -y --no-install-recommends graphviz - run: name: Install deps command: | diff --git a/docs/requirements.txt b/docs/requirements.txt index 5ed611dfe8..77a1ace90f 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -9,7 +9,7 @@ numpy packaging pydot >= 1.2.3 pydotplus -sphinx ~= 4.2 +sphinx >= 7.2.2 sphinxcontrib-apidoc sphinxcontrib-napoleon templateflow From ad7651a02020f080f8b2860453ddb0e0000673bf Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 4 Oct 2023 08:21:12 -0400 Subject: [PATCH 2/9] FIX: Update setuptools along with setuptools_scm --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 08ad765478..03ea5d5dc0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -369,7 +369,7 @@ jobs: command: | python -m venv /tmp/venv source /tmp/venv/bin/activate - python -m pip install -U pip setuptools_scm + python -m pip install -U pip setuptools setuptools_scm pip install --no-cache-dir -r docs/requirements.txt - run: name: Build only this commit From a0605350593487a34cda32e9aacd489705914607 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 4 Oct 2023 08:24:40 -0400 Subject: [PATCH 3/9] DOC: Relax furo pin --- docs/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 77a1ace90f..d5a1bfba00 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,5 +1,5 @@ attrs >= 20.1.0 -furo ~= 2021.10.09 +furo >= 2021.10.09 matplotlib >= 2.2.0 nibabel nipype >= 1.5.1 From 813594b792e115aedd5abb092468fcc861cf45c5 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 4 Oct 2023 08:31:04 -0400 Subject: [PATCH 4/9] FIX: Fallback to PEP440-compatible bad version --- sdcflows/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdcflows/__init__.py b/sdcflows/__init__.py index fc4b27a728..5122dfdccd 100644 --- a/sdcflows/__init__.py +++ b/sdcflows/__init__.py @@ -9,6 +9,6 @@ try: __version__ = get_distribution(__packagename__).version except DistributionNotFound: - __version__ = "unknown" + __version__ = "0+unknown" del get_distribution del DistributionNotFound From a04488d5dab278b5cd7d1ed49cac8b187e368aa1 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 4 Oct 2023 08:34:35 -0400 Subject: [PATCH 5/9] DOC: Set language to en --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index c40e3b0c52..86b8d24a8d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -83,7 +83,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = "en" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. From cd5b0910229d107f08b9b72d4787824f02a047f1 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 4 Oct 2023 09:03:59 -0400 Subject: [PATCH 6/9] TEST: Test 0+unknown --- sdcflows/tests/test_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdcflows/tests/test_version.py b/sdcflows/tests/test_version.py index 432ec367c6..3d6c5854c9 100644 --- a/sdcflows/tests/test_version.py +++ b/sdcflows/tests/test_version.py @@ -61,4 +61,4 @@ def _raise(name): monkeypatch.setattr("pkg_resources.get_distribution", _raise) reload(sdcflows) - assert sdcflows.__version__ == "unknown" + assert sdcflows.__version__ == "0+unknown" From dcee2d888017bbeb9dfd27b504244a2e913837b6 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 4 Oct 2023 08:01:45 -0400 Subject: [PATCH 7/9] FIX: Mask fieldmap before fitting spline field [backport gh-396] --- sdcflows/interfaces/bspline.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdcflows/interfaces/bspline.py b/sdcflows/interfaces/bspline.py index 299f0b7d92..deacea304c 100644 --- a/sdcflows/interfaces/bspline.py +++ b/sdcflows/interfaces/bspline.py @@ -195,6 +195,7 @@ def _run_interface(self, runtime): center = np.mean(data[mask]) data -= center + data[~mask] = 0 # Calculate collocation matrix from (possibly resized) image and knot grids colmat = sparse_vstack(grid_bspline_weights(fmapnii, grid) for grid in bs_grids).T.tocsr() @@ -210,7 +211,7 @@ def _run_interface(self, runtime): # Fit the model model = lm.Ridge(alpha=self.inputs.ridge_alpha, fit_intercept=False, solver='lsqr') for attempt in range(3): - model.fit(colmat[mask.reshape(-1), :], data[mask]) + model.fit(colmat, data.reshape(-1)) extreme = np.abs(model.coef_).max() LOGGER.debug(f"Model fit attempt {attempt}: max(|coeffs|) = {extreme}") # Normal values seem to be ~1e2, bad ~1e8. May want to tweak this if From 8bb307d3eeadb13b74a3509dec9546756afc410f Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Thu, 9 Nov 2023 11:22:03 -0500 Subject: [PATCH 8/9] REL: 2.5.2 --- CHANGES.rst | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 0296835c88..783f0ba195 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,14 @@ +2.5.2 (November 09, 2023) +========================= +Bug-fix release in the 2.5.x series. + +This release includes a fix for phasediff/direct fieldmaps that were previously +producing distortions outside the brain due to an incorrect masking of the fieldmap. + +* FIX: Mask fieldmap before fitting spline field [backport gh-396] (#398) +* DOC: Fix doc build for 2.5.x branch (#399) +* MAINT: Make call to scipy.stats.mode compatible with scipy 1.11.0 (#371) + 2.5.1 (June 08, 2023) ===================== Bug-fix release in the 2.5.x series. @@ -6,7 +17,6 @@ Bug-fix release in the 2.5.x series. * FIX: Ensure metadata is not present in entity query (#367) * RF/FIX: Prioritize sbref and shortest echo for SyN-SDC (#364) - 2.5.0 (June 01, 2023) ===================== New feature release in the 2.5.x series. From 9e91e56749583b1cd89911d3eb487996da65cef3 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Thu, 9 Nov 2023 11:56:41 -0500 Subject: [PATCH 9/9] MNT: Update AFNI installation on Docker --- Dockerfile | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 01df6d801e..99204845d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -147,10 +147,12 @@ RUN echo "Downloading Convert3D ..." \ ENV C3DPATH="/opt/convert3d-1.0.0" \ PATH="/opt/convert3d-1.0.0/bin:$PATH" -# Configure PPA for libpng12 +# Configure PPAs for libpng12 and libxp6 RUN GNUPGHOME=/tmp gpg --keyserver hkps://keyserver.ubuntu.com --no-default-keyring --keyring /usr/share/keyrings/linuxuprising.gpg --recv 0xEA8CACC073C3DB2A \ - && echo "deb [signed-by=/usr/share/keyrings/linuxuprising.gpg] https://ppa.launchpadcontent.net/linuxuprising/libpng12/ubuntu jammy main" > /etc/apt/sources.list.d/linuxuprising.list -# AFNI latest (neurodocker build) + && GNUPGHOME=/tmp gpg --keyserver hkps://keyserver.ubuntu.com --no-default-keyring --keyring /usr/share/keyrings/zeehio.gpg --recv 0xA1301338A3A48C4A \ + && echo "deb [signed-by=/usr/share/keyrings/linuxuprising.gpg] https://ppa.launchpadcontent.net/linuxuprising/libpng12/ubuntu jammy main" > /etc/apt/sources.list.d/linuxuprising.list \ + && echo "deb [signed-by=/usr/share/keyrings/zeehio.gpg] https://ppa.launchpadcontent.net/zeehio/libxp/ubuntu jammy main" > /etc/apt/sources.list.d/zeehio.list +# Dependencies for AFNI; requires a discontinued multiarch-support package from bionic (18.04) RUN apt-get update -qq \ && apt-get install -y -q --no-install-recommends \ ed \ @@ -162,27 +164,23 @@ RUN apt-get update -qq \ libjpeg62 \ libpng12-0 \ libxm4 \ + libxp6 \ netpbm \ tcsh \ xfonts-base \ xvfb \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* \ && curl -sSL --retry 5 -o /tmp/multiarch.deb http://archive.ubuntu.com/ubuntu/pool/main/g/glibc/multiarch-support_2.27-3ubuntu1.5_amd64.deb \ && dpkg -i /tmp/multiarch.deb \ && rm /tmp/multiarch.deb \ - && curl -sSL --retry 5 -o /tmp/libxp6.deb http://mirrors.kernel.org/debian/pool/main/libx/libxp/libxp6_1.0.2-2_amd64.deb \ - && dpkg -i /tmp/libxp6.deb \ - && rm /tmp/libxp6.deb \ && apt-get install -f \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* \ + && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ && gsl2_path="$(find / -name 'libgsl.so.19' || printf '')" \ && if [ -n "$gsl2_path" ]; then \ ln -sfv "$gsl2_path" "$(dirname $gsl2_path)/libgsl.so.0"; \ fi \ - && ldconfig \ - && echo "Downloading AFNI ..." \ + && ldconfig +# AFNI latest +RUN echo "Downloading AFNI ..." \ && mkdir -p /opt/afni-latest \ && curl -fsSL --retry 5 https://afni.nimh.nih.gov/pub/dist/tgz/linux_openmp_64.tgz \ | tar -xz -C /opt/afni-latest --strip-components 1 \