Description
I have some old nipype workflows in a monolithic design, and I have a task to make a more modular, flexible system, for which I want to use Pydra (nipype 2 ecosystem). I am not sure about the right approach to take, or what the best practices to work with neuroimaging interfaces in Pydra are. I'm afraid that I will end up with a mix of Nipype1Task objects, tasks from packages like 'pydra-fsl', manually created neuroimaging interfaces and modules generated with this (nipype2pydra) package. The most desirable approach would be nipype2pydra conversion as it makes all nipype interfaces available, while being able to fine-tune, or correct minor errors in nipype interfaces (e.g. nipype.interfaces.fsl.utils.ImageStats in my experience takes mask_file option incorrectly).
However, I have numerous issues using this package, trying to convert fsl BET using the example specs available:
- First, in the bet.yaml file I changed all medimage/nifti1 and medimage/nifti-gz to generic/file. The nifti1 and nifti-gz filetypes are specifically tied to .nii and .nii.gz respectively, which may not be suitable when both are possible. Is there a way to specify something like a Union in the yaml file?
- The generated module only contains the callables that I included in the yaml, however, it does not include the functions they call (extracted from nipype source code). What I ended up with is copying the bet_callables.py file somewhere near the generated interface module, deleting the callable functions, and importing the whole callables module instead, like: "from .callables.bet_callables import *". I also needed to change the output specs metadata, as the "callable" key contained a string with the name of the corresponding function, instead of a reference to the function itself.
- For the output callables to work, for fsl interfaces at least, "output_type" input is needed to generate the filename with the correct extension, however, it's omitted from the generated module. To change that I needed to remove "output_type" from the TRAITS_IRREL list in the nipype2pydra/interface/base.py source code.
- I tried to create a callable "output_type_default" that simply return a string "NIFTI_GZ" to provide defaults. But the conversion seemingly ignores the inputs:callable_defaults from the yaml file.
- I needed to specify the output:requirements for each output field in the yaml file, which feels redundant, as this information should be available in the nipype interface.
I am very well my be missing something that reduces the manual work needed to create a functional interface from the generated module, but I'm not sure if I'm trying to take the right approach, or I should simply use Nipype1Task from the pydra engine. In fsl BET's case it's not that important, as pydra-fsl has a good interface for it, but in the case of FLIRT, the available pydra interface has no input fields for gray and white matter masks for BBR cost function.
Do you have any suggestions how to best approach the nipype 2.0 ecosystem, from an original nipype user point of view?