-
Notifications
You must be signed in to change notification settings - Fork 535
ENH WIP: Use geodesic distance in FramewiseDisplacement #2607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 16 commits
422fbdd
ea9f4dd
9c65c57
9a1cb9d
30098a5
b35fc5e
6199667
8e7f2ee
c74a833
308e622
1e7e550
741f989
8d1b6f6
8fb79c4
8f9ce0f
5856288
0565df4
6089d27
c82b5fb
c9a896c
4177f4e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ def test_FramewiseDisplacement_inputs(): | |
out_figure=dict(usedefault=True, ), | ||
out_file=dict(usedefault=True, ), | ||
parameter_source=dict(mandatory=True, ), | ||
metric=dict(usedefault=True, ), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you re-run |
||
radius=dict(usedefault=True, ), | ||
save_plot=dict(usedefault=True, ), | ||
series_tr=dict(), | ||
|
@@ -21,6 +22,8 @@ def test_FramewiseDisplacement_inputs(): | |
for key, metadata in list(input_map.items()): | ||
for metakey, value in list(metadata.items()): | ||
assert getattr(inputs.traits()[key], metakey) == value | ||
|
||
|
||
def test_FramewiseDisplacement_outputs(): | ||
output_map = dict( | ||
fd_average=dict(), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,10 +17,18 @@ | |
except ImportError: | ||
pass | ||
|
||
nogeomstats = True | ||
try: | ||
import geomstats | ||
nogeomstats = False | ||
except ImportError: | ||
pass | ||
|
||
|
||
def test_fd(tmpdir): | ||
tempdir = tmpdir.strpath | ||
ground_truth = np.loadtxt(example_data('fsl_motion_outliers_fd.txt')) | ||
|
||
fdisplacement = FramewiseDisplacement( | ||
in_file=example_data('fsl_mcflirt_movpar.txt'), | ||
out_file=tempdir + '/fd.txt', | ||
|
@@ -37,6 +45,29 @@ def test_fd(tmpdir): | |
assert np.abs(ground_truth.mean() - res.outputs.fd_average) < 1e-2 | ||
|
||
|
||
@pytest.mark.skipif(nonitime, reason="nitime is not installed") | ||
def test_fd_riemannian(tmpdir): | ||
effigies marked this conversation as resolved.
Show resolved
Hide resolved
|
||
tempdir = tmpdir.strpath | ||
# TODO(nina): Adapt ground_truth w. SPM Euler angles convention | ||
ground_truth = np.loadtxt(example_data('fsl_motion_outliers_fd.txt')) | ||
|
||
fdisplacement = FramewiseDisplacement( | ||
effigies marked this conversation as resolved.
Show resolved
Hide resolved
|
||
in_file=example_data('fsl_mcflirt_movpar.txt'), | ||
out_file=tempdir + '/fd.txt', | ||
parameter_source="FSL", | ||
metric='riemannian') | ||
res = fdisplacement.run() | ||
|
||
with open(res.outputs.out_file) as all_lines: | ||
for line in all_lines: | ||
assert 'FramewiseDisplacement' in line | ||
break | ||
|
||
assert np.allclose( | ||
ground_truth, np.loadtxt(res.outputs.out_file, skiprows=1), atol=.16) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Going to guess we're going to need a different |
||
assert np.abs(ground_truth.mean() - res.outputs.fd_average) < 1e-2 | ||
|
||
|
||
@pytest.mark.skipif(nonitime, reason="nitime is not installed") | ||
def test_dvars(tmpdir): | ||
ground_truth = np.loadtxt(example_data('ds003_sub-01_mc.DVARS')) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for the sake of keeping the diff clean, can you remove this newline?