|
18 | 18 | import shutil
|
19 | 19 |
|
20 | 20 | from ...utils.filemanip import fname_presuffix, split_filename
|
21 |
| -from ..base import (TraitedSpec, File, traits, OutputMultiPath, isdefined, |
22 |
| - CommandLine, CommandLineInputSpec) |
| 21 | +from ..base import (TraitedSpec, BaseInterface, File, traits, OutputMultiPath, |
| 22 | + isdefined, CommandLine, CommandLineInputSpec) |
23 | 23 | from .base import (FSCommand, FSTraitedSpec,
|
24 | 24 | FSScriptCommand, FSScriptOutputSpec,
|
25 | 25 | FSTraitedSpecOpenMP, FSCommandOpenMP)
|
@@ -2879,3 +2879,64 @@ def _list_outputs(self):
|
2879 | 2879 | outputs = self._outputs().get()
|
2880 | 2880 | outputs["out_file"] = os.path.abspath(self.inputs.out_file)
|
2881 | 2881 | return outputs
|
| 2882 | + |
| 2883 | + |
| 2884 | +class ExpertOptionsInputSpec(TraitedSpec): |
| 2885 | + talairach = traits.String(desc="Flags to pass to talairach commands") |
| 2886 | + mri_normalize = traits.String(desc="Flags to pass to mri_normalize commands") |
| 2887 | + mri_watershed = traits.String(desc="Flags to pass to mri_watershed commands") |
| 2888 | + mri_em_register = traits.String(desc="Flags to pass to mri_em_register commands") |
| 2889 | + mri_ca_normalize = traits.String(desc="Flags to pass to mri_ca_normalize commands") |
| 2890 | + mri_ca_register = traits.String(desc="Flags to pass to mri_ca_register commands") |
| 2891 | + mri_remove_neck = traits.String(desc="Flags to pass to mri_remove_neck commands") |
| 2892 | + mri_ca_label = traits.String(desc="Flags to pass to mri_ca_label commands") |
| 2893 | + mri_segstats = traits.String(desc="Flags to pass to mri_segstats commands") |
| 2894 | + mri_mask = traits.String(desc="Flags to pass to mri_mask commands") |
| 2895 | + mri_segment = traits.String(desc="Flags to pass to mri_segment commands") |
| 2896 | + mri_edit_wm_with_aseg = traits.String(desc="Flags to pass to mri_edit_wm_with_aseg commands") |
| 2897 | + mri_pretess = traits.String(desc="Flags to pass to mri_pretess commands") |
| 2898 | + mri_fill = traits.String(desc="Flags to pass to mri_fill commands") |
| 2899 | + mri_tessellate = traits.String(desc="Flags to pass to mri_tessellate commands") |
| 2900 | + mris_smooth = traits.String(desc="Flags to pass to mri_smooth commands") |
| 2901 | + mris_inflate = traits.String(desc="Flags to pass to mri_inflate commands") |
| 2902 | + mris_sphere = traits.String(desc="Flags to pass to mris_sphere commands") |
| 2903 | + mris_fix_topology = traits.String(desc="Flags to pass to mris_fix_topology commands") |
| 2904 | + mris_make_surfaces = traits.String(desc="Flags to pass to mris_make_surfaces commands") |
| 2905 | + mris_surf2vol = traits.String(desc="Flags to pass to mris_surf2vol commands") |
| 2906 | + mris_register = traits.String(desc="Flags to pass to mris_register commands") |
| 2907 | + mrisp_paint = traits.String(desc="Flags to pass to mrisp_paint commands") |
| 2908 | + mris_ca_label = traits.String(desc="Flags to pass to mris_ca_label commands") |
| 2909 | + mris_anatomical_stats = traits.String(desc="Flags to pass to mris_anatomical_stats commands") |
| 2910 | + mri_aparc2aseg = traits.String(desc="Flags to pass to mri_aparc2aseg commands") |
| 2911 | + out_file = File("expert.opts", usedefault=True, desc="Output expert options file") |
| 2912 | + |
| 2913 | + |
| 2914 | +class ExpertOptionsOutputSpec(TraitedSpec): |
| 2915 | + out_file = File(exists=False, desc="Output expert options file") |
| 2916 | + |
| 2917 | + |
| 2918 | +class ExpertOptions(BaseInterface): |
| 2919 | + """ |
| 2920 | + Creates expert options file |
| 2921 | + https://surfer.nmr.mgh.harvard.edu/fswiki/recon-all#ExpertOptionsFile |
| 2922 | + """ |
| 2923 | + input_spec = ExpertOptionsInputSpec |
| 2924 | + output_spec = ExpertOptionsOutputSpec |
| 2925 | + |
| 2926 | + def _list_outputs(self): |
| 2927 | + outputs = self._outputs().get() |
| 2928 | + outputs["out_file"] = os.path.abspath(self.inputs.out_file) |
| 2929 | + return outputs |
| 2930 | + |
| 2931 | + def _run_interface(self, runtime): |
| 2932 | + out_file = self.inputs.out_file |
| 2933 | + |
| 2934 | + lines = [] |
| 2935 | + for binary, args in self.inputs.get().items(): |
| 2936 | + if binary == 'out_file' or not isdefined(args): |
| 2937 | + continue |
| 2938 | + lines.append('{} {}\n'.format(binary, args)) |
| 2939 | + |
| 2940 | + with open(out_file, 'w') as fobj: |
| 2941 | + fobj.write(''.join(lines)) |
| 2942 | + return runtime |
0 commit comments