Skip to content

Commit 7dbcf77

Browse files
committed
WIP: Test plot_motion function
Test plot_motion function.
1 parent ce1785f commit 7dbcf77

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

nireports/tests/test_reportlets.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,15 @@
4444
plot_carpet,
4545
plot_dist,
4646
plot_fd,
47+
plot_motion,
4748
plot_raincloud,
4849
)
4950
from nireports.reportlets.surface import cifti_surfaces_plot
50-
from nireports.reportlets.utils import _3d_in_file
51+
from nireports.reportlets.utils import _3d_in_file, load_framewise_displacement
5152
from nireports.reportlets.xca import compcor_variance_plot, plot_melodic_components
5253
from nireports.tests.testing import _create_dtseries_cifti
53-
from nireports.tests.utils import _generate_raincloud_random_data
54+
from nireports.tests.utils import _generate_raincloud_random_data, _write_image
55+
from nireports.tools.ndimage import load_api
5456
from nireports.tools.timeseries import cifti_timeseries as _cifti_timeseries
5557
from nireports.tools.timeseries import get_tr as _get_tr
5658
from nireports.tools.timeseries import nifti_timeseries as _nifti_timeseries
@@ -610,4 +612,24 @@ def test_create_cmap(outdir):
610612

611613

612614
def test_plot_motion(tmp_path):
613-
pass
615+
616+
orig_path = _write_image(tmp_path / "orig.nii.gz", (4, 4, 4, 2))
617+
corr_path = _write_image(tmp_path / "corr.nii.gz", (4, 4, 4, 2))
618+
619+
orig_img = load_api(orig_path, nb.spatialimages.SpatialImage)
620+
corr_img = load_api(corr_path, nb.spatialimages.SpatialImage)
621+
duration = 0.05
622+
623+
fd_values = None # load_framewise_displacement(fd_file)
624+
625+
# svg_file = plot_motion(
626+
# orig_img,
627+
# corr_img,
628+
# tmp_path,
629+
# duration,
630+
# fd_values,
631+
# )
632+
633+
# content = svg_file.read_text()
634+
# assert "frame-0" in content
635+
# assert "animation-delay: 0.05s" in content

0 commit comments

Comments
 (0)