def test_EstimateContrast_inputs(): input_map = dict(beta_images=dict(copyfile=False, mandatory=True, ), contrasts=dict(mandatory=True, ), group_contrast=dict(xor=['use_derivs'], ), ignore_exception=dict(nohash=True, usedefault=True, ), matlab_cmd=dict(), mfile=dict(usedefault=True, ), paths=dict(), residual_image=dict(copyfile=False, mandatory=True, ), spm_mat_file=dict(copyfile=True, field='spmmat', mandatory=True, ), use_derivs=dict(xor=['group_contrast'], ), use_mcr=dict(), use_v8struct=dict(min_ver='8', usedefault=True, ), ) inputs = EstimateContrast.input_spec() for key, metadata in input_map.items(): for metakey, value in metadata.items(): yield assert_equal, getattr(inputs.traits()[key], metakey), value
def test_EstimateContrast_outputs(): output_map = dict(con_images=dict(), ess_images=dict(), spmF_images=dict(), spmT_images=dict(), spm_mat_file=dict(), ) outputs = EstimateContrast.output_spec() for key, metadata in output_map.items(): for metakey, value in metadata.items(): yield assert_equal, getattr(outputs.traits()[key], metakey), value
# ====================================================================== # DEFINE NODE: ESTIMATE MODEL (ESTIMATE THE PARAMETERS OF THE MODEL) # ====================================================================== # function: use spm_spm to estimate the parameters of a model l1estimate = Node(EstimateModel(), name="l1estimate") # input: (a dictionary with keys which are 'Classical' or 'Bayesian2' # or 'Bayesian' and with values which are any value) l1estimate.inputs.estimation_method = {'Classical': 1} # set expected thread and memory usage for the node: l1estimate.interface.num_threads = 1 l1estimate.interface.mem_gb = 2 # ====================================================================== # DEFINE NODE: ESTIMATE CONTRASTS (ESTIMATES THE CONTRASTS) # ====================================================================== # function: use spm_contrasts to estimate contrasts of interest l1contrasts = Node(EstimateContrast(), name="l1contrasts") # input: list of contrasts with each contrast being a list of the form: # [('name', 'stat', [condition list], [weight list], [session list])]: # l1contrasts.inputs.contrasts = l1contrasts_list # node input: overwrite previous results: l1contrasts.overwrite = True # set expected thread and memory usage for the node: l1contrasts.interface.num_threads = 1 l1contrasts.interface.mem_gb = 1.5 # ====================================================================== # DEFINE NODE: FUNCTION TO PLOT CONTRASTS # ====================================================================== plot_contrasts = MapNode(Function(input_names=['anat', 'stat_map', 'thresh'], output_names=['out_path'], function=plot_stat_maps), name='plot_contrasts',