# Setting up the second level analysis model node level2design = Node(fsl.MultipleRegressDesign(contrasts=contrastList, regressors=dictReg), name='level2design') dofCalc = Node(interface=Function(input_names=['targetDir', 'desMtx'], output_names=['fileOut'], function=DOFCalc), name='dofCalc') # creating datasink to collect outputs datasink = Node( DataSink(base_directory=os.path.join(outDir, 'DOFCalculation')), name='datasink') # directory where we create a DOF file DOFCalc.inputs.targetDir = datasink.inputs.base_directory # passing on the design matrix to the DOF calculation file DOFCalc.inputs.desMtx = dictReg # passing # creating the workflow dofCalc = Workflow(name="dofCalc", base_dir=outDir) # connecting nodes dofCalc.connect(DOFCalc, 'fileOut', datasink, 'fileOut') # running the workflow dofCalc.run()