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

Use os.system instead of subprocess.check_call for FSLeyes and ITKsnap commands #67

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

valosekj
Copy link
Member

FSLeyes often prints a lot of warnings into the CLI (for example, when switching between overlays, changing colormap, etc.). The usage of subprocess.check_call (introduced in 8aa0e3a to replace os.system) terminates the manual_correction.py script in such cases.

This PR thus bring back os.system for FSLeyes and ITKsnap commands.

@NathanMolinier
Copy link
Contributor

NathanMolinier commented Oct 11, 2023

I understand the issue, however I still believe that using os.system is not good (because we are not able to catch ctrl+c commands). To fix this issue I thereby think we should use subprocess.run as done in this example:

 out=subprocess.run(['sct_label_vertebrae',
                                        '-i', img_path,
                                        '-s', seg_path,
                                        '-c', 't2')
                if out.returncode == 0:
                    # no problem detected
                elif out.returncode == codeWarning:
                    # no problem detected
                else:
                   # different problem detected

So we need first to identify the code of this warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants