Workflow realign( ) does not work

Im using the following:
import nipype.interfaces.spm as spm
import nipype.pipeline engine as pe

infiles = [ ] # list containing directories to relevant niftii files

realigner = pe.Node(interface = spm.Realign(in_files = infile,
register_to_mean = True),
name = ‘realign’)

workflow = pe.Workflow(name = ‘preproc’)
workflow.base_dir = ‘.’
workflow.run( )

It seems to run but nothing seems to happen. I get the following in message:
171210-08:57:30,814 workflow INFO:
[‘check’, ‘execution’, ‘logging’]
171210-08:57:30,815 workflow INFO:
Running serially.

Process finished with exit code 0

Can you se what may be wrong here?

Nothing seems odd, you are running an empty workflow.

If you are going to run just one interface, maybe the Node+Workflow wrapping is an overkill.

Your code, with only interfaces:

realigner = spm.Realign(in_files=infile, register_to_mean=True)
result = realigner.run()
print(result.outputs)

But, if you still want to use workflows (because you are building something bigger, or whatever other reason), then you’ll need to add the node into the workflow:

r_node = pe.Node(interface=spm.Realign(in_files=in_file, register_to_mean=True), name='realign')
workflow = pe.Workflow(name='preproc')
workflow.base_dir = os.getcwd()
workflow.add_nodes([r_node])
workflow.run()

When you call workflow.connect([...connections...]) Nipype will call that add_nodes() for you. But if you don’t call neither of them, the workflow remains empty and you were calling run() on an empty workflow.