From 8ff7d9b9ec4779ec44217a7f304f845ce6fc37b7 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 18 Dec 2024 19:35:31 -0500 Subject: [PATCH] rf: Transition from niworkflows reporting interfaces --- sdcflows/tests/test_transform.py | 13 +------------ sdcflows/workflows/apply/tests/test_correction.py | 4 +--- sdcflows/workflows/apply/tests/test_registration.py | 4 +--- sdcflows/workflows/tests/test_ancillary.py | 2 +- sdcflows/workflows/tests/test_integration.py | 3 ++- 5 files changed, 6 insertions(+), 20 deletions(-) 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/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, )