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

bids2nda error message #14

Open
neggink opened this issue May 11, 2018 · 13 comments
Open

bids2nda error message #14

neggink opened this issue May 11, 2018 · 13 comments

Comments

@neggink
Copy link

neggink commented May 11, 2018

Hello,

I am getting the following error:

pni-17c02tw0zmg8wl:desktop neggink$ bids2nda ~/desktop/openneuro/conreact/ ~/desktop/openneuro/GUID_mapping ~/desktop/openneuro/conreact_NDA
Traceback (most recent call last):
File "/Users/neggink/anaconda/bin/bids2nda", line 11, in
load_entry_point('BIDS2NDA==0.1.0', 'console_scripts', 'bids2nda')()
File "/Users/neggink/anaconda/lib/python3.6/site-packages/bids2nda/main.py", line 316, in main
run(args)
File "/Users/neggink/anaconda/lib/python3.6/site-packages/bids2nda/main.py", line 207, in run
image_unit4 = units_dict[nii.header.get_xyzt_units()[1]]
KeyError: 'unknown'

Thanks,
Neggin

@chrisgorgo
Copy link
Contributor

chrisgorgo commented May 11, 2018 via email

@neggink
Copy link
Author

neggink commented May 11, 2018

Yes, it did

@chrisgorgo
Copy link
Contributor

It seem that you have 4D files in your dataset that do not have the units for the fourth dimension defined. This is unexpected. Usually only _bold files are 4D and should define (in the nifti header) what is the unit of the 4th dimension (seconds or milliseconds).

@leej3
Copy link
Contributor

leej3 commented Jun 2, 2018

I have come across this problem too. I think it can be avoided by using dcm2niix for conversion from dicom to nifti. If that is not possible you'll have to modify the nifti header. The xyzt_units encodes both spatial and time dimensions as described here: https://brainder.org/2012/09/23/the-nifti-file-format/

So for a scan using mm (2) and seconds (8) the xyzt would be 2 +8 =10

In python:

import nibabel as nb
nii_path = 'path_to_scan'
img = nb.load(nii_path)
 img.header['xyzt_units'] = 10
img.to_filename(nii_path)

If something so fundamental is broken in the nifti you should strongly consider converting to nifti with dcm2niix though. If that doesn't solve the issue it should be fixed there.

@neggink
Copy link
Author

neggink commented Jul 16, 2018

Hello,
Thank you for all your help, that error was fixed but now I am getting this one:

Traceback (most recent call last):
File "/Users/neggink/anaconda/bin/bids2nda", line 11, in
load_entry_point('BIDS2NDA==0.1.0', 'console_scripts', 'bids2nda')()
File "/Users/neggink/anaconda/lib/python3.6/site-packages/bids2nda/main.py", line 316, in main
run(args)
File "/Users/neggink/anaconda/lib/python3.6/site-packages/bids2nda/main.py", line 159, in run
dict_append(image03_dict, 'scan_type', suffix_to_scan_type[suffix])
KeyError: 'FLASH'

@neggink
Copy link
Author

neggink commented Jul 24, 2018

The NDA has added FLASH files to the 'scan_type' column of their Image03 specification: (https://ndar.nih.gov/data_structure.html?short_name=image03) as "MR structural (FLASH)". Can the converter be modified to include this?

Thanks!

@chrisgorgo
Copy link
Contributor

I don't have time to perform this modification myself, but if you send a pull request I would be happy to merge it

@leej3
Copy link
Contributor

leej3 commented Jul 24, 2018

I can help if you want @neggink . I've done that before

@neggink
Copy link
Author

neggink commented Jul 24, 2018

That would be great @leej3 ! Thank you!!

@leej3
Copy link
Contributor

leej3 commented Jul 24, 2018

Ok I've edited the code. so in an environment that doesn't already contains bids2nda install my code:

git clone https://github.com/leej3/BIDS2NDA.git
cd BIDS2NDA
git checkout add_flash_scantype
pip install -e .

Then try running it on your data and report back. If it works I'll submit it as a pull request.

@neggink
Copy link
Author

neggink commented Jul 24, 2018

It works! Thank you

@leej3
Copy link
Contributor

leej3 commented Jul 24, 2018 via email

@ebarrick
Copy link

Hello,

I'm getting the following error:

from ._conv import register_converters as _register_converters
Traceback (most recent call last):
File "/anaconda2/bin/bids2nda", line 11, in
sys.exit(main())
File "/anaconda2/lib/python2.7/site-packages/bids2nda/main.py", line 317, in main
run(args)
File "/anaconda2/lib/python2.7/site-packages/bids2nda/main.py", line 154, in run
description = suffix + " " + metadata["TaskName"]
KeyError: 'TaskName'

But I'm unsure why this error is occurring.

Thanks!
E

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