Nipype - isdefined error when using combine_mask_files()

Hi all,

I am getting an error using combine_mask_files. As far as I can tell it is because ‘isdefined’ is coming back with True for a none value on line 1256.

Specifically, I call the function as:

import nipype.algorithms.confounds as cfg
fs = [list of two filenames]
nu = cfg.combine_mask_files(mask_files=fs, mask_method="union")

I get:

/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/algorithms/ in combine_mask_files(mask_files, mask_method, mask_index)
   1266                     )
   1267                 )
-> 1268         if mask_index < len(mask_files):
   1269             mask = nb.load(mask_files[mask_index], mmap=NUMPY_MMAP)
   1270             return [mask]

TypeError: '<' not supported between instances of 'NoneType' and 'int'

Am I doing something wrong or is this a bug? Any input much appreciated!


in nipype

Out[5]: True

i don’t think we were expecting that function to be used outside of an interface. to hack it to work, you can do:

from nipype.interfaces.base import Undefined
cfg.combine_mask_files(mask_files=fs, mask_method="union", mask_index=Undefined)

Thanks Satra. I’ll try this next time I need the function :slight_smile: