Skip to content

Commit a50506a

Browse files
authored
Merge pull request #473 from effigies/mnt/nireports
rf: Transition from niworkflows reporting interfaces
2 parents 03076bd + 4defca7 commit a50506a

File tree

10 files changed

+10
-23
lines changed

10 files changed

+10
-23
lines changed

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"nilearn",
4949
"nipy",
5050
"nitime",
51+
"nireports",
5152
"pandas",
5253
"seaborn",
5354
"skimage",

docs/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,3 @@ sphinx >= 7.2.2
1818
sphinx-argparse
1919
sphinxcontrib-apidoc
2020
templateflow
21-
traits < 6.4

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ dependencies = [
2727
"nibabel >= 3.0",
2828
"nipype >= 1.8.5",
2929
"migas >= 0.4.0",
30+
"nireports >= 24.1.0",
3031
"niworkflows >= 1.7.0",
3132
"nitransforms >= 24.1.0",
3233
"numpy >= 1.22",

sdcflows/interfaces/reportlets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from nilearn.image import threshold_img, load_img
2727
from niworkflows import NIWORKFLOWS_LOG
2828
from niworkflows.utils.images import rotation2canonical, rotate_affine
29-
from niworkflows.viz.utils import cuts_from_bbox, compose_view
29+
from nireports.reportlets.utils import cuts_from_bbox, compose_view
3030
from nipype.interfaces.base import File, isdefined, traits
3131
from nipype.interfaces.mixins import reporting
3232

sdcflows/tests/test_transform.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from nitransforms.linear import LinearTransformsMapping
3030
from skimage.morphology import ball
3131
import scipy.ndimage as nd
32+
from nireports.interfaces.reporting.base import SimpleBeforeAfterRPT as SimpleBeforeAfter
3233

3334
from sdcflows import transform as tf
3435
from sdcflows.interfaces.bspline import bspline_grid
@@ -120,10 +121,6 @@ def test_displacements_field(tmpdir, testdata_dir, outdir, pe_dir, rotation, fli
120121
assert np.all((np.sqrt(((ours - theirs) ** 2).sum()) / ours.size) < 1e-1)
121122

122123
if outdir:
123-
from niworkflows.interfaces.reportlets.registration import (
124-
SimpleBeforeAfterRPT as SimpleBeforeAfter,
125-
)
126-
127124
orientation = "".join([ax[bool(f)] for ax, f in zip(("RL", "AP", "SI"), flip)])
128125

129126
SimpleBeforeAfter(
@@ -204,10 +201,6 @@ def test_apply_transform(tmpdir, outdir, datadir, pe0, hmc, fmap):
204201
error = np.sqrt(((corrected.dataobj - realigned.dataobj) ** 2))
205202

206203
if outdir:
207-
from niworkflows.interfaces.reportlets.registration import (
208-
SimpleBeforeAfterRPT as SimpleBeforeAfter,
209-
)
210-
211204
# Do not include the first volume in the average to enhance differences
212205
realigned_data = np.asanyarray(corrected.dataobj)[..., 1:].mean(-1)
213206
realigned_data[realigned_data < 0] = 0
@@ -241,10 +234,6 @@ def test_apply_transform(tmpdir, outdir, datadir, pe0, hmc, fmap):
241234
error_margin = 200 # test oracle is pretty bad here - needs revision.
242235

243236
if outdir:
244-
from niworkflows.interfaces.reportlets.registration import (
245-
SimpleBeforeAfterRPT as SimpleBeforeAfter,
246-
)
247-
248237
# Do not include the first volume in the average to enhance differences
249238
realigned_data = np.asanyarray(corrected.dataobj)[..., 1:].mean(-1)
250239
realigned_data[realigned_data < 0] = 0

sdcflows/viz/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def plot_registration(
4747
import matplotlib.pyplot as plt
4848
from nilearn.plotting import plot_anat
4949
from svgutils.transform import SVGFigure
50-
from niworkflows.viz.utils import robust_set_limits, extract_svg, SVGNS
50+
from nireports.reportlets.utils import robust_set_limits, extract_svg, SVGNS
5151

5252
plot_params = plot_params or {}
5353

sdcflows/workflows/apply/tests/test_correction.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import pytest
2626
from nipype.pipeline import engine as pe
2727
from nipype.interfaces import utility as niu
28+
from nireports.interfaces.reporting.base import SimpleBeforeAfterRPT as SimpleBeforeAfter
2829
from sdcflows.workflows.apply.correction import init_unwarp_wf
2930

3031

@@ -58,9 +59,6 @@ def test_unwarp_wf(tmpdir, datadir, workdir, outdir, with_affine):
5859
)
5960

6061
if outdir:
61-
from niworkflows.interfaces.reportlets.registration import (
62-
SimpleBeforeAfterRPT as SimpleBeforeAfter,
63-
)
6462
from ...outputs import DerivativesDataSink
6563
from ....interfaces.reportlets import FieldmapReportlet
6664

sdcflows/workflows/apply/tests/test_registration.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
from nipype.pipeline import engine as pe
2828
from nipype.interfaces import utility as niu
29+
from nireports.interfaces.reporting.base import SimpleBeforeAfterRPT as SimpleBeforeAfter
2930

3031
from ...fit.fieldmap import init_magnitude_wf
3132
from ..registration import init_coeff2epi_wf
@@ -70,9 +71,6 @@ def test_registration_wf(tmpdir, datadir, workdir, outdir):
7071
# fmt: on
7172

7273
if outdir:
73-
from niworkflows.interfaces.reportlets.registration import (
74-
SimpleBeforeAfterRPT as SimpleBeforeAfter,
75-
)
7674
from ...outputs import DerivativesDataSink
7775

7876
report = pe.Node(

sdcflows/workflows/tests/test_ancillary.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import pytest
2525
from nipype.pipeline import engine as pe
2626
from nipype.interfaces import utility as niu
27-
from niworkflows.interfaces.reportlets.masks import SimpleShowMaskRPT
27+
from nireports.interfaces.reporting.masks import SimpleShowMaskRPT
2828
from ..ancillary import init_brainextraction_wf
2929

3030

sdcflows/workflows/tests/test_integration.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# https://www.nipreps.org/community/licensing/
2222
#
2323
"""Test the base workflow."""
24+
2425
from pathlib import Path
2526
import json
2627
import pytest
@@ -31,7 +32,7 @@
3132
from sdcflows.interfaces.reportlets import FieldmapReportlet
3233
from sdcflows.workflows.apply import correction as swac
3334
from sdcflows.workflows.apply import registration as swar
34-
from niworkflows.interfaces.reportlets.registration import (
35+
from nireports.interfaces.reporting.base import (
3536
SimpleBeforeAfterRPT as SimpleBeforeAfter,
3637
)
3738

0 commit comments

Comments
 (0)