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 volume scripts #829

Merged
merged 3 commits into from
Dec 5, 2023
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
22 changes: 22 additions & 0 deletions scripts/legacy/scil_apply_transform_to_image.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_volume_apply_transform import main as new_main


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

"""


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


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


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

"""


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


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


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

"""


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


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

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


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


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


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

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


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


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


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

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


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


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


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


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

"""


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


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


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


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


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

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


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


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


if __name__ == "__main__":
main()
6 changes: 3 additions & 3 deletions scripts/legacy/scil_split_volume_by_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
# -*- coding: utf-8 -*-

from scilpy.io.deprecator import deprecate_script
from scripts.scil_tracking_local import main as new_main
arnaudbore marked this conversation as resolved.
Show resolved Hide resolved
from scripts.scil_labels_split_volume_by_ids import main as new_main


DEPRECATION_MSG = """
This script has been renamed scil_labels_split_volume_by_ids.
This script has been renamed scil_labels_split_volume_by_ids.py.
Now, all our scripts using labels start with scil_labels_...!

Please change your existing pipelines accordingly.
"""


@deprecate_script("scil_split_volume_by_is.py", DEPRECATION_MSG, '1.7.0')
@deprecate_script("scil_split_volume_by_ids.py", DEPRECATION_MSG, '1.7.0')
def main():
arnaudbore marked this conversation as resolved.
Show resolved Hide resolved
new_main()

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
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_snr_in_roi.py', '--help')
ret = script_runner.run('scil_dwi_compute_snr.py', '--help')
assert ret.success


Expand All @@ -29,7 +29,7 @@ def test_snr(script_runner):
noise_mask = os.path.join(get_home(), 'processing',
'small_roi_gm_mask.nii.gz')

ret = script_runner.run('scil_snr_in_roi.py', in_dwi,
ret = script_runner.run('scil_dwi_compute_snr.py', in_dwi,
in_bval, in_bvec, in_mask,
'--noise_mask', noise_mask,
'--b0_thr', '10')
Expand Down
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_apply_transform_to_image.py', '--help')
ret = script_runner.run('scil_volume_apply_transform.py', '--help')
assert ret.success


Expand All @@ -25,7 +25,7 @@ def test_execution_bst(script_runner):
'fa.nii.gz')
in_aff = os.path.join(get_home(), 'bst',
'output0GenericAffine.mat')
ret = script_runner.run('scil_apply_transform_to_image.py',
ret = script_runner.run('scil_volume_apply_transform.py',
in_model, in_fa, in_aff,
'template_lin.nii.gz', '--inverse')
assert ret.success
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@


def test_help_option(script_runner):
ret = script_runner.run('scil_count_non_zero_voxels.py', '--help')
ret = script_runner.run('scil_volume_count_non_zero_voxels.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_count_non_zero_voxels.py', in_img)
ret = script_runner.run('scil_volume_count_non_zero_voxels.py', in_img)
assert ret.success
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@


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


def test_execution_surface_vtk_fib(script_runner):
os.chdir(os.path.expanduser(tmp_dir.name))
in_fa = os.path.join(get_home(), 'surface_vtk_fib',
'fa.nii.gz')
ret = script_runner.run('scil_flip_volume.py', in_fa, 'fa_flip.nii.gz',
ret = script_runner.run('scil_volume_flip.py', in_fa, 'fa_flip.nii.gz',
'x')
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_image_math.py', '--help')
ret = script_runner.run('scil_volume_math.py', '--help')
assert ret.success


Expand All @@ -24,23 +24,23 @@ def test_execution_add(script_runner):
'brainstem_174.nii.gz')
in_img_3 = os.path.join(get_home(), 'atlas',
'brainstem_175.nii.gz')
ret = script_runner.run('scil_image_math.py', 'addition',
ret = script_runner.run('scil_volume_math.py', 'addition',
in_img_1, in_img_2, in_img_3, 'brainstem.nii.gz')
assert ret.success


def test_execution_low_thresh(script_runner):
os.chdir(os.path.expanduser(tmp_dir.name))
in_img = os.path.join(get_home(), 'atlas', 'brainstem.nii.gz')
ret = script_runner.run('scil_image_math.py', 'lower_threshold',
ret = script_runner.run('scil_volume_math.py', 'lower_threshold',
in_img, '1', 'brainstem_bin.nii.gz')
assert ret.success


def test_execution_low_mult(script_runner):
os.chdir(os.path.expanduser(tmp_dir.name))
in_img = os.path.join(get_home(), 'atlas', 'brainstem_bin.nii.gz')
ret = script_runner.run('scil_image_math.py', 'multiplication',
ret = script_runner.run('scil_volume_math.py', 'multiplication',
in_img, '16', 'brainstem_unified.nii.gz')
assert ret.success

Expand All @@ -53,7 +53,7 @@ def test_execution_concatenate(script_runner):
in_img_4 = os.path.join(get_home(), 'atlas', 'ids', '13.nii.gz')
in_img_5 = os.path.join(get_home(), 'atlas', 'ids', '17.nii.gz')
in_img_6 = os.path.join(get_home(), 'atlas', 'ids', '18.nii.gz')
ret = script_runner.run('scil_image_math.py', 'concatenate',
ret = script_runner.run('scil_volume_math.py', 'concatenate',
in_img_1, in_img_2, in_img_3, in_img_4, in_img_5,
in_img_6, 'concat_ids.nii.gz')
assert ret.success
Expand All @@ -65,7 +65,7 @@ def test_execution_concatenate_4D(script_runner):
in_img_2 = os.path.join(get_home(), 'atlas', 'ids', '8_10.nii.gz')
in_img_3 = os.path.join(get_home(), 'atlas', 'ids', '12.nii.gz')
in_img_4 = os.path.join(get_home(), 'atlas', 'ids', '8_10.nii.gz')
ret = script_runner.run('scil_image_math.py', 'concatenate',
ret = script_runner.run('scil_volume_math.py', 'concatenate',
in_img_1, in_img_2, in_img_3, in_img_4,
'concat_ids_4d.nii.gz')
assert ret.success
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@


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


def test_execution_processing(script_runner):
os.chdir(os.path.expanduser(tmp_dir.name))
in_ad = os.path.join(get_home(), 'processing',
'ad.nii.gz')
ret = script_runner.run('scil_remove_outliers_ransac.py', in_ad,
ret = script_runner.run('scil_volume_remove_outliers_ransac.py', in_ad,
'ad_ransanc.nii.gz')
assert ret.success
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@


def test_help_option(script_runner):
ret = script_runner.run('scil_resample_volume.py', '--help')
ret = script_runner.run('scil_volume_resample.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',
'fa.nii.gz')
ret = script_runner.run('scil_resample_volume.py', in_img,
ret = script_runner.run('scil_volume_resample.py', in_img,
'fa_resample.nii.gz', '--voxel_size', '2')
assert ret.success
Loading