Skip to content

Commit 1a76879

Browse files
authored
Merge pull request #10 from nipype/restructured-specs
Restructured specs and task package auto-generation script
2 parents b6cf4d2 + 218acd3 commit 1a76879

24 files changed

+3344
-444
lines changed

README.rst

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,46 @@ specification,
4747

4848
.. code-block:: yaml
4949
50-
task_name: Registration
51-
nipype_module: nipype.interfaces.ants.registration
52-
output_requirements:
53-
output_warped_image: ["fixed_image", "moving_image", "output_transform_prefix"]
54-
output_templates:
55-
output_warped_image: "{output_transform_prefix}warped"
56-
doctest:
57-
fixed_image: test.nii.gz
58-
moving_image: test.nii.gz
59-
cmdline: >-
60-
antsRegistration --output [ output_, output_warped_image.nii.gz ]
61-
--metric Mattes[ test.nii, test.nii, 1, 32, Random, 0.05 ]
62-
tests_inputs: []
63-
tests_outputs:
64-
- AttributeError
50+
task_name: n4_bias_field_correction
51+
nipype_name: N4BiasFieldCorrection
52+
nipype_module: nipype.interfaces.ants.segmentation
53+
inputs:
54+
omit:
55+
# list[str] - fields to omit from the Pydra interface
56+
rename:
57+
# dict[str, str] - fields to rename in the Pydra interface
58+
types:
59+
# dict[str, type] - override inferred types (use "mime-like" string for file-format types,
60+
# e.g. 'medimage/nifti-gz'). For most fields the type will be correctly inferred
61+
# from the nipype interface, but you may want to be more specific, particularly
62+
# for file types, where specifying the format also specifies the file that will be
63+
# passed to the field in the automatically generated unittests.
64+
input_image: medimage/nifti1
65+
mask_image: medimage/nifti1
66+
weight_image: medimage/nifti1
67+
bias_image: medimage/nifti1
68+
metadata:
69+
# dict[str, dict[str, any]] - additional metadata to set on any of the input fields (e.g. out_file: position: 1)
70+
outputs:
71+
omit:
72+
# list[str] - fields to omit from the Pydra interface
73+
rename:
74+
# dict[str, str] - fields to rename in the Pydra interface
75+
types:
76+
# dict[str, type] - override inferred types (use "mime-like" string for file-format types,
77+
# e.g. 'medimage/nifti-gz'). For most fields the type will be correctly inferred
78+
# from the nipype interface, but you may want to be more specific, particularly
79+
# for file types, where specifying the format also specifies the file that will be
80+
# passed to the field in the automatically generated unittests.
81+
output_image: medimage/nifti1
82+
bias_image: medimage/nifti1
83+
callables:
84+
# dict[str, str] - names of methods/callable classes defined in the adjacent `*_callables.py`
85+
# to set to the `callable` attribute of output fields
86+
templates:
87+
# dict[str, str] - `output_file_template` values to be provided to output fields
88+
requirements:
89+
# dict[str, list[str]] - input fields that are required to be provided for the output field to be present
6590
6691
*Detailed description of the different options to go here*
6792

conftest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import tempfile
55
import pytest
66
from click.testing import CliRunner
7+
from fileformats.generic import File
78

89

910
PKG_DIR = Path(__file__).parent
@@ -12,6 +13,11 @@
1213
EXAMPLE_WORKFLOWS_DIR = EXAMPLE_SPECS_DIR / "workflow"
1314

1415

16+
@pytest.fixture
17+
def gen_test_conftest():
18+
return PKG_DIR / "scripts" / "pkg_gen" / "resources" / "conftest.py"
19+
20+
1521
@pytest.fixture(params=[str(p.stem) for p in (EXAMPLE_TASKS_DIR).glob("*.yaml")])
1622
def task_spec_file(request):
1723
return (EXAMPLE_TASKS_DIR / request.param).with_suffix(".yaml")

0 commit comments

Comments
 (0)