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

[FEATURE] Installation/usage in Python #91

Open
jesse-wei opened this issue May 7, 2023 · 0 comments
Open

[FEATURE] Installation/usage in Python #91

jesse-wei opened this issue May 7, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@jesse-wei
Copy link
Collaborator

jesse-wei commented May 7, 2023

Currently, the user has to pip install and then download the entry point scripts gui.py and cli.py (cloning not required, however).

In my opinion, downloading those scripts after pip installing already feels a little redundant.

I think the entire application should be accessible from within Python, though that's up to Prof. Styner. If users are familiar with bash and not Python, then the entry point scripts can still be provided.

Some examples:

GUI

>>> from NeuroRuler.GUI import gui
>>> gui()
>>> gui(theme="light", color="b55162")    # Don't really need any keyword args, just modify gui_config.json

This would be done in a Python terminal.

CLI

from pathlib import Path
from NeuroRuler.CLI import cli
cli('image.nrrd', x=2, y=3, z=4)    # Arguments currently not implemented in cli() function since it expects command-line arguments but this is trivially implementable using **kwargs
data_directory: Path = Path('data')
for path in data_directory.iterdir():    # Requires only a little knowledge of Python/pathlib but super easy to pick up
    cli(path, raw=True, threshold_filter='otsu')    # CLI currently doesn't output to an output directory. This is implemented for GUI only atm but would be easy to use that functionality in CLI also

This would likely be in a Python file (script).

Implementation

This would be trivial to implement. The GUI really doesn't need any keyword arguments or CLI args. The user can just modify gui_config.json. Nothing has to change here.

cli() would be changed slightly but not much. The cli.py script already accepts command-line arguments and handles them appropriately. One need only change the definition of cli() to cli(prog_path, **kwargs) and handle the variables in the same way.

@jesse-wei jesse-wei added the enhancement New feature or request label May 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant