I need to merge around 5000 Nifti 3D files into a 4D.
When i use FSL merge in Nipype, it seems that there is a limit to the number of files you can input without crashing.
Above roughly 2200 files I get the following error:
/opt/miniconda-latest/envs/neuro/lib/python3.6/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session)
1362 if errno_num == errno.ENOENT:
1363 err_msg += ': ’ + repr(err_filename)
→ 1364 raise child_exception_type(errno_num, err_msg, err_filename)
1365 raise child_exception_type(err_msg)
OSError: [Errno 7] Argument list too long: ‘/bin/sh’
My Ulimit is set to unlimited so it doesn’t seem to be a bash problem.
Of course I could cut in sub-blocks and then concatenate those blocks but I wonder if I could fond a better workaround first and also understand why this problems occur.