Skip to content

Commit a4aef11

Browse files
authored
Merge pull request #4 from djarecka/fix_pos
removing fix_position method
2 parents 0be18a9 + 8dd0205 commit a4aef11

File tree

9 files changed

+24
-49
lines changed

9 files changed

+24
-49
lines changed

pydra/tasks/fsl/preprocess/applywarp.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"argstr": "--in={in_file}",
1111
"help_string": "image to be warped",
1212
"mandatory": True,
13-
"position": 2,
13+
"position": 0,
1414
},
1515
),
1616
(
@@ -19,7 +19,7 @@
1919
{
2020
"argstr": "--out={out_file}",
2121
"help_string": "output filename",
22-
"position": 4,
22+
"position": 2,
2323
"output_file_template": "{in_file}_warp",
2424
},
2525
),
@@ -30,7 +30,7 @@
3030
"argstr": "--ref={ref_file}",
3131
"help_string": "reference image",
3232
"mandatory": True,
33-
"position": 3,
33+
"position": 1,
3434
},
3535
),
3636
(
@@ -53,7 +53,7 @@
5353
{
5454
"argstr": "--rel",
5555
"help_string": "treat warp field as relative: x' = x + w(x)",
56-
"position": 1,
56+
"position": -1,
5757
"xor": ["abswarp"],
5858
},
5959
),
@@ -111,7 +111,7 @@
111111
{
112112
"argstr": "--interp={interp}",
113113
"help_string": "interpolation method",
114-
"position": 5,
114+
"position": -2,
115115
},
116116
),
117117
]

pydra/tasks/fsl/preprocess/bet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"argstr": "{in_file}",
1111
"help_string": "input file to skull strip",
1212
"mandatory": True,
13-
"position": 1,
13+
"position": 0,
1414
},
1515
),
1616
(
@@ -19,7 +19,7 @@
1919
{
2020
"argstr": "{out_file}",
2121
"help_string": "name of output skull stripped image",
22-
"position": 2,
22+
"position": 1,
2323
"output_file_template": "{in_file}_brain",
2424
},
2525
),

pydra/tasks/fsl/preprocess/fast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def FAST_output_nclass(field, in_files, nclasses, out_basename):
9797
"copyfile": False,
9898
"help_string": "image, or multi-channel set of images, to be segmented",
9999
"mandatory": True,
100-
"position": 1,
100+
"position": -1,
101101
},
102102
),
103103
(

pydra/tasks/fsl/preprocess/first.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"copyfile": False,
1212
"help_string": "input data file",
1313
"mandatory": True,
14-
"position": 9,
14+
"position": -2,
1515
},
1616
),
1717
(
@@ -21,21 +21,21 @@
2121
"argstr": "-o {out_file}",
2222
"help_string": "output data file",
2323
"mandatory": True,
24-
"position": 1,
24+
"position": -1,
2525
},
2626
),
2727
(
2828
"verbose",
2929
bool,
30-
{"argstr": "-v", "help_string": "Use verbose logging.", "position": 2},
30+
{"argstr": "-v", "help_string": "Use verbose logging.", "position": 1},
3131
),
3232
(
3333
"brain_extracted",
3434
bool,
3535
{
3636
"argstr": "-b",
3737
"help_string": "Input structural image is already brain-extracted",
38-
"position": 3,
38+
"position": 2,
3939
},
4040
),
4141
(
@@ -44,7 +44,7 @@
4444
{
4545
"argstr": "-d",
4646
"help_string": "Input structural image is already brain-extracted",
47-
"position": 4,
47+
"position": 3,
4848
},
4949
),
5050
(
@@ -54,7 +54,7 @@
5454
{
5555
"argstr": "-m {method}",
5656
"help_string": "Method must be one of auto, fast, none, or it can be entered using the 'method_as_numerical_threshold' input",
57-
"position": 6,
57+
"position": 4,
5858
"xor": ["method_as_numerical_threshold"],
5959
},
6060
),
@@ -64,7 +64,7 @@
6464
{
6565
"argstr": "-m {method_as_numerical_threshold:.4f}",
6666
"help_string": "Specify a numerical threshold value or use the 'method' input to choose auto, fast, or none",
67-
"position": 6,
67+
"position": 4,
6868
},
6969
),
7070
(
@@ -73,7 +73,7 @@
7373
{
7474
"argstr": "-s {list_of_specific_structures}",
7575
"help_string": "Runs only on the specified structures (e.g. L_Hipp, R_HippL_Accu, R_Accu, L_Amyg, R_AmygL_Caud, R_Caud, L_Pall, R_PallL_Puta, R_Puta, L_Thal, R_Thal, BrStem",
76-
"position": 7,
76+
"position": 5,
7777
"sep": ",",
7878
},
7979
),
@@ -83,7 +83,7 @@
8383
{
8484
"argstr": "-a {affine_file}",
8585
"help_string": "Affine matrix to use (e.g. img2std.mat) (does not re-run registration)",
86-
"position": 8,
86+
"position": 6,
8787
},
8888
),
8989
]

pydra/tasks/fsl/preprocess/flirt.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"argstr": "-in {in_file}",
1111
"help_string": "input file",
1212
"mandatory": True,
13-
"position": 1,
13+
"position": 0,
1414
},
1515
),
1616
(
@@ -20,7 +20,7 @@
2020
"argstr": "-ref {reference}",
2121
"help_string": "reference file",
2222
"mandatory": True,
23-
"position": 2,
23+
"position": 1,
2424
},
2525
),
2626
(
@@ -29,7 +29,7 @@
2929
{
3030
"argstr": "-out {out_file}",
3131
"help_string": "registered output file",
32-
"position": 3,
32+
"position": 2,
3333
"output_file_template": "{in_file}_flirt",
3434
},
3535
),
@@ -39,7 +39,7 @@
3939
{
4040
"argstr": "-omat {out_matrix_file}",
4141
"help_string": "output affine matrix in 4x4 asciii format",
42-
"position": 4,
42+
"position": 3,
4343
"output_file_template": "{in_file}_flirt.mat",
4444
},
4545
),

pydra/tasks/fsl/preprocess/mcflirt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"argstr": "-in {in_file}",
1111
"help_string": "timeseries to motion-correct",
1212
"mandatory": True,
13-
"position": 1,
13+
"position": 0,
1414
},
1515
),
1616
(

pydra/tasks/fsl/preprocess/slicetimer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"argstr": "--in={in_file}",
1111
"help_string": "filename of input timeseries",
1212
"mandatory": True,
13-
"position": 1,
13+
"position": 0,
1414
},
1515
),
1616
(

pydra/tasks/fsl/preprocess/susan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
{
7070
"argstr": "{out_file}",
7171
"help_string": "output file name",
72-
"position": 7,
72+
"position": -1,
7373
"output_file_template": "{in_file}_smooth",
7474
},
7575
),

tools/converter.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,6 @@ def convert_input_fields(self):
236236
if pos is not None:
237237
position_dict[name] = pos
238238

239-
if position_dict:
240-
fields_pdr_dict = self.fix_position(fields_pdr_dict, position_dict)
241-
242239
fields_pdr_l = list(fields_pdr_dict.values())
243240
return fields_pdr_l, has_template
244241

@@ -400,28 +397,6 @@ def pydra_type_converter(self, field, spec_type, name):
400397
return tp_pdr
401398

402399

403-
def fix_position(self, fields_dict, positions):
404-
""" fixing positions all of the fields"""
405-
positions_list = list(positions.values())
406-
positions_list.sort()
407-
# if positions_list[0] < -1:
408-
# raise Exception("position in nipype interface < -1")
409-
if positions_list[0] <= -1:
410-
positions_list.append(positions_list.pop(0))
411-
412-
positions_map = {}
413-
for ii, el in enumerate(positions_list):
414-
if el != ii + 1:
415-
positions_map[el] = ii + 1
416-
417-
for nm, pos in positions.items():
418-
if pos in positions_map:
419-
# dictionary with metadata should be the last element
420-
fields_dict[nm][-1]["position"] = positions_map[pos]
421-
422-
return fields_dict
423-
424-
425400
def string_formats(self, argstr, name):
426401
import re
427402
if "%s" in argstr:

0 commit comments

Comments
 (0)