From 8b03a8a89e3de0d8b53909aeaecb229b83015676 Mon Sep 17 00:00:00 2001 From: Taylor Salo Date: Wed, 11 Oct 2023 14:16:34 -0400 Subject: [PATCH] Address merge issues. --- docs/workflows.rst | 11 ----------- xcp_d/utils/utils.py | 31 ------------------------------- 2 files changed, 42 deletions(-) diff --git a/docs/workflows.rst b/docs/workflows.rst index c0a525a49..77d660e7e 100644 --- a/docs/workflows.rst +++ b/docs/workflows.rst @@ -356,17 +356,6 @@ outlier volumes with cubic spline interpolated data, as implemented in ``Nilearn The resulting ``interpolated, denoised BOLD`` is primarily used for bandpass filtering. -.. warning:: - In versions 0.4.0rc2 - 0.5.0, XCP-D used cubic spline interpolation, - followed by bandpass filtering. - - However, cubic spline interpolation can introduce large spikes and drops in the signal - when the censored volumes are at the beginning or end of the run, - which are then propagated to the filtered data. - - To address this, XCP-D now replaces interpolated volumes at the edges of the run with the - closest non-outlier volume's data, as of 0.5.1. - Bandpass filtering [OPTIONAL] ----------------------------- diff --git a/xcp_d/utils/utils.py b/xcp_d/utils/utils.py index 163cbcdae..14c690618 100644 --- a/xcp_d/utils/utils.py +++ b/xcp_d/utils/utils.py @@ -494,37 +494,6 @@ def denoise_with_nilearn( last_outliers[0] - 1, : ] - # Replace any high-motion volumes at the beginning or end of the run with the closest - # low-motion volume's data. - outlier_idx = list(np.where(~sample_mask)[0]) - if outlier_idx: - # Use https://stackoverflow.com/a/48106843/2589328 to group consecutive blocks of outliers. - gaps = [[s, e] for s, e in zip(outlier_idx, outlier_idx[1:]) if s + 1 < e] - edges = iter(outlier_idx[:1] + sum(gaps, []) + outlier_idx[-1:]) - consecutive_outliers_idx = list(zip(edges, edges)) - first_outliers = consecutive_outliers_idx[0] - last_outliers = consecutive_outliers_idx[-1] - - # Replace outliers at beginning of run - if first_outliers[0] == 0: - LOGGER.warning( - f"Outlier volumes at beginning of run ({first_outliers[0]}-{first_outliers[1]}) " - "will be replaced with first non-outlier volume's values." - ) - interpolated_unfiltered_bold[ - : first_outliers[1] + 1, : - ] = interpolated_unfiltered_bold[first_outliers[1] + 1, :] - - # Replace outliers at end of run - if last_outliers[1] == n_volumes - 1: - LOGGER.warning( - f"Outlier volumes at end of run ({last_outliers[0]}-{last_outliers[1]}) " - "will be replaced with last non-outlier volume's values." - ) - interpolated_unfiltered_bold[last_outliers[0] :, :] = interpolated_unfiltered_bold[ - last_outliers[0] - 1, : - ] - # Now apply the bandpass filter to the interpolated, denoised data if low_pass is not None and high_pass is not None: # TODO: Replace with nilearn.signal.butterworth once 0.10.1 is released.