|
44 | 44 | plot_carpet, |
45 | 45 | plot_dist, |
46 | 46 | plot_fd, |
| 47 | + plot_motion, |
47 | 48 | plot_raincloud, |
48 | 49 | ) |
49 | 50 | 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 |
51 | 52 | from nireports.reportlets.xca import compcor_variance_plot, plot_melodic_components |
52 | 53 | 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 |
54 | 56 | from nireports.tools.timeseries import cifti_timeseries as _cifti_timeseries |
55 | 57 | from nireports.tools.timeseries import get_tr as _get_tr |
56 | 58 | from nireports.tools.timeseries import nifti_timeseries as _nifti_timeseries |
@@ -610,4 +612,24 @@ def test_create_cmap(outdir): |
610 | 612 |
|
611 | 613 |
|
612 | 614 | 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