|
13 | 13 | from __future__ import print_function, division, unicode_literals, absolute_import
|
14 | 14 |
|
15 | 15 | import os
|
16 |
| -#import itertools |
17 | 16 |
|
18 | 17 | from ... import logging
|
19 | 18 | from ..base import (TraitedSpec, File, traits,
|
|
27 | 26 |
|
28 | 27 | class RobustTemplateInputSpec(FSTraitedSpecOpenMP):
|
29 | 28 | # required
|
30 |
| - in_files = InputMultiPath(File(exists=True), mandatory=True, argstr='--mov %s', |
31 |
| - desc='input movable volumes to be aligned to common mean/median template') |
| 29 | + in_files = InputMultiPath( |
| 30 | + File(exists=True), mandatory=True, argstr='--mov %s', |
| 31 | + desc='input movable volumes to be aligned to common mean/median ' |
| 32 | + 'template') |
32 | 33 | out_file = File('mri_robust_template_out.mgz', mandatory=True,
|
33 | 34 | usedefault=True, argstr='--template %s',
|
34 | 35 | desc='output template volume (final mean/median image)')
|
35 |
| - auto_detect_sensitivity = traits.Bool(argstr='--satit', xor=['outlier_sensitivity'], mandatory=True, |
36 |
| - desc='auto-detect good sensitivity (recommended for head or full brain scans)') |
37 |
| - outlier_sensitivity = traits.Float(argstr='--sat %.4f', xor=['auto_detect_sensitivity'], mandatory=True, |
38 |
| - desc='set outlier sensitivity manually (e.g. "--sat 4.685" ). Higher values mean ' + |
39 |
| - 'less sensitivity.') |
| 36 | + auto_detect_sensitivity = traits.Bool( |
| 37 | + argstr='--satit', xor=['outlier_sensitivity'], mandatory=True, |
| 38 | + desc='auto-detect good sensitivity (recommended for head or full ' |
| 39 | + 'brain scans)') |
| 40 | + outlier_sensitivity = traits.Float( |
| 41 | + argstr='--sat %.4f', xor=['auto_detect_sensitivity'], mandatory=True, |
| 42 | + desc='set outlier sensitivity manually (e.g. "--sat 4.685" ). Higher ' |
| 43 | + 'values mean less sensitivity.') |
40 | 44 | # optional
|
41 |
| - transform_outputs = InputMultiPath(File(exists=False), |
42 |
| - argstr='--lta %s', |
43 |
| - desc='output xforms to template (for each input)') |
44 |
| - intensity_scaling = traits.Bool(default_value=False, |
45 |
| - argstr='--iscale', |
46 |
| - desc='allow also intensity scaling (default off)') |
47 |
| - scaled_intensity_outputs = InputMultiPath(File(exists=False), |
48 |
| - argstr='--iscaleout %s', |
49 |
| - desc='final intensity scales (will activate --iscale)') |
50 |
| - subsample_threshold = traits.Int(argstr='--subsample %d', |
51 |
| - desc='subsample if dim > # on all axes (default no subs.)') |
52 |
| - average_metric = traits.Enum('median', 'mean', argstr='--average %d', |
53 |
| - desc='construct template from: 0 Mean, 1 Median (default)') |
54 |
| - initial_timepoint = traits.Int(argstr='--inittp %d', |
55 |
| - desc='use TP# for spacial init (default random), 0: no init') |
56 |
| - fixed_timepoint = traits.Bool(default_value=False, argstr='--fixtp', |
57 |
| - desc='map everthing to init TP# (init TP is not resampled)') |
58 |
| - no_iteration = traits.Bool(default_value=False, argstr='--noit', |
59 |
| - desc='do not iterate, just create first template') |
60 |
| - initial_transforms = InputMultiPath(File(exists=True), |
61 |
| - argstr='--ixforms %s', |
62 |
| - desc='use initial transforms (lta) on source') |
63 |
| - in_intensity_scales = InputMultiPath(File(exists=True), |
64 |
| - argstr='--iscalein %s', |
65 |
| - desc='use initial intensity scales') |
| 45 | + transform_outputs = InputMultiPath( |
| 46 | + File(exists=False), argstr='--lta %s', |
| 47 | + desc='output xforms to template (for each input)') |
| 48 | + intensity_scaling = traits.Bool( |
| 49 | + default_value=False, argstr='--iscale', |
| 50 | + desc='allow also intensity scaling (default off)') |
| 51 | + scaled_intensity_outputs = InputMultiPath( |
| 52 | + File(exists=False), argstr='--iscaleout %s', |
| 53 | + desc='final intensity scales (will activate --iscale)') |
| 54 | + subsample_threshold = traits.Int( |
| 55 | + argstr='--subsample %d', |
| 56 | + desc='subsample if dim > # on all axes (default no subs.)') |
| 57 | + average_metric = traits.Enum( |
| 58 | + 'median', 'mean', argstr='--average %d', |
| 59 | + desc='construct template from: 0 Mean, 1 Median (default)') |
| 60 | + initial_timepoint = traits.Int( |
| 61 | + argstr='--inittp %d', |
| 62 | + desc='use TP# for spacial init (default random), 0: no init') |
| 63 | + fixed_timepoint = traits.Bool( |
| 64 | + default_value=False, argstr='--fixtp', |
| 65 | + desc='map everthing to init TP# (init TP is not resampled)') |
| 66 | + no_iteration = traits.Bool( |
| 67 | + default_value=False, argstr='--noit', |
| 68 | + desc='do not iterate, just create first template') |
| 69 | + initial_transforms = InputMultiPath( |
| 70 | + File(exists=True), argstr='--ixforms %s', |
| 71 | + desc='use initial transforms (lta) on source') |
| 72 | + in_intensity_scales = InputMultiPath( |
| 73 | + File(exists=True), argstr='--iscalein %s', |
| 74 | + desc='use initial intensity scales') |
| 75 | + |
66 | 76 |
|
67 | 77 | class RobustTemplateOutputSpec(TraitedSpec):
|
68 | 78 | out_file = File(
|
@@ -93,8 +103,10 @@ class RobustTemplate(FSCommandOpenMP):
|
93 | 103 | >>> template.cmdline #doctest: +NORMALIZE_WHITESPACE +ALLOW_UNICODE
|
94 | 104 | 'mri_robust_template --satit --average 0 --fixtp --mov structural.nii functional.nii --inittp 1 --noit --template T1.nii --subsample 200'
|
95 | 105 |
|
96 |
| - >>> template.inputs.transform_outputs = ['structural.lta', 'functional.lta'] |
97 |
| - >>> template.inputs.scaled_intensity_outputs = ['structural-iscale.txt', 'functional-iscale.txt'] |
| 106 | + >>> template.inputs.transform_outputs = ['structural.lta', |
| 107 | + ... 'functional.lta'] |
| 108 | + >>> template.inputs.scaled_intensity_outputs = ['structural-iscale.txt', |
| 109 | + ... 'functional-iscale.txt'] |
98 | 110 | >>> template.cmdline #doctest: +NORMALIZE_WHITESPACE +ALLOW_UNICODE
|
99 | 111 | 'mri_robust_template --satit --average 0 --fixtp --mov structural.nii functional.nii --inittp 1 --noit --template T1.nii --iscaleout structural-iscale.txt functional-iscale.txt --subsample 200 --lta structural.lta functional.lta'
|
100 | 112 |
|
@@ -152,9 +164,11 @@ class FuseSegmentationsInputSpec(FSTraitedSpec):
|
152 | 164 | must include the corresponding norm file for all given timepoints \
|
153 | 165 | as well as for the current subject")
|
154 | 166 |
|
| 167 | + |
155 | 168 | class FuseSegmentationsOutputSpec(TraitedSpec):
|
156 | 169 | out_file = File(exists=False, desc="output fused segmentation file")
|
157 | 170 |
|
| 171 | + |
158 | 172 | class FuseSegmentations(FSCommand):
|
159 | 173 |
|
160 | 174 | """ fuse segmentations together from multiple timepoints
|
|
0 commit comments