Skip to content

CLI: Remove use of output "prefixes" #3160

@Lestropie

Description

@Lestropie

Related to #3152.

For interfacing with other software ecosystems as opposed to human users, it would be preferable that if a command generates more than one file based on a user-specified path, particularly if that set of files is not necessarily known at compile time, that the command interface require that the user specify an output directory, rather than a string prefix. This would expedite parsing of the command outputs, and also simplify checking of pre-existing filesystem data that clashes with prospective outputs.

Going to attempt here to generate a list of command interfaces that I think should be modified as a single cohesive change.

Fixel command interface

It's possible that this target might not be possible without either addressing #1043 or doing some other workaround.
Many fixel-related commands take the input and output fixel directories as separate command-line options.
If the output directory does not exist, then it is created, and index.mif and directions.mif are copied from the input fixel directory.
However .type_directory_out() enforces that the output directory must not exist.
Even with -force, it will refuse to delete an entire pre-existing directory.
Therefore these commands all have the output directory specified as .type_text(), to avoid the overwrite check.

I see two solutions:

  1. Change .type_directory_out() to accept a bollean specifying whether the directory already existing is OK.
  2. Change all fixel-related commands to have the output fixel data file path as a path in its own right, saving it to whether the user specifies. If the user wants that file to go into a new fixel directory, that has the same index.mif and directions.mif as another fixel directory, then they can make that copy themselves. Personally however I think this is bad practise: there should be no harm in a fixel directory having a new fixel data file created within it, and having multiple fixel directories with exactly the same fixes is redundant. So this would be my preference.

Changelist

  • fixelcfestats: Output fixel directory should be .type_directory_out() rather than .type_text()` (no actual change to behaviour).

  • tck2fixel: Output directory and fixel data file name both specified as .type_text() (see "Fixel command interface" above)

  • 5ttcheck: Change -voxels option so that if multiple input images are provided, it creates a directory in which to store all of the respective masks.

  • mrclusterstats: Change output from a prefix to a directory.

  • connectomestats: Change output from a prefix to a directory.

  • voxel2fixel: See "Fixel command interface" above.

  • connectomeedit: Change input & output to files rather than text.

  • warp2metric: See "Fixel command interface" above.

  • fixelcorrespondence: See "Fixel command interface" above.

  • vectorstats: Change output from a prefix to a directory.

  • connectome2tck: If output is not a single tractogram file, create a directory with the path specified by the user.

  • fixelconvert: Remove command I think.

  • tsfinfo:

    • -ascii option should be an output directory rather than a prefix.
    • Consider moving this out of tsfinfo. tsfconvert would make more sense.
  • tckedit / tckgen: -include_ordered is currently .type_text() whereas others are .type_various(). Ideally all of these would change as per API: Replace .type_various() #3074.

  • mrregister: -linstage.diagnostics.prefix change to output directory.

  • mrview: -capture.folder change from .type_text() to .type_directory_out().

  • fixelcfestats: Change input fixel-fixel connectivity matrix to be .type_directory_in() (should no longer need to catch pre-3.0.0 usage attempts)

  • Look more closely for anything in the Python commands;
    may be something in there that's an implicit string that I won't find with grep?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions