HCPPipelines icon indicating copy to clipboard operation
HCPPipelines copied to clipboard

KeyError: 'DwellTime'

Open giulia-berto opened this issue 4 years ago • 7 comments

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!

giulia-berto avatar Jan 15 '21 11:01 giulia-berto

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 avatar Jan 15 '21 14:01 rhancockn

@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'.

rhancockn avatar Jan 15 '21 14:01 rhancockn

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?

giulia-berto avatar Jan 22 '21 14:01 giulia-berto

That's right; the default --processing-mode hcp will require a DwellTime for the T1w and T2w volumes.

On Fri, Jan 22, 2021 at 9:10 AM Giulia Bertò [email protected] wrote:

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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/BIDS-Apps/HCPPipelines/issues/65#issuecomment-765424784, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARMKW54OHANIA44GNAI3ITS3GBMVANCNFSM4WD4OGEQ .

rhancockn avatar Jan 25 '21 14:01 rhancockn

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?

daniellekurtin avatar Jan 28 '21 11:01 daniellekurtin

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....

JohannesWiesner avatar Sep 20 '21 18:09 JohannesWiesner

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.

baxpr avatar May 26 '22 16:05 baxpr