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 1 commit
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
Prev Previous commit
Next Next commit
quick update
  • Loading branch information
arnaudbore committed Jan 19, 2024
commit b9f25c2e13cac3da591d8a6d39d27bd3862a169b
2 changes: 0 additions & 2 deletions scripts/scil_dwi_detect_volume_outliers.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 77,8 @@ def main():
continue

dot_product = np.clip(np.tensordot(shell, vec, axes=1), -1, 1)
# print(dot_product)
angle = np.arccos(dot_product) * 180 / math.pi
angle[np.isnan(angle)] = 0

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

Expand Down
62 changes: 62 additions & 0 deletions scripts/tests/test_dwi_detect_volume_outliers.py
Original file line number Diff line number Diff line change
@@ -0,0 1,62 @@
#!/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_extract_shell.py', '--help')
assert ret.success


def test_execution_processing_1000(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_extract_shell.py', in_dwi,
in_bval, in_bvec, '0', '1000',
'dwi_crop_1000.nii.gz', '1000.bval', '1000.bvec',
'-t', '30')
assert ret.success


def test_execution_out_indices(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_extract_shell.py', in_dwi,
in_bval, in_bvec, '0', '1000',
'dwi_crop_1000__1.nii.gz', '1000__1.bval',
'1000__1.bvec', '-t', '30', '--out_indices',
'out_indices.txt')
assert ret.success


def test_execution_processing_3000(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_extract_shell.py', in_dwi,
in_bval, in_bvec, '0', '3000',
'dwi_crop_3000.nii.gz', '3000.bval', '3000.bvec',
'-t', '30')
assert ret.success