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

Only 1 modality, but nnUNET reads it as 3 #2177

Open
Alice715324 opened this issue May 10, 2024 · 4 comments
Open

Only 1 modality, but nnUNET reads it as 3 #2177

Alice715324 opened this issue May 10, 2024 · 4 comments
Assignees

Comments

@Alice715324
Copy link

For the life of me I cannot figure this one out. nnUnet reads my nii.gz file as 3 modalities when it should read it as 1. Anyone encounter this?

@felixkrones
Copy link

felixkrones commented May 12, 2024

Could this be related to issue #2017 and/or PR #2158?

@seziegler
Copy link
Member

Hi @Alice715324 ,

can you please share your dataset.json and the commands you used for preprocessing and training?
What is the error you're seeing?

Best,
Sebastian

@casami3
Copy link

casami3 commented May 18, 2024

I'm having the same problem but with .png format. My .json file looks is:

{"channel_names": {"0": "XAG"}, "labels": {"background": 0, "stenosis": 1}, "numTraining": 1300, "file_ending": ".png"}

And the error that I get on the Prompt is:

Error: Unexpected number of modalities.
Expected: 1.
Got: 3.
Images: ['C:/Users/joanc/OneDrive/Escritorio/UPF/curs2trim3/AABI/proy/nnUNet_raw\Dataset004_Stenosis\imagesTr\Stenosis_1022_0000.png']

Error: Unexpected number of modalities.
Expected: 1.
Got: 3.
Images: ['C:/Users/joanc/OneDrive/Escritorio/UPF/curs2trim3/AABI/proy/nnUNet_raw\Dataset004_Stenosis\imagesTr\Stenosis_1229_0000.png']

Error: Unexpected number of modalities.
Expected: 1.
Got: 3.
Images: ['C:/Users/joanc/OneDrive/Escritorio/UPF/curs2trim3/AABI/proy/nnUNet_raw\Dataset004_Stenosis\imagesTr\Stenosis_1025_0000.png']

Error: Unexpected number of modalities.
Expected: 1.
Got: 3.
Images: ['C:/Users/joanc/OneDrive/Escritorio/UPF/curs2trim3/AABI/proy/nnUNet_raw\Dataset004_Stenosis\imagesTr\Stenosis_1230_0000.png']

Traceback (most recent call last):
File "C:\Users\joanc\anaconda3\envs\aaib\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\joanc\anaconda3\envs\aaib\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\joanc\anaconda3\envs\aaib\Scripts\nnUNetv2_plan_and_preprocess.exe_main
.py", line 7, in
File "C:\Users\joanc\anaconda3\envs\aaib\lib\site-packages\nnunetv2\experiment_planning\plan_and_preprocess_entrypoints.py", line 184, in plan_and_preprocess_entry
extract_fingerprints(args.d, args.fpe, args.npfp, args.verify_dataset_integrity, args.clean, args.verbose)
File "C:\Users\joanc\anaconda3\envs\aaib\lib\site-packages\nnunetv2\experiment_planning\plan_and_preprocess_api.py", line 47, in extract_fingerprints
extract_fingerprint_dataset(d, fingerprint_extractor_class, num_processes, check_dataset_integrity, clean,
File "C:\Users\joanc\anaconda3\envs\aaib\lib\site-packages\nnunetv2\experiment_planning\plan_and_preprocess_api.py", line 30, in extract_fingerprint_dataset
verify_dataset_integrity(join(nnUNet_raw, dataset_name), num_processes)
File "C:\Users\joanc\anaconda3\envs\aaib\lib\site-packages\nnunetv2\experiment_planning\verify_dataset_integrity.py", line 220, in verify_dataset_integrity
raise RuntimeError(
RuntimeError: Some images have errors. Please check text output above to see which one(s) and what's going on.

@seziegler
Copy link
Member

Hi @casami3 ,

for rgb images you need to specify "channel_names": {0: 'R', 1: 'G', 2: 'B'} in your dataset.json.
You can see an example here.
There is also a side note in the documentation here.

Best,
Sebastian

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

4 participants