NIPYPE workflow connecting nodes syntax error

Hi everyone,

I am trying to connect a simple 3 node workflow using Nipype implemented in Python 3.9. Code is as follows:

import nipype.interfaces.io as nio # Data i/o
import nipype.interfaces.utility as util # utility
import nipype.pipeline.engine as pe # pypeline engine
import nipype.algorithms.misc as misc
import os

importing all interfaces

import nipype.interfaces.mrtrix3 as mrt
from nipype.interfaces import fsl

pass filenames to nodes as abs paths

from nipype import Workflow
from os.path import abspath

select input files

diff = os.path.abspath(’/pathtofile/DTI.nii’)
bvecfile = os.path.abspath(‘pathtofile/DTI.bvec’)
bvalfile = os.path.abspath(‘pathtofile/DTI.bval’)

Initiation of a workflow

wf = Workflow(name=‘preprocDF’, base_dir=‘pathtodir/DTI/’)

convert nifti from fsl format to mrtrix format

nift2mif = Node(mrt.MRConvert(in_file = diff, grad_fsl = (bvecfile, bvalfile)), name = ‘nift2mif’)

denoise the diffusion image

mifdenoise = Node(mrt.DWIDenoise(noise = ‘noise.mif’), name = ‘mifdenoise’)

Remove Gibbs ringing artifacts

dering = Node(mrt.MRDeGibbs(name = ‘dering’)

wf.connect([(nift2mif, mifdenoise, [(‘out_file’, ‘in_file’)]),
(mifdenoise, dering, [(‘out_file’, ‘in_file’)]),

        ])              

It keeps throwing a ‘SyntaxError: invalid syntax’ error in the highlighted line:

wf.connect([(nift2mif, mifdenoise, [(‘out_file’, ‘in_file’)]),

Can anyone with more python experience see where I am going wrong? I have tried looking through the examples and Nipype tutorials and the syntax looks correct to me…

Many thanks,

You are missing a closing parenthesis when removing gibbs ringing artifacts. It should be this:

dering = Node(mrt.MRDeGibbs(name = 'dering'))

Perfect, thats very helpful thank you!