Skip to content
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

rename some scripts #878

Merged
merged 4 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions scripts/legacy/scil_detect_dwi_volume_outliers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from scilpy.io.deprecator import deprecate_script
from scripts.scil_dwi_detect_volume_outliers import main as new_main


DEPRECATION_MSG = """
This script has been renamed scil_dwi_detect_volume_outliers.py.
Please change your existing pipelines accordingly.
"""


@deprecate_script("scil_detect_dwi_volume_outliers.py",
DEPRECATION_MSG, '1.7.0')
def main():
new_main()


if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ def main():
dot_product = np.clip(np.tensordot(shell, vec, axes=1), -1, 1)
angle = np.arccos(dot_product) * 180 / math.pi
angle[np.isnan(angle)] = 0

idx = np.argpartition(angle, 4).tolist()
idx.remove(i)

Expand Down
29 changes: 29 additions & 0 deletions scripts/tests/test_dwi_detect_volume_outliers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os
import tempfile

from scilpy.io.fetcher import fetch_data, get_home, get_testing_files_dict

# If they already exist, this only takes 5 seconds (check md5sum)
fetch_data(get_testing_files_dict(), keys=['processing.zip'])
tmp_dir = tempfile.TemporaryDirectory()


def test_help_option(script_runner):
ret = script_runner.run('scil_dwi_detect_volume_outliers.py', '--help')
assert ret.success


def test_execution(script_runner):
os.chdir(os.path.expanduser(tmp_dir.name))
in_dwi = os.path.join(get_home(), 'processing',
'dwi_crop.nii.gz')
in_bval = os.path.join(get_home(), 'processing',
'dwi.bval')
in_bvec = os.path.join(get_home(), 'processing',
'dwi.bvec')
ret = script_runner.run('scil_dwi_detect_volume_outliers.py', in_dwi,
in_bval, in_bvec)
assert ret.success