Skip to content

Commit

Permalink
Merge pull request #828 from arnaudbore/rename_convert_scripts
Browse files Browse the repository at this point in the history
Rename convert scripts
  • Loading branch information
arnaudbore authored Dec 7, 2023
2 parents 9baf955 + e326c9c commit 45ee3ff
Show file tree
Hide file tree
Showing 16 changed files with 124 additions and 8 deletions.
21 changes: 21 additions & 0 deletions scripts/legacy/scil_convert_gradients_fsl_to_mrtrix.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_gradients_convert_fsl_to_mrtrix import main as new_main


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


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


if __name__ == "__main__":
main()
21 changes: 21 additions & 0 deletions scripts/legacy/scil_convert_gradients_mrtrix_to_fsl.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_gradients_convert_mrtrix_to_fsl import main as new_main


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


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


if __name__ == "__main__":
main()
23 changes: 23 additions & 0 deletions scripts/legacy/scil_convert_rgb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

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


DEPRECATION_MSG = """
This script has been renamed scil_rgb_convert.py.
Now, all our scripts using metrics or reconstructions start
with scil_reconst_...!
Please change your existing pipelines accordingly.
"""


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


if __name__ == "__main__":
main()
22 changes: 22 additions & 0 deletions scripts/legacy/scil_convert_tractogram.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

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


DEPRECATION_MSG = """
This script has been renamed scil_tractogram_convert.py.
Now, all our scripts using tractogram start with scil_tractogram_...!
Please change your existing pipelines accordingly.
"""


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


if __name__ == "__main__":
main()
7 changes: 7 additions & 0 deletions scripts/legacy/tests/test_convert_gradients_fsl_to_mrtrix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def test_help_option(script_runner):
ret = script_runner.run('scil_convert_gradients_fsl_to_mrtrix.py', '--help')
assert ret.success
7 changes: 7 additions & 0 deletions scripts/legacy/tests/test_convert_gradients_mrtrix_to_fsl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def test_help_option(script_runner):
ret = script_runner.run('scil_convert_gradients_mrtrix_to_fsl.py', '--help')
assert ret.success
7 changes: 7 additions & 0 deletions scripts/legacy/tests/test_convert_rgb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def test_help_option(script_runner):
ret = script_runner.run('scil_convert_rgb.py', '--help')
assert ret.success
7 changes: 7 additions & 0 deletions scripts/legacy/tests/test_convert_tractogram.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def test_help_option(script_runner):
ret = script_runner.run('scil_convert_tractogram.py', '--help')
assert ret.success
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


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

Expand All @@ -23,6 +23,6 @@ def test_execution_processing(script_runner):
'1000.bval')
in_bvec = os.path.join(get_home(), 'processing',
'1000.bvec')
ret = script_runner.run('scil_convert_gradients_fsl_to_mrtrix.py',
ret = script_runner.run('scil_gradients_convert_fsl_to_mrtrix.py',
in_bval, in_bvec, '1000.b')
assert ret.success
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


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

Expand All @@ -21,6 +21,6 @@ def test_execution_processing(script_runner):
os.chdir(os.path.expanduser(tmp_dir.name))
in_encoding = os.path.join(get_home(), 'processing',
'1000.b')
ret = script_runner.run('scil_convert_gradients_mrtrix_to_fsl.py',
ret = script_runner.run('scil_gradients_convert_mrtrix_to_fsl.py',
in_encoding, '1000.bval', '1000.bvec')
assert ret.success
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@


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


def test_execution_others(script_runner):
os.chdir(os.path.expanduser(tmp_dir.name))
in_img = os.path.join(get_home(), 'others',
'rgb.nii.gz')
ret = script_runner.run('scil_convert_rgb.py', in_img, 'rgb_4D.nii.gz')
ret = script_runner.run('scil_rgb_convert.py',
in_img, 'rgb_4D.nii.gz')
assert ret.success
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


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


Expand All @@ -23,6 +23,6 @@ def test_execution_surface_vtk_fib(script_runner):
'gyri_fanning.fib')
in_fa = os.path.join(get_home(), 'surface_vtk_fib',
'fa.nii.gz')
ret = script_runner.run('scil_convert_tractogram.py', in_fib,
ret = script_runner.run('scil_tractogram_convert.py', in_fib,
'gyri_fanning.trk', '--reference', in_fa)
assert ret.success

0 comments on commit 45ee3ff

Please sign in to comment.