-
Notifications
You must be signed in to change notification settings - Fork 77
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
ADNI-to-BIDS problem with MRI #955
Comments
Hi @danielliu99 Thanks for reporting. Looking at the stack trace, it seems like there is an issue when converting the XML files to JSON metadata files. That is, when calling this function: clinica/clinica/iotools/converters/adni_to_bids/adni_json.py Lines 533 to 543 in 9d0be93
More precisely, there is a clinica/clinica/iotools/converters/adni_to_bids/adni_json.py Lines 423 to 425 in 9d0be93
There could be multiple reasons for this to happen but I suspect there is something wrong with the XML files downloaded (naming of the files, unexpected content...). |
You can also take a look at the content of the XML files to check that they make sense. They should look like this template that we use for unit testing of these functions: |
Thank you for responding so quickly.
Best |
I tried to run without the
And the last few lines of log are:
There's no other prompt saying the conversion finished, is it as expected? Best |
Hi @danielliu99 Thanks for providing the content of you XML files folder. I don't see anything problematic with the file names and they should be queried as expected. Were you able to open a few of them and inspect their content ? You should have one or more clinica/test/unittests/iotools/converters/adni_to_bids/data/ADNI_123_S_4567_template.xml Line 28 in 9d0be93
You can also try to use the XML parser directly on the XML files and inspect the dictionaries that it returns. There seem to be a problem somewhere for getting some image ID. You could, for example, do something like the following from the xml folder: >>> import os
>>> from clinica.iotools.converters.adni_to_bids.adni_json import _parse_xml_file
>>> data = [_parse_xml_file(xml_file) for xml_file in [f for f in os.listdir(".") if f.endswith(".xml")]]
>>> for d in data:
assert "image_proc_id" in d
This is a good sign, but note that by doing so, you lose some metadata in the conversion process which could be problematic depending on the kind of processing you want to perform afterwards. |
Thanks for your suggestions. This line got an error when looping the data = [_parse_xml_file(xml_file) for xml_file in [f for f in os.listdir(".") if f.endswith(".xml")]] So, I modified your code to see where was wrong: import os
from clinica.iotools.converters.adni_to_bids.adni_json import _parse_xml_file
import traceback
xml_path = "/home/liur1/data/ADNI2/xml_path"
os.chdir(xml_path)
for xml_file in [f for f in os.listdir(".") if f.endswith(".xml")]:
try:
d = _parse_xml_file(xml_file)
except Exception as e:
print(xml_file)
traceback.print_exc()
continue Out of the 110 xml files, there are 34 get a same error:
Here's the list of the 34 files:
Intuitively, all these 34 files have a "creationDate" field, while the other succeeded files do not. ADNI_002_S_0295_MT1__N3m_S110476_I241350.txt Thanks |
Hi @danielliu99 Thanks for investigating further and for the sample XML file. As you wrote above, the problem is related to this assertion: clinica/clinica/iotools/converters/adni_to_bids/adni_json.py Lines 123 to 125 in 9d0be93
which makes little sense to me as this will break if the XML file contains a date different from "0000-00-00". Furthermore, the error messages in this function are far from ideal... I opened #957 which should fix this issue and give a bit more information in the error messages. Would you be able to try the conversion using this patch and let me know how it goes ? |
Thank you, @NicolasGensollen I forked the repo and replaced your new adni_json.py into my repo. However, there are 2 errors when I uploaded the output BIDS folder to BIDS Validator (v1.12.0). They are referring to the .tsv file under each session folder. For example:
One is that there's missing column name for the first column. You can check the error log file: By the way, is it mandatory to have all Thanks |
Thanks for experimenting with the patch @danielliu99 ! 👍 Thank you also for the BIDS Validator error report. I opened a different issue from your comment (see #958) since it deals with a different problem. |
Hello,
I get a error with ADNI-to-BIDS conversion with MRI.
I used a small sample to test:
The options I used in search:
I downloaded all clinical data and xml data. Below is the command I used to run the converter:
Then, there's an error in the log:
The complete output is here:
adnitobids_output.txt
But the BIDS folders and corresponding Nifit and tsv files are converted.
Can you suggest me how to locate the cause?
My concerns:
I used Python 3.8 with Clinica 0.7.5.
Thanks!
The text was updated successfully, but these errors were encountered: