How to avoid having extra subdirectories created by nipype's MapNode?

Using MapNode results in extra subdirectories in the output of my pipeline.

For example:

fs_iso1mm = MapNode(
    fs.Resample(voxel_size=(1.0, 1.0, 1.0)),

Results in the sub-directories, such as “_fs_iso1mm10” in the final output directory.

How do I avoid the creation of these sub-directories, while still being able to use the subject_id, session_id, etc in the output directory? I have parameterization turned on for my DataSink, because I need to be able to define subdirectories based on subject, session, and datatype (following BIDS) - and I haven’t found a better way to do this.

Things that I thought about were:

  • Using regex_substitution - should work but perhaps not ideal?
  • Using JoinNode?
  • Extending DataSink to allow templates to specify the output.

What problems did you have with regex_substitution?