|
| 1 | +from __future__ import unicode_literals |
| 2 | +from ..preprocess import BBRegister, BBRegisterInputSpec6 |
| 3 | + |
| 4 | + |
| 5 | +def test_BBRegister_inputs(): |
| 6 | + input_map_5_3 = dict( |
| 7 | + args=dict(argstr='%s',), |
| 8 | + contrast_type=dict(argstr='--%s', mandatory=True,), |
| 9 | + environ=dict(nohash=True, usedefault=True,), |
| 10 | + epi_mask=dict(argstr='--epi-mask',), |
| 11 | + ignore_exception=dict(nohash=True, usedefault=True,), |
| 12 | + init=dict(argstr='--init-%s', mandatory=True, xor=['init_reg_file'],), |
| 13 | + init_reg_file=dict(argstr='--init-reg %s', mandatory=True, xor=['init'],), |
| 14 | + intermediate_file=dict(argstr='--int %s',), |
| 15 | + out_fsl_file=dict(argstr='--fslmat %s',), |
| 16 | + out_reg_file=dict(argstr='--reg %s', genfile=True,), |
| 17 | + reg_frame=dict(argstr='--frame %d', xor=['reg_middle_frame'],), |
| 18 | + reg_middle_frame=dict(argstr='--mid-frame', xor=['reg_frame'],), |
| 19 | + registered_file=dict(argstr='--o %s',), |
| 20 | + source_file=dict(argstr='--mov %s', copyfile=False, mandatory=True,), |
| 21 | + spm_nifti=dict(argstr='--spm-nii',), |
| 22 | + subject_id=dict(argstr='--s %s', mandatory=True,), |
| 23 | + subjects_dir=dict(), |
| 24 | + terminal_output=dict(nohash=True,), |
| 25 | + ) |
| 26 | + input_map_6_0 = dict( |
| 27 | + args=dict(argstr='%s',), |
| 28 | + contrast_type=dict(argstr='--%s', mandatory=True,), |
| 29 | + environ=dict(nohash=True, usedefault=True,), |
| 30 | + epi_mask=dict(argstr='--epi-mask',), |
| 31 | + ignore_exception=dict(nohash=True, usedefault=True,), |
| 32 | + init=dict(argstr='--init-%s', xor=['init_reg_file'],), |
| 33 | + init_reg_file=dict(argstr='--init-reg %s', xor=['init'],), |
| 34 | + intermediate_file=dict(argstr='--int %s',), |
| 35 | + out_fsl_file=dict(argstr='--fslmat %s',), |
| 36 | + out_reg_file=dict(argstr='--reg %s', genfile=True,), |
| 37 | + reg_frame=dict(argstr='--frame %d', xor=['reg_middle_frame'],), |
| 38 | + reg_middle_frame=dict(argstr='--mid-frame', xor=['reg_frame'],), |
| 39 | + registered_file=dict(argstr='--o %s',), |
| 40 | + source_file=dict(argstr='--mov %s', copyfile=False, mandatory=True,), |
| 41 | + spm_nifti=dict(argstr='--spm-nii',), |
| 42 | + subject_id=dict(argstr='--s %s', mandatory=True,), |
| 43 | + subjects_dir=dict(), |
| 44 | + terminal_output=dict(nohash=True,), |
| 45 | + ) |
| 46 | + |
| 47 | + instance = BBRegister() |
| 48 | + if isinstance(instance.inputs, BBRegisterInputSpec6): |
| 49 | + input_map = input_map_6_0 |
| 50 | + else: |
| 51 | + input_map = input_map_5_3 |
| 52 | + |
| 53 | + for key, metadata in list(input_map.items()): |
| 54 | + for metakey, value in list(metadata.items()): |
| 55 | + assert getattr(instance.inputs.traits()[key], metakey) == value |
| 56 | + |
| 57 | + |
| 58 | +def test_BBRegister_outputs(): |
| 59 | + output_map = dict(min_cost_file=dict(), |
| 60 | + out_fsl_file=dict(), |
| 61 | + out_reg_file=dict(), |
| 62 | + registered_file=dict(), |
| 63 | + ) |
| 64 | + outputs = BBRegister.output_spec() |
| 65 | + |
| 66 | + for key, metadata in list(output_map.items()): |
| 67 | + for metakey, value in list(metadata.items()): |
| 68 | + assert getattr(outputs.traits()[key], metakey) == value |
0 commit comments