class DARTELExistingTemplateInputSpec(SPMCommandInputSpec): image_files = traits.List(traits.List(File(exists=True)), desc="A list of files to be segmented", field='warp1.images', copyfile=False, mandatory=True) regularization_form = traits.Enum('Linear', 'Membrane', 'Bending', field='warp1.settings.rform', desc='Form of regularization energy term') iteration_parameters = traits.List(traits.Tuple(traits.Range(1, 10), traits.Tuple(traits.Float, traits.Float, traits.Float), traits.Range(0, 9), traits.File(exists=True)), minlen=3, maxlen=12, mandatory=True, field='warp1.settings.param', desc="""List of tuples for each iteration - Inner iterations - Regularization parameters - Time points for deformation model - DARTEL template """) optimization_parameters = traits.Tuple(traits.Float, traits.Range(1, 8), traits.Range(1, 8), field='warp1.settings.optim', desc="""Optimization settings a tuple - LM regularization - cycles of multigrid solver - relaxation iterations """)
class CoherenceAnalyzerInputSpec(BaseInterfaceInputSpec): #Input either csv file, or time-series object and use _xor_inputs to #discriminate _xor_inputs = ('in_file', 'in_TS') in_file = File(desc=('csv file with ROIs on the columns and ' 'time-points on the rows. ROI names at the top row'), exists=True, requires=('TR', )) #If you gave just a file name, you need to specify the sampling_rate: TR = traits.Float(desc=('The TR used to collect the data' 'in your csv file <in_file>')) in_TS = traits.Any(desc='a nitime TimeSeries object') NFFT = traits.Range( low=32, value=64, usedefault=True, desc=('This is the size of the window used for ' 'the spectral estimation. Use values between ' '32 and the number of samples in your time-series.' '(Defaults to 64.)')) n_overlap = traits.Range( low=0, value=0, usedefault=True, desc=('The number of samples which overlap' 'between subsequent windows.(Defaults to 0)')) frequency_range = traits.List(value=[0.02, 0.15], usedefault=True, minlen=2, maxlen=2, desc=('The range of frequencies over' 'which the analysis will average.' '[low,high] (Default [0.02,0.15]')) output_csv_file = File( desc= 'File to write outputs (coherence,time-delay) with file-names: file_name_ {coherence,timedelay}' ) output_figure_file = File( desc= 'File to write output figures (coherence,time-delay) with file-names: file_name_{coherence,timedelay}. Possible formats: .png,.svg,.pdf,.jpg,...' ) figure_type = traits.Enum('matrix', 'network', usedefault=True, desc=("The type of plot to generate, where " "'matrix' denotes a matrix image and" "'network' denotes a graph representation." " Default: 'matrix'"))
class triplanar_snapshotsInputSpec(BaseInterfaceInputSpec): imgfile = File(exists=True, desc='Image file', mandatory=True) bgimgfile = File(exists=True, desc='Background image file', mandatory=False) vmin = traits.Float(desc='vmin', mandatory=False) vmax = traits.Float(desc='vmax', mandatory=False) cmap = traits.String(desc='cmap', mandatory=False) alpha = traits.Range(low=0.0, high=1.0, desc='alpha', mandatory=False) # higher alpha means more bg visibility x = traits.Range(low=0, desc='x cut', mandatory=False) y = traits.Range(low=0, desc='y cut', mandatory=False) z = traits.Range(low=0, desc='z cut', mandatory=False)
class AIInputSpec(ANTSCommandInputSpec): dimension = traits.Int(3, usedefault=True, argstr='-d %d', desc='dimension of output image') verbose = traits.Bool(False, usedefault=True, argstr='-v %d', desc='enable verbosity') fixed_image = traits.File( exists=True, mandatory=True, desc='Image to which the moving_image should be transformed') moving_image = traits.File( exists=True, mandatory=True, desc='Image that will be transformed to fixed_image') fixed_image_mask = traits.File( exists=True, argstr='-x %s', desc='fixed mage mask') moving_image_mask = traits.File( exists=True, requires=['fixed_image_mask'], desc='moving mage mask') metric_trait = ( traits.Enum("Mattes", "GC", "MI"), traits.Int(32), traits.Enum('Regular', 'Random', 'None'), traits.Range(value=0.2, low=0.0, high=1.0) ) metric = traits.Tuple(*metric_trait, argstr='-m %s', mandatory=True, desc='the metric(s) to use.') transform = traits.Tuple( traits.Enum('Affine', 'Rigid', 'Similarity'), traits.Range(value=0.1, low=0.0, exclude_low=True), argstr='-t %s[%f]', usedefault=True, desc='Several transform options are available') principal_axes = traits.Bool(False, usedefault=True, argstr='-p %d', xor=['blobs'], desc='align using principal axes') search_factor = traits.Tuple( traits.Float(20), traits.Range(value=0.12, low=0.0, high=1.0), usedefault=True, argstr='-s [%f,%f]', desc='search factor') search_grid = traits.Either( traits.Tuple(traits.Float, traits.Tuple(traits.Float, traits.Float, traits.Float)), traits.Tuple(traits.Float, traits.Tuple(traits.Float, traits.Float)), argstr='-g %s', desc='Translation search grid in mm') convergence = traits.Tuple( traits.Range(low=1, high=10000, value=10), traits.Float(1e-6), traits.Range(low=1, high=100, value=10), usedefault=True, argstr='-c [%d,%f,%d]', desc='convergence') output_transform = traits.File( 'initialization.mat', usedefault=True, argstr='-o %s', desc='output file name')
class ApplySegmentationDeformationInput(SPMCommandInputSpec): deformation_field = File( exists=True, mandatory=True, field="comp{1}.def", desc="SPM Segmentation deformation file", ) in_files = InputMultiPath( File(exists=True), mandatory=True, field="out{1}.pull.fnames", desc="Files on which deformation field is applied", ) interpolation = traits.Range( low=0, high=7, field="out{1}.pull.interp", desc="degree of b-spline used for interpolation", ) mask = traits.Int(0, usedefault=True, field="out{1}.pull.mask", desc="image masking") fwhm = traits.List( traits.Float(0), field="out{1}.pull.fwhm", minlen=3, maxlen=3, desc="3-element list (opt)", )
class mosaicInputSpec(BaseInterfaceInputSpec): imgfile = File(exists=True, desc='Image file', mandatory=True) bgimgfile = File(exists=True, desc='Background image file', mandatory=False) vmin = traits.Float(desc='vmin') vmax = traits.Float(desc='vmax') cmap = traits.String(desc='cmap', mandatory=False) alpha = traits.Range(low=0.0, high=1.0, desc='alpha', mandatory=False) # higher alpha means more bg visibility
class _FixTraitFASTInputSpec(FASTInputSpec): bias_iters = traits.Range( low=0, high=10, argstr="-I %d", desc="number of main-loop iterations during bias-field removal", )
class ApplySegmentationDeformationInput(SPMCommandInputSpec): deformation_field = File(exists=True, mandatory=True, field='comp{1}.def', desc='SPM Segmentation deformation file') in_files = InputMultiPath( File(exists=True), mandatory=True, field='out{1}.pull.fnames', desc='Files on which deformation field is applied') interpolation = traits.Range( low=0, high=7, field='out{1}.pull.interp', desc='degree of b-spline used for interpolation') mask = traits.Int(0, usedefault=True, field='out{1}.pull.mask', desc='image masking') fwhm = traits.List(traits.Float(0), field='out{1}.pull.fwhm', minlen=3, maxlen=3, desc='3-element list (opt)')
class ApplyInverseDeformationInput(SPMCommandInputSpec): in_files = InputMultiPath(File(exists=True), mandatory=True, field='fnames', desc='Files on which deformation is applied') target = File(exists=True, field='comp{1}.inv.space', desc='File defining target space') deformation = File(exists=True, field='comp{1}.inv.comp{1}.sn2def.matname', desc='SN SPM deformation file', xor=['deformation_field']) deformation_field = File(exists=True, field='comp{1}.inv.comp{1}.def', desc='SN SPM deformation file', xor=['deformation']) interpolation = traits.Range( low=0, hign=7, field='interp', desc='degree of b-spline used for interpolation') bounding_box = traits.List(traits.Float(), field='comp{1}.inv.comp{1}.sn2def.bb', minlen=6, maxlen=6, desc='6-element list (opt)') voxel_sizes = traits.List(traits.Float(), field='comp{1}.inv.comp{1}.sn2def.vox', minlen=3, maxlen=3, desc='3-element list (opt)')
class DofInputSpec(TraitedSpec): """ """ in_file = File(exists=True, mandatory=True, desc="input file") out_file = File("dof", usedefault=True, desc="output file name") num_regressors = traits.Range(low=1, mandatory=True, desc="number of regressors")
class _SignalExtractionInputSpec(BaseInterfaceInputSpec): in_file = File(exists=True, mandatory=True, desc="4-D fMRI nii file") label_files = InputMultiPath( File(exists=True), mandatory=True, desc="a 3D label image, with 0 denoting " "background, or a list of 3D probability " "maps (one per label) or the equivalent 4D " "file.", ) prob_thres = traits.Range( low=0.0, high=1.0, value=0.5, usedefault=True, desc="If label_files are probability masks, threshold " "at specified probability.", ) class_labels = traits.List( mandatory=True, desc="Human-readable labels for each segment " "in the label file, in order. The length of " "class_labels must be equal to the number of " "segments (background excluded). This list " "corresponds to the class labels in label_file " "in ascending order", ) out_file = File( "signals.tsv", usedefault=True, exists=False, desc="The name of the file to output to. " "signals.tsv by default", )
class _SignalExtractionInputSpec(BaseInterfaceInputSpec): in_file = File(exists=True, mandatory=True, desc='4-D fMRI nii file') label_files = InputMultiPath(File(exists=True), mandatory=True, desc='a 3D label image, with 0 denoting ' 'background, or a list of 3D probability ' 'maps (one per label) or the equivalent 4D ' 'file.') prob_thres = traits.Range( low=0.0, high=1.0, value=0.5, usedefault=True, desc='If label_files are probability masks, threshold ' 'at specified probability.') class_labels = traits.List(mandatory=True, desc='Human-readable labels for each segment ' 'in the label file, in order. The length of ' 'class_labels must be equal to the number of ' 'segments (background excluded). This list ' 'corresponds to the class labels in label_file ' 'in ascending order') out_file = File('signals.tsv', usedefault=True, exists=False, desc='The name of the file to output to. ' 'signals.tsv by default')
class MakeDofVolumeInputSpec(TraitedSpec): dof_file = traits.File(desc="", exists=True) cope_file = traits.File(desc="", exists=True) bold_file = traits.File(exists=True, desc="input file") num_regressors = traits.Range(low=1, desc="number of regressors") design = traits.File(desc="", exists=True)
class _BinaryDilationInputSpec(BaseInterfaceInputSpec): in_file = File(exists=True, mandatory=True, desc="binary file to dilate") radius = traits.Float(3, usedefault=True, desc="structure element (ball) radius") iterations = traits.Range(low=0, value=1, usedefault=True, desc="repeat dilation")
class Label2VolInputSpec(FSTraitedSpec): label_file = InputMultiPath(File(exists=True), argstr='--label %s...', xor=('label_file', 'annot_file', 'seg_file', 'aparc_aseg'), copyfile=False, mandatory=True, desc='list of label files') annot_file = File(exists=True, argstr='--annot %s', xor=('label_file', 'annot_file', 'seg_file', 'aparc_aseg'), requires=('subject_id', 'hemi'), mandatory=True, copyfile=False, desc='surface annotation file') seg_file = File(exists=True, argstr='--seg %s', xor=('label_file', 'annot_file', 'seg_file', 'aparc_aseg'), mandatory=True, copyfile=False, desc='segmentation file') aparc_aseg = traits.Bool(argstr='--aparc+aseg', xor=('label_file', 'annot_file', 'seg_file', 'aparc_aseg'), mandatory=True, desc='use aparc+aseg.mgz in subjectdir as seg') template_file = File(exists=True, argstr='--temp %s', mandatory=True, desc='output template volume') reg_file = File(exists=True, argstr='--reg %s', xor=('reg_file', 'reg_header', 'identity'), desc='tkregister style matrix VolXYZ = R*LabelXYZ') reg_header = File(exists=True, argstr='--regheader %s', xor=('reg_file', 'reg_header', 'identity'), desc='label template volume') identity = traits.Bool(argstr='--identity', xor=('reg_file', 'reg_header', 'identity'), desc='set R=I') invert_mtx = traits.Bool(argstr='--invertmtx', desc='Invert the registration matrix') fill_thresh = traits.Range(0., 1., argstr='--fillthresh %.f', desc='thresh : between 0 and 1') label_voxel_volume = traits.Float(argstr='--labvoxvol %f', desc='volume of each label point (def 1mm3)') proj = traits.Tuple(traits.Enum('abs', 'frac'), traits.Float, traits.Float, traits.Float, argstr='--proj %s %f %f %f', requries=('subject_id', 'hemi'), desc='project along surface normal') subject_id = traits.Str(argstr='--subject %s', desc='subject id') hemi = traits.Enum('lh', 'rh', argstr='--hemi %s', desc='hemisphere to use lh or rh') surface = traits.Str(argstr='--surf %s', desc='use surface instead of white') vol_label_file = File(argstr='--o %s', genfile=True, desc='output volume') label_hit_file = File(argstr='--hits %s', desc='file with each frame is nhits for a label') map_label_stat = File(argstr='--label-stat %s', desc='map the label stats field into the vol') native_vox2ras = traits.Bool(argstr='--native-vox2ras', desc='use native vox2ras xform instead of tkregister-style')
class _NonsteadyStatesDetectorInputSpec(BaseInterfaceInputSpec): in_file = File(exists=True, mandatory=True, desc="BOLD fMRI timeseries") nonnegative = traits.Bool(True, usedefault=True, desc="whether image voxels must be nonnegative") n_volumes = traits.Range( value=40, low=10, high=200, usedefault=True, desc="drop volumes in 4D image beyond this timepoint", ) zero_dummy_masked = traits.Range( value=20, low=2, high=40, usedefault=True, desc= "number of timepoints to average when the number of dummies is zero")
class MeshFixInputSpec(CommandLineInputSpec): number_of_biggest_shells = traits.Int(argstr='--shells %d', desc="Only the N biggest shells are kept") epsilon_angle = traits.Range(argstr='-a %f', low=0.0, high=2.0, desc="Epsilon angle in degrees (must be between 0 and 2)") join_overlapping_largest_components = traits.Bool(argstr='-j', xor=['join_closest_components'], desc='Join 2 biggest components if they overlap, remove the rest.') join_closest_components = traits.Bool(argstr='-jc', xor=['join_closest_components'], desc='Join the closest pair of components.') quiet_mode = traits.Bool(argstr='-q', desc="Quiet mode, don't write much to stdout.") dont_clean = traits.Bool(argstr='--no-clean', desc="Don't Clean") save_as_stl = traits.Bool(xor= ['save_as_vmrl', 'save_as_freesurfer_mesh'], argstr='--stl', desc="Result is saved in stereolithographic format (.stl)") save_as_vmrl = traits.Bool(argstr='--wrl', xor= ['save_as_stl', 'save_as_freesurfer_mesh'], desc="Result is saved in VRML1.0 format (.wrl)") save_as_freesurfer_mesh = traits.Bool(argstr='--fsmesh', xor= ['save_as_vrml', 'save_as_stl'], desc="Result is saved in freesurfer mesh format") remove_handles = traits.Bool(argstr='--remove-handles', desc="Remove handles") uniform_remeshing_steps = traits.Int(argstr='-u %d', requires=['uniform_remeshing_vertices'], desc="Number of steps for uniform remeshing of the whole mesh") uniform_remeshing_vertices = traits.Int(argstr='--vertices %d', requires=['uniform_remeshing_steps'], desc="Constrains the number of vertices." \ "Must be used with uniform_remeshing_steps") laplacian_smoothing_steps = traits.Int(argstr='--smooth %d', desc="The number of laplacian smoothing steps to apply") x_shift = traits.Int(argstr='--smooth %d', desc="Shifts the coordinates of the vertices when saving. Output must be in FreeSurfer format") # Cutting, decoupling, dilation cut_outer = traits.Int(argstr='--cut-outer %d', desc="Remove triangles of 1st that are outside of the 2nd shell.") cut_inner = traits.Int(argstr='--cut-inner %d', desc="Remove triangles of 1st that are inside of the 2nd shell. Dilate 2nd by N; Fill holes and keep only 1st afterwards.") decouple_inin = traits.Int(argstr='--decouple-inin %d', desc="Treat 1st file as inner, 2nd file as outer component." \ "Resolve overlaps by moving inners triangles inwards. Constrain the min distance between the components > d.") decouple_outin = traits.Int(argstr='--decouple-outin %d', desc="Treat 1st file as outer, 2nd file as inner component." \ "Resolve overlaps by moving outers triangles inwards. Constrain the min distance between the components > d.") decouple_outout = traits.Int(argstr='--decouple-outout %d', desc="Treat 1st file as outer, 2nd file as inner component." \ "Resolve overlaps by moving outers triangles outwards. Constrain the min distance between the components > d.") finetuning_inwards = traits.Bool(argstr='--fineTuneIn ', requires=['finetuning_distance', 'finetuning_substeps']) finetuning_outwards = traits.Bool(argstr='--fineTuneIn ', requires=['finetuning_distance', 'finetuning_substeps'], xor=['finetuning_inwards'], desc = 'Similar to finetuning_inwards, but ensures minimal distance in the other direction') finetuning_distance = traits.Float(argstr='%f', requires=['finetuning_substeps'], desc="Used to fine-tune the minimal distance between surfaces." \ "A minimal distance d is ensured, and reached in n substeps. When using the surfaces for subsequent volume meshing by gmsh, this step prevent too flat tetrahedra2)") finetuning_substeps = traits.Int(argstr='%d', requires=['finetuning_distance'], desc="Used to fine-tune the minimal distance between surfaces." \ "A minimal distance d is ensured, and reached in n substeps. When using the surfaces for subsequent volume meshing by gmsh, this step prevent too flat tetrahedra2)") dilation = traits.Int(argstr='--dilate %d', desc="Dilate the surface by d. d < 0 means shrinking.") set_intersections_to_one = traits.Bool(argstr='--intersect', desc="If the mesh contains intersections, return value = 1." \ "If saved in gmsh format, intersections will be highlighted.") in_file1 = File(exists=True, argstr="%s", position=1, mandatory=True) in_file2 = File(exists=True, argstr="%s", position=2) output_type = traits.Enum('off', ['stl', 'msh', 'wrl', 'vrml', 'fs', 'off'], usedefault=True, desc='The output type to save the file as.') out_filename = File(genfile=True, argstr="-o %s", desc='The output filename for the fixed mesh file')
class ResliceInputSpec(SPMCommandInputSpec): in_file = File(exists=True, mandatory=True, desc='file to apply transform to, (only updates header)') space_defining = File(exists=True, mandatory=True, desc='Volume defining space to slice in_file into') interp = traits.Range(low=0, high=7, usedefault=True, desc='degree of b-spline used for interpolation'\ '0 is nearest neighbor (default)') out_file = File(desc='Optional file to save resliced volume')
class _FixHeaderRegistrationInputSpec(_RegistrationInputSpec): restrict_deformation = traits.List( traits.List(traits.Range(low=0.0, high=1.0)), desc=("This option allows the user to restrict the optimization of " "the displacement field, translation, rigid or affine transform " "on a per-component basis. For example, if one wants to limit " "the deformation or rotation of 3-D volume to the first two " "dimensions, this is possible by specifying a weight vector of " "'1x1x0' for a deformation field or '1x1x0x1x1x0' for a rigid " "transformation. Low-dimensional restriction only works if " "there are no preceding transformations."), )
class ThresholdGGMMInputSpec(TraitedSpec): stat_image = File(exists=True, desc='stat images from a t-contrast', copyfile=True, mandatory=True) no_deactivation_class = traits.Bool(False, usedefault=True) mask_file = File(exists=True) models = traits.List() FNR_threshold = traits.Range(low=0.0, high=1.0, exclude_low=True, exclude_high=True)
class ResliceToFirstInputSpec(SPMCommandInputSpec): in_file = InputMultiPath( File(exists=True), mandatory=True, field='fnames', desc='files to apply transform to, (only updates header)') interp = traits.Range(low=0, high=7, usedefault=True, desc='degree of b-spline used for interpolation' '0 is nearest neighbor (default)') out_file = File(desc='Optional file to save resliced volume')
class XFibresInputSpec(FSLCommandInputSpec): dwi = File(exists=True, argstr="--data=%s", mandatory=True) mask = File(exists=True, argstr="--mask=%s", mandatory=True) gradnonlin = File(exists=True, argstr="--gradnonlin=%s") bvecs = File(exists=True, argstr="--bvecs=%s", mandatory=True) bvals = File(exists=True, argstr="--bvals=%s", mandatory=True) logdir = Directory("logdir", argstr="--logdir=%s", usedefault=True) n_fibres = traits.Range( low=1, argstr="--nfibres=%d", desc="Maximum nukmber of fibres to fit in each voxel") fudge = traits.Int(argstr="--fudge=%d", desc="ARD fudge factor") n_jumps = traits.Range(low=1, argstr="--njumps=%d", desc="Num of jumps to be made by MCMC") burn_in = traits.Range( low=0, argstr="--burnin=%d", desc="Total num of jumps at start of MCMC to be discarded") burn_in_no_ard = traits.Range( low=0, argstr="--burninnoard=%d", desc="num of burnin jumps before the ard is imposed") sample_every = traits.Range(low=0, argstr="--sampleevery=%d", desc="Num of jumps for each sample (MCMC)") update_proposal_every = traits.Range( low=1, argstr="--updateproposalevery=%d", desc="Num of jumps for each update to the proposal density std (MCMC)") seed = traits.Int(argstr="--seed=%d", desc="seed for pseudo random number generator") model = traits.Int(argstr="--model=%d", desc="Which model to use. \ 1=mono-exponential (default and required for single shell). 2=continous \ exponential (for multi-shell experiments)") _xor_inputs1 = ('no_ard', 'all_ard') no_ard = traits.Bool(argstr="--noard", desc="Turn ARD off on all fibres", xor=_xor_inputs1) all_ard = traits.Bool(argstr="--allard", desc="Turn ARD on on all fibres", xor=_xor_inputs1) _xor_inputs2 = ('no_spat', 'non_linear') no_spat = traits.Bool(argstr="--nospat", desc="Initialise with tensor, not spatially", xor=_xor_inputs2) non_linear = traits.Bool(argstr="--nonlinear", desc="Initialise with nonlinear fitting", xor=_xor_inputs2) force_dir = traits.Bool( True, desc='use the actual directory name given - i.e. ' + 'do not add + to make a new directory', argstr='--forcedir', usedefault=True)
class InfantReconAllInputSpec(CommandLineInputSpec): subjects_dir = Directory( exists=True, hash_files=False, desc="path to subjects directory", ) subject_id = traits.Str( "recon_all", argstr="--subject %s", desc="subject name", required=True, ) t1_file = File( exists=True, desc="path to T1w file", ) age = traits.Range( low=0, high=24, argstr='--age %d', desc="Subject age in months", ) outdir = Directory( argstr='--outdir %s', desc="Output directory where the reconall results are written." "The default location is <subjects_dir>/<subject_id>", ) mask_file = traits.File( argstr='--masked %s', desc="Skull-stripped and INU-corrected T1 (skips skullstripping step)", ) newborn = traits.Bool( xor=['age'], argstr='--newborn', help="Use newborns from set", ) aseg_file = File( argstr='--segfile %s', desc="Pre-computed segmentation file", )
def __init__(self): """Dedicated to the attributes initialisation/instanciation. The input and output plugs are defined here. The special 'self.requirement' attribute (optional) is used to define the third-party products necessary for the running of the brick. """ # initialisation of the objects needed for the launch of the brick super(Filter_Files_List, self).__init__() # Third party softwares required for the execution of the brick self.requirement = [] # no need of third party software! # Inputs description in_list_desc = 'The list of elements to be filtered.' index_filter_desc = 'A list of 0 to 2 indexes for filtering.' # Outputs description filtered_list_desc = 'The corresponding filtering result (a list).' # Inputs traits self.add_trait( "in_list", traits.List(traits.File, output=False, desc=in_list_desc)) self.add_trait( "index_filter", traits.List(value=[1], trait=traits.Range(low=1, high=None), minlen=0, maxlen=2, output=False, optional=True, desc=index_filter_desc)) # Outputs traits self.add_trait("filtered_list", traits.List(output=True, desc=filtered_list_desc))
class SpecifySparseModelInputSpec(SpecifyModelInputSpec): time_acquisition = traits.Float( 0, mandatory=True, desc="Time in seconds to acquire a single image volume") volumes_in_cluster = traits.Range( 1, usedefault=True, desc="Number of scan volumes in a cluster") model_hrf = traits.Bool(desc="model sparse events with hrf") stimuli_as_impulses = traits.Bool( True, desc="Treat each stimulus to be impulse like.", usedefault=True) use_temporal_deriv = traits.Bool( requires=['model_hrf'], desc="Create a temporal derivative in addition to regular regressor") scale_regressors = traits.Bool(True, desc="Scale regressors by the peak", usedefault=True) scan_onset = traits.Float( 0.0, desc="Start of scanning relative to onset of run in secs", usedefault=True) save_plot = traits.Bool(desc=('save plot of sparse design calculation ' '(Requires matplotlib)'))
class ResliceToReferenceInput(SPMCommandInputSpec): in_files = InputMultiPath( File(exists=True), mandatory=True, field='fnames', desc='Files on which deformation is applied') target = File( exists=True, field='comp{1}.id.space', desc='File defining target space') interpolation = traits.Range( low=0, hign=7, field='interp', desc='degree of b-spline used for interpolation') bounding_box = traits.List( traits.Float(), field='comp{2}.idbbvox.bb', minlen=6, maxlen=6, desc='6-element list (opt)') voxel_sizes = traits.List( traits.Float(), field='comp{2}.idbbvox.vox', minlen=3, maxlen=3, desc='3-element list (opt)')
class mincANTSInput(ANTSCommandInputSpec): dimension = traits.Enum(3, 2, argstr='--dimensionality %d', usedefault=True, desc='image dimension (2 or 3)') fixed_image = InputMultiPath( File(exists=True), mandatory=True, desc='Image to which the moving_image should be transformed' '(usually a structural image)') fixed_image_mask = File( exists=True, argstr='%s', max_ver='2.1.0', xor=['fixed_image_masks'], desc='Mask used to limit metric sampling region of the fixed image' 'in all stages') fixed_image_masks = InputMultiPath( traits.Either('NULL', File(exists=True)), min_ver='2.2.0', xor=['fixed_image_mask'], desc= 'Masks used to limit metric sampling region of the fixed image, defined per registration stage' '(Use "NULL" to omit a mask at a given stage)') moving_image = InputMultiPath( File(exists=True), mandatory=True, desc= 'Image that will be registered to the space of fixed_image. This is the' 'image on which the transformations will be applied to') moving_image_mask = File( exists=True, requires=['fixed_image_mask'], max_ver='2.1.0', xor=['moving_image_masks'], desc='mask used to limit metric sampling region of the moving image' 'in all stages') moving_image_masks = InputMultiPath( traits.Either('NULL', File(exists=True)), min_ver='2.2.0', xor=['moving_image_mask'], desc= 'Masks used to limit metric sampling region of the moving image, defined per registration stage' '(Use "NULL" to omit a mask at a given stage)') save_state = File( argstr='--save-state %s', exists=False, desc= 'Filename for saving the internal restorable state of the registration' ) restore_state = File( argstr='--restore-state %s', exists=True, desc= 'Filename for restoring the internal restorable state of the registration' ) initial_moving_transform = InputMultiPath( File(exists=True), argstr='%s', desc='A transform or a list of transforms that should be applied' 'before the registration begins. Note that, when a list is given,' 'the transformations are applied in reverse order.', xor=['initial_moving_transform_com']) invert_initial_moving_transform = InputMultiPath( traits.Bool(), requires=["initial_moving_transform"], desc='One boolean or a list of booleans that indicate' 'whether the inverse(s) of the transform(s) defined' 'in initial_moving_transform should be used.', xor=['initial_moving_transform_com']) initial_moving_transform_com = traits.Enum( 0, 1, 2, argstr='%s', xor=['initial_moving_transform'], desc="Align the moving_image nad fixed_image befor registration using" "the geometric center of the images (=0), the image intensities (=1)," "or the origin of the images (=2)") metric_item_trait = traits.Enum("CC", "MeanSquares", "Demons", "GC", "MI", "Mattes") metric_stage_trait = traits.Either(metric_item_trait, traits.List(metric_item_trait)) metric = traits.List( metric_stage_trait, mandatory=True, desc='the metric(s) to use for each stage. ' 'Note that multiple metrics per stage are not supported ' 'in ANTS 1.9.1 and earlier.') metric_weight_item_trait = traits.Float(1.0, usedefault=True) metric_weight_stage_trait = traits.Either( metric_weight_item_trait, traits.List(metric_weight_item_trait)) metric_weight = traits.List(metric_weight_stage_trait, value=[1.0], usedefault=True, requires=['metric'], mandatory=True, desc='the metric weight(s) for each stage. ' 'The weights must sum to 1 per stage.') radius_bins_item_trait = traits.Int(5, usedefault=True) radius_bins_stage_trait = traits.Either( radius_bins_item_trait, traits.List(radius_bins_item_trait)) radius_or_number_of_bins = traits.List( radius_bins_stage_trait, value=[5], usedefault=True, requires=['metric_weight'], desc='the number of bins in each stage for the MI and Mattes metric, ' 'the radius for other metrics') sampling_strategy_item_trait = traits.Enum("None", "Regular", "Random", None) sampling_strategy_stage_trait = traits.Either( sampling_strategy_item_trait, traits.List(sampling_strategy_item_trait)) sampling_strategy = traits.List( trait=sampling_strategy_stage_trait, requires=['metric_weight'], desc='the metric sampling strategy (strategies) for each stage') sampling_percentage_item_trait = traits.Either( traits.Range(low=0.0, high=1.0), None) sampling_percentage_stage_trait = traits.Either( sampling_percentage_item_trait, traits.List(sampling_percentage_item_trait)) sampling_percentage = traits.List( trait=sampling_percentage_stage_trait, requires=['sampling_strategy'], desc="the metric sampling percentage(s) to use for each stage") use_estimate_learning_rate_once = traits.List(traits.Bool(), desc='') use_histogram_matching = traits.Either( traits.Bool, traits.List(traits.Bool(argstr='%s')), default=True, usedefault=True, desc='Histogram match the images before registration.') interpolation = traits.Enum('Linear', 'NearestNeighbor', 'CosineWindowedSinc', 'WelchWindowedSinc', 'HammingWindowedSinc', 'LanczosWindowedSinc', 'BSpline', 'MultiLabel', 'Gaussian', argstr='%s', usedefault=True) interpolation_parameters = traits.Either( traits.Tuple(traits.Int()), # BSpline (order) traits.Tuple( traits.Float(), # Gaussian/MultiLabel (sigma, alpha) traits.Float())) write_composite_transform = traits.Bool( argstr='--write-composite-transform %d', default_value=False, usedefault=True, desc='') collapse_output_transforms = traits.Bool( argstr='--collapse-output-transforms %d', default_value=True, usedefault=True, # This should be true for explicit completeness desc=('Collapse output transforms. Specifically, enabling this option ' 'combines all adjacent linear transforms and composes all ' 'adjacent displacement field transforms before writing the ' 'results to disk.')) initialize_transforms_per_stage = traits.Bool( argstr='--initialize-transforms-per-stage %d', default_value=False, usedefault=True, # This should be true for explicit completeness desc= ('Initialize linear transforms from the previous stage. By enabling this option, ' 'the current linear stage transform is directly intialized from the previous ' 'stages linear transform; this allows multiple linear stages to be run where ' 'each stage directly updates the estimated linear transform from the previous ' 'stage. (e.g. Translation -> Rigid -> Affine). ')) # NOTE: Even though only 0=False and 1=True are allowed, ants uses integer # values instead of booleans float = traits.Bool(argstr='--float %d', default_value=False, desc='Use float instead of double for computations.') transforms = traits.List(traits.Enum( 'Rigid', 'Affine', 'CompositeAffine', 'Similarity', 'Translation', 'BSpline', 'GaussianDisplacementField', 'TimeVaryingVelocityField', 'TimeVaryingBSplineVelocityField', 'SyN', 'BSplineSyN', 'Exponential', 'BSplineExponential'), argstr='%s', mandatory=True) # TODO: input checking and allow defaults # All parameters must be specified for BSplineDisplacementField, TimeVaryingBSplineVelocityField, BSplineSyN, # Exponential, and BSplineExponential. EVEN DEFAULTS! transform_parameters = traits.List( traits.Either( traits.Tuple(traits.Float()), # Translation, Rigid, Affine, # CompositeAffine, Similarity traits.Tuple( traits.Float(), # GaussianDisplacementField, SyN traits.Float(), traits.Float()), traits.Tuple( traits.Float(), # BSplineSyn, traits.Int(), # BSplineDisplacementField, traits.Int(), # TimeVaryingBSplineVelocityField traits.Int()), traits.Tuple( traits.Float(), # TimeVaryingVelocityField traits.Int(), traits.Float(), traits.Float(), traits.Float(), traits.Float()), traits.Tuple( traits.Float(), # Exponential traits.Float(), traits.Float(), traits.Int()), traits.Tuple( traits.Float(), # BSplineExponential traits.Int(), traits.Int(), traits.Int(), traits.Int()), )) restrict_deformation = traits.List( traits.List(traits.Enum(0, 1)), desc=("This option allows the user to restrict the optimization of " "the displacement field, translation, rigid or affine transform " "on a per-component basis. For example, if one wants to limit " "the deformation or rotation of 3-D volume to the first two " "dimensions, this is possible by specifying a weight vector of " "'1x1x0' for a deformation field or '1x1x0x1x1x0' for a rigid " "transformation. Low-dimensional restriction only works if " "there are no preceding transformations.")) # Convergence flags number_of_iterations = traits.List(traits.List(traits.Int())) smoothing_sigmas = traits.List(traits.List(traits.Float()), mandatory=True) sigma_units = traits.List(traits.Enum('mm', 'vox'), requires=['smoothing_sigmas'], desc="units for smoothing sigmas") shrink_factors = traits.List(traits.List(traits.Int()), mandatory=True) convergence_threshold = traits.List(trait=traits.Float(), value=[1e-6], minlen=1, requires=['number_of_iterations'], usedefault=True) convergence_window_size = traits.List(trait=traits.Int(), value=[10], minlen=1, requires=['convergence_threshold'], usedefault=True) # Output flags output_transform_prefix = traits.Str("transform", usedefault=True, argstr="%s", desc="") output_warped_image = traits.Either(traits.Bool, File(), hash_files=False, desc="") output_inverse_warped_image = traits.Either( traits.Bool, File(), hash_files=False, requires=['output_warped_image'], desc="") winsorize_upper_quantile = traits.Range( low=0.0, high=1.0, value=1.0, argstr='%s', usedefault=True, desc="The Upper quantile to clip image ranges") winsorize_lower_quantile = traits.Range( low=0.0, high=1.0, value=0.0, argstr='%s', usedefault=True, desc="The Lower quantile to clip image ranges") verbose = traits.Bool(argstr='-v', default_value=False, usedefault=True) out_file = File(argstr="%s", position=-1, desc="image to operate on") in_file = File(exists=True, argstr="%s", position=-2, desc="PET file")
class GLMFitInputSpec(FSTraitedSpec): glm_dir = traits.Str(argstr='--glmdir %s', desc='save outputs to dir', genfile=True) in_file = File(desc='input 4D file', argstr='--y %s', mandatory=True, copyfile=False) _design_xor = ('fsgd', 'design', 'one_sample') fsgd = traits.Tuple(File(exists=True), traits.Enum('doss', 'dods'), argstr='--fsgd %s %s', xor=_design_xor, desc='freesurfer descriptor file') design = File(exists=True, argstr='--X %s', xor=_design_xor, desc='design matrix file') contrast = InputMultiPath(File(exists=True), argstr='--C %s...', desc='contrast file') one_sample = traits.Bool( argstr='--osgm', xor=('one_sample', 'fsgd', 'design', 'contrast'), desc='construct X and C as a one-sample group mean') no_contrast_sok = traits.Bool(argstr='--no-contrasts-ok', desc='do not fail if no contrasts specified') per_voxel_reg = InputMultiPath(File(exists=True), argstr='--pvr %s...', desc='per-voxel regressors') self_reg = traits.Tuple(traits.Int, traits.Int, traits.Int, argstr='--selfreg %d %d %d', desc='self-regressor from index col row slice') weighted_ls = File(exists=True, argstr='--wls %s', xor=('weight_file', 'weight_inv', 'weight_sqrt'), desc='weighted least squares') fixed_fx_var = File(exists=True, argstr='--yffxvar %s', desc='for fixed effects analysis') fixed_fx_dof = traits.Int(argstr='--ffxdof %d', xor=['fixed_fx_dof_file'], desc='dof for fixed effects analysis') fixed_fx_dof_file = File( argstr='--ffxdofdat %d', xor=['fixed_fx_dof'], desc='text file with dof for fixed effects analysis') weight_file = File(exists=True, xor=['weighted_ls'], desc='weight for each input at each voxel') weight_inv = traits.Bool(argstr='--w-inv', desc='invert weights', xor=['weighted_ls']) weight_sqrt = traits.Bool(argstr='--w-sqrt', desc='sqrt of weights', xor=['weighted_ls']) fwhm = traits.Range(low=0.0, argstr='--fwhm %f', desc='smooth input by fwhm') var_fwhm = traits.Range(low=0.0, argstr='--var-fwhm %f', desc='smooth variance by fwhm') no_mask_smooth = traits.Bool(argstr='--no-mask-smooth', desc='do not mask when smoothing') no_est_fwhm = traits.Bool(argstr='--no-est-fwhm', desc='turn off FWHM output estimation') mask_file = File(exists=True, argstr='--mask %s', desc='binary mask') label_file = File(exists=True, argstr='--label %s', xor=['cortex'], desc='use label as mask, surfaces only') cortex = traits.Bool(argstr='--cortex', xor=['label_file'], desc='use subjects ?h.cortex.label as label') invert_mask = traits.Bool(argstr='--mask-inv', desc='invert mask') prune = traits.Bool( argstr='--prune', desc= 'remove voxels that do not have a non-zero value at each frame (def)') no_prune = traits.Bool(argstr='--no-prune', xor=['prunethresh'], desc='do not prune') prune_thresh = traits.Float(argstr='--prune_thr %f', xor=['noprune'], desc='prune threshold. Default is FLT_MIN') compute_log_y = traits.Bool( argstr='--logy', desc='compute natural log of y prior to analysis') save_estimate = traits.Bool(argstr='--yhat-save', desc='save signal estimate (yhat)') save_residual = traits.Bool(argstr='--eres-save', desc='save residual error (eres)') save_res_corr_mtx = traits.Bool( argstr='--eres-scm', desc='save residual error spatial correlation matrix (eres.scm). Big!') surf = traits.Bool(argstr="--surf %s %s %s", requires=["subject_id", "hemi"], desc="analysis is on a surface mesh") subject_id = traits.Str(desc="subject id for surface geometry") hemi = traits.Enum("lh", "rh", desc="surface hemisphere") surf_geo = traits.Str("white", usedefault=True, desc="surface geometry name (e.g. white, pial)") simulation = traits.Tuple(traits.Enum('perm', 'mc-full', 'mc-z'), traits.Int(min=1), traits.Float, traits.Str, argstr='--sim %s %d %f %s', desc='nulltype nsim thresh csdbasename') sim_sign = traits.Enum('abs', 'pos', 'neg', argstr='--sim-sign %s', desc='abs, pos, or neg') uniform = traits.Tuple(traits.Float, traits.Float, argstr='--uniform %f %f', desc='use uniform distribution instead of gaussian') pca = traits.Bool(argstr='--pca', desc='perform pca/svd analysis on residual') calc_AR1 = traits.Bool(argstr='--tar1', desc='compute and save temporal AR1 of residual') save_cond = traits.Bool( argstr='--save-cond', desc='flag to save design matrix condition at each voxel') vox_dump = traits.Tuple(traits.Int, traits.Int, traits.Int, argstr='--voxdump %d %d %d', desc='dump voxel GLM and exit') seed = traits.Int(argstr='--seed %d', desc='used for synthesizing noise') synth = traits.Bool(argstr='--synth', desc='replace input with gaussian') resynth_test = traits.Int(argstr='--resynthtest %d', desc='test GLM by resynthsis') profile = traits.Int(argstr='--profile %d', desc='niters : test speed') force_perm = traits.Bool( argstr='--perm-force', desc='force perumtation test, even when design matrix is not orthog') diag = traits.Int('--diag %d', desc='Gdiag_no : set diagnositc level') diag_cluster = traits.Bool( argstr='--diag-cluster', desc='save sig volume and exit from first sim loop') debug = traits.Bool(argstr='--debug', desc='turn on debugging') check_opts = traits.Bool( argstr='--checkopts', desc="don't run anything, just check options and exit") allow_repeated_subjects = traits.Bool( argstr='--allowsubjrep', desc= 'allow subject names to repeat in the fsgd file (must appear before --fsgd' ) allow_ill_cond = traits.Bool(argstr='--illcond', desc='allow ill-conditioned design matrices') sim_done_file = File(argstr='--sim-done %s', desc='create file when simulation finished')
class InterceptOnlyDesignInputSpec(TraitedSpec): n_copes = traits.Range(low=1, desc="number of inputs")
class MBISInputSpec(CommandLineInputSpec): in_files = InputMultiPath( File(exists=True), copyfile=False, desc='image, or multi-channel set of images, ' \ 'to be segmented', argstr='-C %s', position=-1, mandatory=True ) mask = File(exists=True, desc='binary mask file', argstr='-x %s') mask_auto = traits.Bool(desc='channels are implicitly masked', argstr='-M') out_prefix = File( 'outpath', desc='base name of output files', argstr='-o %s', genfile=True) # uses in_file name as basename if none given number_classes = traits.Range(low=2, high=10, argstr='-n %d', desc='number of tissue-type classes', value=3) output_steps = traits.Bool(desc='output intermediate steps', argstr='--output-steps') output_biasfield = traits.Bool(desc='output estimated bias field', argstr='--bias-output') output_biascorrected = traits.Bool(desc='output restored image ' \ '(bias-corrected image)', argstr='--bias-corrected-output') output_stats = File('outcsvfile', desc='output file containing mixture parameters', argstr='--output-stats %s') probability_maps = traits.Bool(desc='outputs a separate binary image for each ' \ 'tissue type', argstr='-g', value=True ) priors = InputMultiPath(File(exist=True), desc='initialize with prior images', argstr='-P %s', minlen=3, maxlen=10) no_bias = traits.Bool(desc='do not remove bias field', argstr='--bias-skip', value=True) em_iters = traits.Range(low=1, high=50, value=3, desc='number of EM iterations', argstr='--em-iterations %d') mrf_iters = traits.Range(low=1, high=10, desc='number of MRF iterations', argstr='--mrf-iterations %d') mrf_lambda = traits.Range( low=0.01, high=1.0, desc='MRF lambda parameter (segmentation spatial smoothness)', argstr='-l %.3f') manual_init = File(exists=True, desc='Filename containing intensities', argstr='-f %s') manual_init_means = File(exists=True, desc='Filename containing intensities', argstr='--init-means %s')