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

Add support for wildcards (*) for several contrasts #74

Open
valosekj opened this issue Jan 10, 2024 · 0 comments
Open

Add support for wildcards (*) for several contrasts #74

valosekj opened this issue Jan 10, 2024 · 0 comments

Comments

@valosekj
Copy link
Member

I wanted to label discs for all T1w and T2w images, so I used the following YML config file with wildcards (*) for several contrasts:

FILES_LABEL:
 - sub-*_T1w.nii.gz
 - sub-*_T2w.nii.gz

However, it turned out that the manual_correction.py script does not support wildcards for multiple contrasts:

$ python manual_correction.py -path-img /Users/user/data/dcm-xxxx/ -config /Users/user/data/dcm-xxxx/label_discs.yml

----------------------------------------------------------------------------------------------------
Parsing of arguments:
  Input folder .............. /Users/user/data/dcm-xxxx
  Label folder .............. /Users/user/data/dcm-xxxx/derivatives/labels
  Output folder ............. /Users/user/data/dcm-xxxx/derivatives/labels
----------------------------------------------------------------------------------------------------
Enter your name (Firstname Lastname). It will be used to generate a json sidecar with each corrected file: Jan user

FILES_LABEL:   0%|                                                                                                                                                                            | 0/2 [00:00<?, ?file/s]
FILES_LABEL:   0%|                                                                                                                                                                            | 0/2 [00:00<?, ?file/s]
Traceback (most recent call last):
  File "/Users/user/code/manual-correction/venv/lib/python3.9/site-packages/nibabel/loadsave.py", line 87, in load
    stat_result = os.stat(filename)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/user/data/dcm-xxxx/sub-*/anat/sub-*_T1w.nii.gz'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/user/code/manual-correction/manual_correction.py", line 904, in <module>
    main()
  File "/Users/user/code/manual-correction/manual_correction.py", line 843, in main
    utils.create_empty_mask(fname, fname_out)
  File "/Users/user/code/manual-correction/utils.py", line 298, in create_empty_mask
    img = nib.load(fname)
  File "/Users/user/code/manual-correction/venv/lib/python3.9/site-packages/nibabel/loadsave.py", line 89, in load
    raise FileNotFoundError(f"No such file or no access: '{filename}'")
FileNotFoundError: No such file or no access: '/Users/user/data/dcm-xxxx/sub-*/anat/sub-*_T1w.nii.gz'

The reason is this condition.

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

No branches or pull requests

1 participant