diff --git a/docs/conf.py b/docs/conf.py index 198bb4f854..517302b16a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -48,6 +48,7 @@ "nilearn", "nipy", "nitime", + "nireports", "pandas", "seaborn", "skimage", diff --git a/docs/requirements.txt b/docs/requirements.txt index bb636713a2..1983b96cf6 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -18,4 +18,3 @@ sphinx >= 7.2.2 sphinx-argparse sphinxcontrib-apidoc templateflow -traits < 6.4 \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index c39f549eb0..7625657b1b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,7 @@ dependencies = [ "nibabel >= 3.0", "nipype >= 1.8.5", "migas >= 0.4.0", + "nireports >= 24.1.0", "niworkflows >= 1.7.0", "nitransforms >= 24.1.0", "numpy >= 1.22", diff --git a/sdcflows/interfaces/reportlets.py b/sdcflows/interfaces/reportlets.py index 5330cc4160..31856ea3db 100644 --- a/sdcflows/interfaces/reportlets.py +++ b/sdcflows/interfaces/reportlets.py @@ -26,7 +26,7 @@ from nilearn.image import threshold_img, load_img from niworkflows import NIWORKFLOWS_LOG from niworkflows.utils.images import rotation2canonical, rotate_affine -from niworkflows.viz.utils import cuts_from_bbox, compose_view +from nireports.reportlets.utils import cuts_from_bbox, compose_view from nipype.interfaces.base import File, isdefined, traits from nipype.interfaces.mixins import reporting diff --git a/sdcflows/tests/test_transform.py b/sdcflows/tests/test_transform.py index 18e1b71174..60befe362e 100644 --- a/sdcflows/tests/test_transform.py +++ b/sdcflows/tests/test_transform.py @@ -29,6 +29,7 @@ from nitransforms.linear import LinearTransformsMapping from skimage.morphology import ball import scipy.ndimage as nd +from nireports.interfaces.reporting.base import SimpleBeforeAfterRPT as SimpleBeforeAfter from sdcflows import transform as tf from sdcflows.interfaces.bspline import bspline_grid @@ -120,10 +121,6 @@ def test_displacements_field(tmpdir, testdata_dir, outdir, pe_dir, rotation, fli assert np.all((np.sqrt(((ours - theirs) ** 2).sum()) / ours.size) < 1e-1) if outdir: - from niworkflows.interfaces.reportlets.registration import ( - SimpleBeforeAfterRPT as SimpleBeforeAfter, - ) - orientation = "".join([ax[bool(f)] for ax, f in zip(("RL", "AP", "SI"), flip)]) SimpleBeforeAfter( @@ -204,10 +201,6 @@ def test_apply_transform(tmpdir, outdir, datadir, pe0, hmc, fmap): error = np.sqrt(((corrected.dataobj - realigned.dataobj) ** 2)) if outdir: - from niworkflows.interfaces.reportlets.registration import ( - SimpleBeforeAfterRPT as SimpleBeforeAfter, - ) - # Do not include the first volume in the average to enhance differences realigned_data = np.asanyarray(corrected.dataobj)[..., 1:].mean(-1) realigned_data[realigned_data < 0] = 0 @@ -241,10 +234,6 @@ def test_apply_transform(tmpdir, outdir, datadir, pe0, hmc, fmap): error_margin = 200 # test oracle is pretty bad here - needs revision. if outdir: - from niworkflows.interfaces.reportlets.registration import ( - SimpleBeforeAfterRPT as SimpleBeforeAfter, - ) - # Do not include the first volume in the average to enhance differences realigned_data = np.asanyarray(corrected.dataobj)[..., 1:].mean(-1) realigned_data[realigned_data < 0] = 0 diff --git a/sdcflows/viz/utils.py b/sdcflows/viz/utils.py index 1d277567fd..b5225a627e 100644 --- a/sdcflows/viz/utils.py +++ b/sdcflows/viz/utils.py @@ -47,7 +47,7 @@ def plot_registration( import matplotlib.pyplot as plt from nilearn.plotting import plot_anat from svgutils.transform import SVGFigure - from niworkflows.viz.utils import robust_set_limits, extract_svg, SVGNS + from nireports.reportlets.utils import robust_set_limits, extract_svg, SVGNS plot_params = plot_params or {} diff --git a/sdcflows/workflows/apply/tests/test_correction.py b/sdcflows/workflows/apply/tests/test_correction.py index 989f570b93..fcb0446444 100644 --- a/sdcflows/workflows/apply/tests/test_correction.py +++ b/sdcflows/workflows/apply/tests/test_correction.py @@ -25,6 +25,7 @@ import pytest from nipype.pipeline import engine as pe from nipype.interfaces import utility as niu +from nireports.interfaces.reporting.base import SimpleBeforeAfterRPT as SimpleBeforeAfter from sdcflows.workflows.apply.correction import init_unwarp_wf @@ -58,9 +59,6 @@ def test_unwarp_wf(tmpdir, datadir, workdir, outdir, with_affine): ) if outdir: - from niworkflows.interfaces.reportlets.registration import ( - SimpleBeforeAfterRPT as SimpleBeforeAfter, - ) from ...outputs import DerivativesDataSink from ....interfaces.reportlets import FieldmapReportlet diff --git a/sdcflows/workflows/apply/tests/test_registration.py b/sdcflows/workflows/apply/tests/test_registration.py index 2df0b2ef88..8824eef7ff 100644 --- a/sdcflows/workflows/apply/tests/test_registration.py +++ b/sdcflows/workflows/apply/tests/test_registration.py @@ -26,6 +26,7 @@ from nipype.pipeline import engine as pe from nipype.interfaces import utility as niu +from nireports.interfaces.reporting.base import SimpleBeforeAfterRPT as SimpleBeforeAfter from ...fit.fieldmap import init_magnitude_wf from ..registration import init_coeff2epi_wf @@ -70,9 +71,6 @@ def test_registration_wf(tmpdir, datadir, workdir, outdir): # fmt: on if outdir: - from niworkflows.interfaces.reportlets.registration import ( - SimpleBeforeAfterRPT as SimpleBeforeAfter, - ) from ...outputs import DerivativesDataSink report = pe.Node( diff --git a/sdcflows/workflows/tests/test_ancillary.py b/sdcflows/workflows/tests/test_ancillary.py index 7e407d86e3..57e71c4030 100644 --- a/sdcflows/workflows/tests/test_ancillary.py +++ b/sdcflows/workflows/tests/test_ancillary.py @@ -24,7 +24,7 @@ import pytest from nipype.pipeline import engine as pe from nipype.interfaces import utility as niu -from niworkflows.interfaces.reportlets.masks import SimpleShowMaskRPT +from nireports.interfaces.reporting.masks import SimpleShowMaskRPT from ..ancillary import init_brainextraction_wf diff --git a/sdcflows/workflows/tests/test_integration.py b/sdcflows/workflows/tests/test_integration.py index ac61a48034..644e23530c 100644 --- a/sdcflows/workflows/tests/test_integration.py +++ b/sdcflows/workflows/tests/test_integration.py @@ -21,6 +21,7 @@ # https://www.nipreps.org/community/licensing/ # """Test the base workflow.""" + from pathlib import Path import json import pytest @@ -31,7 +32,7 @@ from sdcflows.interfaces.reportlets import FieldmapReportlet from sdcflows.workflows.apply import correction as swac from sdcflows.workflows.apply import registration as swar -from niworkflows.interfaces.reportlets.registration import ( +from nireports.interfaces.reporting.base import ( SimpleBeforeAfterRPT as SimpleBeforeAfter, )