Skip to content

Commit

Permalink
rf: Transition from niworkflows reporting interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Dec 19, 2024
1 parent 563a4b9 commit 8ff7d9b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 20 deletions.
13 changes: 1 addition & 12 deletions sdcflows/tests/test_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions sdcflows/workflows/apply/tests/test_correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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

Expand Down
4 changes: 1 addition & 3 deletions sdcflows/workflows/apply/tests/test_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion sdcflows/workflows/tests/test_ancillary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
3 changes: 2 additions & 1 deletion sdcflows/workflows/tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# https://www.nipreps.org/community/licensing/
#
"""Test the base workflow."""

from pathlib import Path
import json
import pytest
Expand All @@ -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,
)

Expand Down

0 comments on commit 8ff7d9b

Please sign in to comment.