Skip to content

unifying output name generation #594

@satra

Description

@satra

This is based on souheil's question on the dev list to rename afni output properly.

some background:

in general for command line interfaces there should be two ways to generate an output name:

  1. explicit specification:
    a) absolute path + name
    b) just name - should be created wherever the underlying interface wants it to - in case of workflow nodes this location might change because the input file may have been symlinked or copied to the local working directory.
  2. automatic generation
    a) specify the input trait from which the output name should be derived.
    b) generate your own name

we used _gen_filename to generate output names for command line specs and _list_outputs for output traits. more recently the name_source parameter 2(a) above was introduced for the afni interfaces and this complicated things.

Furthermore, we need to link up what should be specified on the command line and what should be returned in the outputs. (e.g., os.path.exists cannot magically infer if echo00_bp exists as echo00_bp+orig.HEAD/BRIK)

here is a possible solution:

general idea is to pack as much into the specification and use generic routines - to be overridden when necessary (e.g. afni - removal of +orig).

  • unify generation code. remove all _gen_filename and decorate existing traits that require gen_filename to use name_source metadata together with suffix

  • decorate outputs with name_source as well to minimize list_outputs specification.

    so in trait inputs: out_file = File(..., name_source='in_file', suffix = '_brain')
    and in outputs:
    out_file = File(..., name_source=['out_file'])

this will require a major overhaul - but i feel we should do this soon. i'll send a starting PR over this weekend.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions