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

KeyError: 'DwellTime' #65

Open
giulia-berto opened this issue Jan 15, 2021 · 7 comments
Open

KeyError: 'DwellTime' #65

giulia-berto opened this issue Jan 15, 2021 · 7 comments
Assignees

Comments

@giulia-berto
Copy link

With the dockerized version v4.1.3-1 I get the following error:

  File "/run.py", line 275, in <module>
    t1_spacing = layout.get_metadata(t1ws[0])["DwellTime"]
KeyError: 'DwellTime'

Any advice? Thanks!

@rhancockn rhancockn self-assigned this Jan 15, 2021
@rhancockn
Copy link
Collaborator

It looks like the JSON sidecar associated with the T1w you are trying to process does not have a 'DwellTime' field. The DwellTime value is required for correcting distortion in the anatomicals. The best solution would be to identify this value and add the field to your JSON file, which you get from DICOM field (0019,1018) / 1e-6. For Siemens, 1/(PixelBandwidth * BaseResolution* ParallelReductionFactorInPlane) might give you right value, if you happen to have those fields in the JSON.

If you are running the pipeline in --processing_mode legacy, without distortion correction, this value isn't needed. I'll update the code to handle this case more gracefully, but an immediate workaround would be to add something like "DwellTime": 0 to your JSON (taking care not to share your BIDS data with this invalid field!)

@rhancockn
Copy link
Collaborator

@rhancockn Add error handling around t1_spacing = layout.get_metadata(t1ws[0])["DwellTime"] (and maybe t2_spacing = layout.get_metadata(t2ws[0])["DwellTime"]). If distortion correction is to be done, throw a descriptive error message about why this field is required. Otherwise, set t1_spacing = 'NONE'.

@giulia-berto
Copy link
Author

Thank you @rhancockn. So if I want to run --processing-mode hcp I'd always need the DwellTime value? Is --processing-mode hcp the default?

@rhancockn
Copy link
Collaborator

rhancockn commented Jan 25, 2021 via email

@daniellekurtin
Copy link

Hiya! I've been trying to run this BIDs/HCP app (https://hub.docker.com/r/bids/hcppipelines) using the dataset from this tutorial (https://bids-apps.neuroimaging.io/tutorial/), and have run into the same error. However, I don't have any access to a JSON file similar to what you've described, despite downloading the tutorial dataset. Is there something I can do to work around this, or am I missing something?

@JohannesWiesner
Copy link

It looks like the JSON sidecar associated with the T1w you are trying to process does not have a 'DwellTime' field. The DwellTime value is required for correcting distortion in the anatomicals. The best solution would be to identify this value and add the field to your JSON file, which you get from DICOM field (0019,1018) / 1e-6. For Siemens, 1/(PixelBandwidth * BaseResolution* ParallelReductionFactorInPlane) might give you right value, if you happen to have those fields in the JSON.

If you are running the pipeline in --processing_mode legacy, without distortion correction, this value isn't needed. I'll update the code to handle this case more gracefully, but an immediate workaround would be to add something like "DwellTime": 0 to your JSON (taking care not to share your BIDS data with this invalid field!)

I tried that but run.py is still complaining about the missing key....

@baxpr
Copy link

baxpr commented May 26, 2022

This is still an issue in docker://bids/hcppipelines:v4.3.0-3 , even with --processing_mode legacy. Setting DwellTime to 0 does serve as a workaround.

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

5 participants