Skip to content
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

ENH: Refactor CLI scripts #347

Merged
merged 2 commits into from Mar 8, 2018
Merged

Conversation

JoostJM
Copy link
Collaborator

@JoostJM JoostJM commented Feb 22, 2018

Combine the pyradiomics and pyradiomicsbatch entry point into 1 joint entry point pyradiomics.
This new entry point operates in batch mode when input to Image|Batch has .csv extension.
In batch mode, Mask argument is ignored. In single mode Mask inputs is required.

Additionally, enables easy multi-threaded extraction by specifying --jobs / -j argument (with integer indicating number of parallel threads to use.
Will only work in batch mode, as extraction is multi-threaded at the case level (1 thread per case).

Removes argument --label / -l, specifying an override label to use is now achieved through specifying -s "label:N", with N being the label value.

Also includes a small update to initialization of the feature extractor:

  • In addition to a string pointing to a parameter file, feature extractor now also accepts a dictionary (top level specifies customization types 'setting', 'imageType' and 'featureClass') as 1st positional argument
  • Regardless of initialization with or without a customization file/dictionary, kwargs passed to the constructor are used to override settings.

cc @Radiomics/developers

Combine the `pyradiomics` and `pyradiomicsbatch` entry point into 1 joint entry point `pyradiomics`.
This new entry point operates in batch mode when input to `Image|Batch` has `.csv` extension.
In batch mode, `Mask` argument is ignored. In single mode `Mask` inputs is required.

Additionally, enables easy multi-threaded extraction by specifying `--jobs` / `-j` argument (with integer indicating number of parallel threads to use.
Will only work in batch mode, as extraction is multi-threaded at the case level (1 thread per case).

Removes argument `--label` / `-l`, specifying an override label to use is now achieved through specifying `-s "label:N"`, with N being the label value.

Also includes a small update to initialization of the feature extractor:
- In addition to a string pointing to a parameter file, feature extractor now also accepts a dictionary (top level specifies customization types 'setting', 'imageType' and 'featureClass') as 1st positional argument
- Regardless of initialization with or without a customization file/dictionary, `kwargs` passed to the constructor are used to override settings.
@pieper
Copy link
Contributor

pieper commented Feb 22, 2018

Maybe for now include a stub entrypoint for pyradiomicsbatch that issues an error and pointer to the documentation for switching to the new style.

@JoostJM
Copy link
Collaborator Author

JoostJM commented Feb 26, 2018

  • Add documentation on new CLI
  • Retain pyradiomicsbatch as deprecated stub
  • Add removed --label argument as deprecated optional argument?

Additionally, re-add the `pyradiomicsbatch` as a deprecated entry point to preserve legacy functionality. Also re-add the `--label` argument as a deprecated argument in the `pyradiomics` entry point.
@JoostJM JoostJM requested a review from pieper March 3, 2018 08:20
@pieper
Copy link
Contributor

pieper commented Mar 7, 2018

lgtm 👍

@JoostJM JoostJM merged commit dffb440 into AIM-Harvard:master Mar 8, 2018
@JoostJM JoostJM deleted the refactor-clis branch March 8, 2018 10:39
JoostJM added a commit to AIM-Harvard/SlicerRadiomics that referenced this pull request Mar 21, 2018
Recently a [PR](AIM-Harvard/pyradiomics#347) was merged in PyRadiomics, refactoring the commandline interface. Update the SlicerRadiomics module to work with the new functionality.

Additionally, fix a bug when requesting the XML from the SlicerRadiomicsScript (due to a name change, it is now necessary to cut off "Script").
JoostJM added a commit to AIM-Harvard/SlicerRadiomics that referenced this pull request Apr 30, 2018
Remove use .bat and .sh wrapper script, and instead define the CLI entry point as a python script.
This makes use of the new Slicer functionality described in Slicer/Slicer#894 and implemented in r27143-r27145.

This fixes #43.

Additionally, check if a `--label <label>` argument is present, and if so, update it to the new-style: `--setting=label:<label>`. Parameter `--label` is deprecated by PR AIM-Harvard/pyradiomics#347.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants