-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python CLI changes #2678
Python CLI changes #2678
Conversation
Created custom callable classes for handling different datatypes for positional and optional arguments on the command line. Used ArgumentTypeError for exception management instead of ValueError since the former allows allows adding custom error messages.
Added newly defined callables (in app.py) for each positional and optional command line argument of mrtrix_cleanup and dwicat
Updated the logic for TypeBoolean class for consistency with C++ command-line behaviour Added new checks in TypeInputTractogram class for file validation
Added callables for each positional and optional command line argument in dwifslpreproc, dwigradcheck, dwishellmath, labelsgmfix, mask2glass, population_template and responsemean
Co-authored-by: Ankita Sanil <[email protected]>
Used the new syntax as "type=app.Parser.TypeInputImage()" across all Python API commands
…ent) Replaced the traditional for loop with list comprehension in TypeIntegerSequence and TypeFloatSequence classes
Applies to both population-template and mrregister. Makes "none" a valid selection of robust estimator in both cases.
Updated class names across all commands to be in sync with C++ code
Implemented class inheritance to avoid duplicate checks for tractogram input files. Instead, reused the checks from ArgFileIn type via inheritance.
Changes for handling piped images in the Python API scripts. However, this implementation does not include deletion of the temp/piped images at the end of the command execution.
The current implementation is temporary since it doesn't cover all the use-cases. However, it supports a working scenario.
Primarily renaming of classes to more closely echo the modifier functions that are used in the C++ usage() function rather than the enumeration that is hidden from most developers.
Addressing multiple comments in PR #2678.
In particular, it is desired for function make_temporary() to be accessible from within the app module.
Documenting here a gotcha I encountered during the process of merge conflict resolution: Here |
- Fix syntax error in mask2glass introduced in 99dd927. - population_template: F-string syntax fix. - 5ttgen hsvs: Fix execution when input directory path contains whitespace. - app.Parser: Change type of Exception thrown when filesystem path argument is impermissible, so that argparse catches it. - dwi2mask consensus: Allow execution when the -template option is not specified; just omit from the list any algorithms that depend on such. - dwinormalise group: Fix path to population_template scratch directory. - Testing: Many fixes to individual test bash scripts, particularly around the verification of image pipe and filesystem path whitespace characters.
- Restore solution in #2845 not properly propagated through prior merge conflict. - Use FileExistsError when checking for pre-existing output files / directories, and catch it to yield a well-formatted error message. - Update CLI test data to reflect changes in 05b68d5. - Modify tests that check for command error due to inappropriate CLI usage.
Annoying CI failures that I don't think have anything to do with this PR. Linux Clang
(occurs for multiple targets) MSYS2
|
After troubleshooting this for a while (it was quite puzzling), I thought that this was probably caused by some mismatch between For the Windows failure, I'll need to have a further look. |
Awesome, thanks for the effort. |
😬 💣 🙉 💥 |
Supersedes ankitasanil#1.
Somewhat requisite for #2665.
Closes #1392.
Many outstanding requirements as per checkbox list in #1392.