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

redo ExtractROI #47

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions pydra/tasks/fsl/utils/extractroi.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"help_string": "output file",
"argstr": "{roi_file}",
"position": 1,
"output_file_template": "{in_file}_trim",
"output_file_template": "{in_file}_roi",
},
),
("x_min", int, {"help_string": "", "argstr": "{x_min}", "position": 2}),
Expand Down Expand Up @@ -48,9 +48,9 @@ class ExtractROI(ShellCommandTask):
>>> task.inputs.in_file = "test.nii.gz"
>>> task.inputs.t_min = 0
>>> task.inputs.t_size = 3
>>> task.inputs.roi_file = "test_trim.nii.gz"
>>> task.inputs.roi_file = "test_roi.nii.gz"
>>> task.cmdline
'fslroi test.nii.gz test_trim.nii.gz 0 3'
'fslroi test.nii.gz test_roi.nii.gz 0 3'
"""

input_spec = ExtractROI_input_spec
Expand Down
16 changes: 15 additions & 1 deletion pydra/tasks/fsl/utils/tests/test_run_extractroi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,21 @@
@pytest.mark.xfail("FSLDIR" not in os.environ, reason="no FSL found", raises=FileNotFoundError)
@pytest.mark.parametrize(
"inputs, outputs",
[({"in_file": "test.nii.gz", "t_min": 0, "t_size": 1}, ["roi_file"])],
[
({"in_file": "test.nii.gz", "t_min": 0, "t_size": 1}, ["roi_file"]),
(
{
"in_file": "test.nii.gz",
"x_min": 0,
"x_size": 1,
"y_min": 20,
"y_size": 1,
"z_min": 10,
"z_size": 1,
},
["roi_file"],
),
],
)
def test_ExtractROI(test_data, inputs, outputs):
if inputs is None:
Expand Down
16 changes: 15 additions & 1 deletion pydra/tasks/fsl/utils/tests/test_spec_extractroi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,21 @@

@pytest.mark.parametrize(
"inputs, outputs",
[({"in_file": "test.nii.gz", "t_min": 0, "t_size": 1}, ["roi_file"])],
[
({"in_file": "test.nii.gz", "t_min": 0, "t_size": 1}, ["roi_file"]),
(
{
"in_file": "test.nii.gz",
"x_min": 0,
"x_size": 1,
"y_min": 20,
"y_size": 1,
"z_min": 10,
"z_size": 1,
},
["roi_file"],
),
],
)
def test_ExtractROI(test_data, inputs, outputs):
if inputs is None:
Expand Down
14 changes: 11 additions & 3 deletions specs/fsl_utils_param.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,29 @@ ExtractROI:
output_requirements:
roi_file: [in_file]
output_templates:
roi_file: "{in_file}_trim"
roi_file: "{in_file}_roi"
inputs_drop:
- crop_list
doctest:
in_file: test.nii.gz
t_min: 0
t_size: 3
roi_file: test_trim.nii.gz
cmdline: fslroi test.nii.gz test_trim.nii.gz 0 3
roi_file: test_roi.nii.gz
cmdline: fslroi test.nii.gz test_roi.nii.gz 0 3
tests_inputs:
- in_file: test.nii.gz
t_min: 0
t_size: 1
- in_file: test.nii.gz
x_min: 0
x_size: 1
y_min: 20
y_size: 1
z_min: 10
z_size: 1
tests_outputs:
- roi_file
- roi_file

FilterRegressor:
output_requirements:
Expand Down