N4ITKBiasFieldCorrection using nipype error

Hi all,

I am just getting started with nipype and trying to perform N4 bias field correction on MR images. Here is the relevant code:

import nipype
import nipype.interfaces.slicer as Slicer

BFC=Slicer.N4ITKBiasFieldCorrection()

BFC.inputs.inputimage= ‘T1.nii.gz’
BFC.inputs.maskimage = ‘mask.nii.gz’
BFC.inputs.outputimage= ‘T1_slicer_n4BFC.nii.gz’
BFC.run()

and I am getting the following error:
231117-11:56:45,217 nipype.interface INFO:
stderr 2023-11-17T11:56:45.217168:terminate called after throwing an instance of ‘slicer_itk::ImageFileReaderException’
231117-11:56:45,218 nipype.interface INFO:
stderr 2023-11-17T11:56:45.217168: what(): /work/Stable/Slicer-0-build/ITK/Modules/IO/ImageBase/include/itkImageFileReader.hxx:132:
231117-11:56:45,218 nipype.interface INFO:
stderr 2023-11-17T11:56:45.217168: Could not create IO object for reading file --inputimage
231117-11:56:45,219 nipype.interface INFO:
stderr 2023-11-17T11:56:45.217168:The file doesn’t exist.
231117-11:56:45,219 nipype.interface INFO:
stderr 2023-11-17T11:56:45.217168:Filename = --inputimage
231117-11:56:45,220 nipype.interface INFO:
stderr 2023-11-17T11:56:45.217168:
231117-11:56:45,331 nipype.interface INFO:
stderr 2023-11-17T11:56:45.331166:Aborted (core dumped)

Just to point out that I have been able to just use the background masking tool successfully just before that code so I presume it is not an installation or PATH issue
masking =Slicer.BRAINSROIAuto()
masking.inputs.inputVolume= ‘T1.nii.gz’
masking.inputs.outputROIMaskVolume= ‘mask.nii.gz’
masking.run()

Moreover, I can open the image using sitk.ReadImage (‘T1.nii.gz’) without any issues.

I am currently out of ideas. Has anyone got any ideas?