@@ -1213,13 +1213,15 @@ class FUGUEInputSpec(FSLCommandInputSpec):
1213
1213
nokspace = traits .Bool (False , argstr = '--nokspace' , desc = 'do not use k-space forward warping' )
1214
1214
1215
1215
# Special outputs: shift (voxel shift map, vsm)
1216
- save_shift = traits .Bool (False , desc = 'write pixel shift volume' )
1216
+ save_shift = traits .Bool (False , xor = ['save_unmasked_shift' ],
1217
+ desc = 'write pixel shift volume' )
1217
1218
shift_out_file = File (argstr = '--saveshift=%s' , desc = 'filename for saving pixel shift volume' )
1218
1219
save_unmasked_shift = traits .Bool (argstr = '--unmaskshift' , xor = ['save_shift' ],
1219
1220
desc = 'saves the unmasked shiftmap when using --saveshift' )
1220
1221
1221
1222
# Special outputs: fieldmap (fmap)
1222
- save_fmap = traits .Bool (False , desc = 'write field map volume' )
1223
+ save_fmap = traits .Bool (False , xor = ['save_unmasked_fmap' ],
1224
+ desc = 'write field map volume' )
1223
1225
fmap_out_file = File (argstr = '--savefmap=%s' , desc = 'filename for saving fieldmap (rad/s)' )
1224
1226
save_unmasked_fmap = traits .Bool (False , argstr = '--unmaskfmap' , xor = ['save_fmap' ],
1225
1227
desc = 'saves the unmasked fieldmap when using --savefmap' )
@@ -1325,46 +1327,56 @@ def _parse_inputs(self, skip=None):
1325
1327
trait_spec .output_name = 'unwarped_file'
1326
1328
1327
1329
# Handle shift output
1328
- vsm_save_masked = isdefined (self .inputs .save_shift ) and self .inputs .save_shift
1329
- vsm_save_unmasked = isdefined (self .inputs .save_unmasked_shift ) \
1330
- and self .inputs .save_unmasked_shift
1330
+ vsm_save_masked = ( isdefined (self .inputs .save_shift ) and self .inputs .save_shift )
1331
+ vsm_save_unmasked = ( isdefined (self .inputs .save_unmasked_shift ) and
1332
+ self .inputs .save_unmasked_shift )
1331
1333
1332
- if (vsm_save_masked or vsm_save_unmasked ) and not isdefined (self .inputs .shift_out_file ):
1334
+ if ((vsm_save_masked or vsm_save_unmasked ) and
1335
+ not isdefined (self .inputs .shift_out_file )):
1333
1336
trait_spec = self .inputs .trait ('shift_out_file' )
1334
- trait_spec .output_name = 'shift_out_file'
1335
-
1336
- if vsm_save_unmasked :
1337
- trait_spec .name_template = '%s_vsm_unmasked'
1338
- else :
1339
- trait_spec .name_template = '%s_vsm'
1340
1337
1341
1338
if input_fmap :
1342
1339
trait_spec .name_source = 'fmap_in_file'
1343
1340
elif input_phase :
1344
1341
trait_spec .name_source = 'phasemap_in_file'
1345
- else :
1342
+ elif input_vsm :
1346
1343
trait_spec .name_source = 'shift_in_file'
1344
+ else :
1345
+ raise RuntimeError (('Either phasemap_in_file, shift_in_file or '
1346
+ 'fmap_in_file must be set.' ))
1347
+
1348
+ trait_spec .output_name = 'shift_out_file'
1349
+
1350
+ if vsm_save_unmasked :
1351
+ trait_spec .name_template = '%s_vsm_unmasked'
1352
+ else :
1353
+ trait_spec .name_template = '%s_vsm'
1347
1354
1348
1355
# Handle fieldmap output
1349
1356
fmap_save_masked = isdefined (self .inputs .save_fmap ) and self .inputs .save_shift
1350
- fmap_save_unmasked = isdefined (self .inputs .save_unmasked_fmap ) and \
1351
- self .inputs .save_unmasked_fmap
1357
+ fmap_save_unmasked = ( isdefined (self .inputs .save_unmasked_fmap ) and
1358
+ self .inputs .save_unmasked_fmap )
1352
1359
1353
- if (fmap_save_masked or fmap_save_unmasked ) and not isdefined (self .inputs .fmap_out_file ):
1360
+ if ((fmap_save_masked or fmap_save_unmasked ) and
1361
+ not isdefined (self .inputs .fmap_out_file )):
1354
1362
trait_spec = self .inputs .trait ('fmap_out_file' )
1355
- trait_spec .output_name = 'fmap_out_file'
1356
-
1357
- if fmap_save_unmasked :
1358
- trait_spec .name_template = '%s_fieldmap_unmasked'
1359
- else :
1360
- trait_spec .name_template = '%s_fieldmap'
1361
1363
1362
1364
if input_vsm :
1363
1365
trait_spec .name_source = 'shift_in_file'
1364
1366
elif input_phase :
1365
1367
trait_spec .name_source = 'phasemap_in_file'
1366
- else :
1368
+ elif input_fmap :
1367
1369
trait_spec .name_source = 'fmap_in_file'
1370
+ else :
1371
+ raise RuntimeError (('Either phasemap_in_file, shift_in_file or '
1372
+ 'fmap_in_file must be set.' ))
1373
+
1374
+ trait_spec .output_name = 'fmap_out_file'
1375
+
1376
+ if fmap_save_unmasked :
1377
+ trait_spec .name_template = '%s_fieldmap_unmasked'
1378
+ else :
1379
+ trait_spec .name_template = '%s_fieldmap'
1368
1380
1369
1381
return super (FUGUE , self )._parse_inputs (skip = skip )
1370
1382
0 commit comments