Hello, I’m using FSL with nipype and it is unable to find the executable file ‘feat_model’ from fsl, even though it’s definitely in my fsl installation - any suggestions? I must be missing a simple command to help nipype find it…
Code:
import pandas as pd
import glob
from nipype.interfaces.base import Bunch
import nipype.interfaces.fsl as fsl
import nipype.pipeline.engine as pe
import nipype.algorithms.modelgen as model
import os
data_path = '/path/to/my/processed/data/';
os.chdir(data_path)
fsl.FSLCommand.set_default_output_type('NIFTI_GZ')
#Set up model fitting workflow
modelfit = pe.Workflow(name='modelfit')
# Use nipype.algorithms.modelgen.SpecifyModel to generate design information
modelspec = pe.Node(interface=model.SpecifyModel(), name="modelspec",output_names="session_info")
modelspec.inputs.input_units = 'secs'
modelspec.inputs.functional_runs = ['/Users/mycomputer/anaconda3/pkgs/nibabel-3.0.0-py_0/site-packages/nibabel/tests/data/functional.nii']
modelspec.inputs.high_pass_filter_cutoff = 0
modelspec.inputs.time_repetition = 0
modelspec.inputs.subject_info = my_subject_info
#Use nipype.interfaces.fsl.Level1Design to generate a run specific fsf file for analysis
level1design = pe.Node(interface=fsl.Level1Design(),
name="level1design",
input_names=['session_info'])
level1design.inputs.interscan_interval = 0
level1design.inputs.bases = {'dgamma':{'derivs': True}}
level1design.inputs.model_serial_correlations=bool(False)
# Use nipype.interfaces.fsl.FEATModel to generate a run specific mat file for use by FILMGLS
modelgen = pe.MapNode(
interface=fsl.FEATModel(),
name='modelgen',
iterfield=['fsf_file', 'ev_files'])
# Use nipype.interfaces.fsl.FILMGLS to estimate a model specified by a mat file and a functional run
modelestimate = pe.MapNode(
interface=fsl.FILMGLS(smooth_autocorr=True, mask_size=5, threshold=1000),
name='modelestimate',
iterfield=['design_file', 'in_file'])
### COMBINE NODES & RUN
modelfit.connect([
(modelspec, level1design, [('session_info', 'session_info')]),
(level1design, modelgen, [('fsf_files', 'fsf_file'), ('ev_files','ev_files')]),
(modelgen, modelestimate, [('design_file', 'design_file')])
])
try:
mdl = modelfit.run()
except(RuntimeError) as err:
print("RuntimeError:", err)
else:
raise