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

ADNI-to-BIDS problem with MRI #955

Closed
danielliu99 opened this issue Aug 18, 2023 · 9 comments · Fixed by #957
Closed

ADNI-to-BIDS problem with MRI #955

danielliu99 opened this issue Aug 18, 2023 · 9 comments · Fixed by #957
Labels
bug Something isn't working converter

Comments

@danielliu99
Copy link

Hello,

I get a error with ADNI-to-BIDS conversion with MRI.

I used a small sample to test:

153_S_4172
135_S_5275
137_S_4672
137_S_4258
136_S_4993
135_S_5015
137_S_4211
137_S_4756

The options I used in search:

  • Project Phase: ADNI 2
  • Visit - OR:
    • ADNI2 Screening-New Pt
    • ADNI2 Screening MRI-New Pt
    • ADNI2 Baseline-New Pt
    • ADNI2 Month 3 MRI-New Pt
    • ADNI2 Month 6-New Pt
    • ADNI2 Initial Visit-Cont Pt
    • ADNI2 Year 1 Visit
    • ADNI2 Year 2 Visit
    • ADNI2 Year 3 Visit
    • ADNI2 Year 4 Visit
    • ADNI2 Year 5 Visit
  • Weighting
    • T1
    • T2
  • Image Types
    • Original
    • Pre-processed
    • Post-processed

I downloaded all clinical data and xml data. Below is the command I used to run the converter:

clinica convert adni-to-bids -sl ./subjects_list.txt --xml_path ./xml_path/ ./ADNI/ ./CLINICAL_DATA ./BIDS/ -m T1

Then, there's an error in the log:

Traceback (most recent call last):
  File "/home/liur1/anaconda/envs/clinicaEnv/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 3802, in get_loc
    return self._engine.get_loc(casted_key)
  File "pandas/_libs/index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 165, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 5745, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 5753, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'image_proc_id'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/liur1/anaconda/envs/clinicaEnv/bin/clinica", line 8, in <module>
    sys.exit(main())
  File "/home/liur1/anaconda/envs/clinicaEnv/lib/python3.8/site-packages/clinica/cmdline.py", line 92, in main
    cli()
  File "/home/liur1/anaconda/envs/clinicaEnv/lib/python3.8/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/liur1/anaconda/envs/clinicaEnv/lib/python3.8/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/liur1/anaconda/envs/clinicaEnv/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/liur1/anaconda/envs/clinicaEnv/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/liur1/anaconda/envs/clinicaEnv/lib/python3.8/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/liur1/anaconda/envs/clinicaEnv/lib/python3.8/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/liur1/anaconda/envs/clinicaEnv/lib/python3.8/site-packages/clinica/iotools/converters/adni_to_bids/adni_to_bids_cli.py", line 74, in cli
    adni_to_bids.convert_clinical_data(
  File "/home/liur1/anaconda/envs/clinicaEnv/lib/python3.8/site-packages/clinica/iotools/converters/adni_to_bids/adni_to_bids.py", line 158, in convert_clinical_data
    create_json_metadata(bids_subjs_paths, bids_ids, xml_path)
  File "/home/liur1/anaconda/envs/clinicaEnv/lib/python3.8/site-packages/clinica/iotools/converters/adni_to_bids/adni_json.py", line 541, in create_json_metadata
    df_meta = _create_mri_meta_df(imgs)
  File "/home/liur1/anaconda/envs/clinicaEnv/lib/python3.8/site-packages/clinica/iotools/converters/adni_to_bids/adni_json.py", line 423, in _create_mri_meta_df
    mri_meta["T1w_scan_id"] = mri_meta["image_proc_id"].combine_first(
  File "/home/liur1/anaconda/envs/clinicaEnv/lib/python3.8/site-packages/pandas/core/frame.py", line 3807, in __getitem__
    indexer = self.columns.get_loc(key)
  File "/home/liur1/anaconda/envs/clinicaEnv/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 3804, in get_loc
    raise KeyError(key) from err
KeyError: 'image_proc_id'

The complete output is here:
adnitobids_output.txt

But the BIDS folders and corresponding Nifit and tsv files are converted.
image

Can you suggest me how to locate the cause?

My concerns:

  1. I downloaded too few samples and missed some necessary files for those subjects.
  2. The clinical dataset have some suffix in their filenames, such as "_11Aug2023", "_06_28_18".

I used Python 3.8 with Clinica 0.7.5.

Thanks!

@danielliu99 danielliu99 added the bug Something isn't working label Aug 18, 2023
@NicolasGensollen
Copy link
Member

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:

def create_json_metadata(bids_subjs_paths: list, bids_ids: list, xml_path: str) -> None:
"""Create json metadata dictionary and add the metadata to the
appropriate files in the BIDS hierarchy."""
from clinica.iotools.converters.adni_to_bids.adni_utils import bids_id_to_loni
loni_ids = [bids_id_to_loni(bids_id) for bids_id in bids_ids]
xml_files = _read_xml_files(loni_ids, xml_path)
imgs, exe = _run_parsers(xml_files)
df_meta = _create_mri_meta_df(imgs)
_add_metadata_to_scans(df_meta, bids_subjs_paths)
return None

More precisely, there is a KeyError with image_proc_id occurring at this line:

mri_meta["T1w_scan_id"] = mri_meta["image_proc_id"].combine_first(
mri_meta["image_orig_id"]
)

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...).
Could you first paste here the content of the folder in which these are located (should be ./xml_path according to the command you pasted in your message) ?

@NicolasGensollen
Copy link
Member

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:

https://github.com/aramis-lab/clinica/blob/dev/test/unittests/iotools/converters/adni_to_bids/data/ADNI_123_S_4567_template.xml

@danielliu99
Copy link
Author

Hi @NicolasGensollen

Thank you for responding so quickly.
Here are the files in ./xml_path:

ADNI_002_S_0295_3_Plane_Localizer_S110472_I238620.xml
ADNI_002_S_0295_3_Plane_Localizer_S110472_I238621.xml
ADNI_002_S_0295_3_Plane_Localizer_S110472_I238626.xml
ADNI_002_S_0295_Axial_T2-Star_S110471_I238619.xml
ADNI_002_S_0295_Axial_T2-Star_S150059_I303070.xml
ADNI_002_S_0295_Field_Mapping_S110473_I238622.xml
ADNI_002_S_0295_Field_Mapping_S110473_I238625.xml
ADNI_002_S_0295_MPRAGE_S110476_I238627.xml
ADNI_002_S_0295_MPRAGE_S150055_I303066.xml
ADNI_002_S_0295_MPRAGE_SENSE2_S110477_I238628.xml
ADNI_002_S_0295_MPRAGE_SENSE2_S150056_I303067.xml
ADNI_002_S_0295_MT1__N3m_S110476_I241350.xml
ADNI_002_S_0295_MT1__N3m_S110477_I241351.xml
ADNI_002_S_0295_MT1__N3m_S150055_I308078.xml
ADNI_002_S_0295_MT1__N3m_S150056_I308079.xml
ADNI_002_S_0413_Axial_T2-Star_S111990_I240809.xml
ADNI_002_S_0413_Axial_T2-Star_S150695_I304791.xml
ADNI_002_S_0413_Axial_T2-Star_S189130_I371995.xml
ADNI_002_S_0413_Axial_T2-Star_S217531_I423207.xml
ADNI_002_S_0413_Axial_T2-Star_S322082_I569630.xml
ADNI_002_S_0413_Field_Mapping_S111988_I240807.xml
ADNI_002_S_0413_Field_Mapping_S111988_I240810.xml
ADNI_002_S_0413_Field_Mapping_S189126_I371990.xml
ADNI_002_S_0413_Field_Mapping_S189126_I371993.xml
ADNI_002_S_0413_Field_Mapping_S217528_I423204.xml
ADNI_002_S_0413_Field_Mapping_S217528_I423208.xml
ADNI_002_S_0413_Field_Mapping_S322081_I569629.xml
ADNI_002_S_0413_Field_Mapping_S322081_I569633.xml
ADNI_002_S_0413_MPRAGE_S111992_I240812.xml
ADNI_002_S_0413_MPRAGE_S150697_I304793.xml
ADNI_002_S_0413_MPRAGE_S189127_I371991.xml
ADNI_002_S_0413_MPRAGE_S217526_I423202.xml
ADNI_002_S_0413_MPRAGE_S322084_I569632.xml
ADNI_002_S_0413_MPRAGE_SENSE2_S111989_I240808.xml
ADNI_002_S_0413_MPRAGE_SENSE2_S150696_I304792.xml
ADNI_002_S_0413_MPRAGE_SENSE2_S189132_I371997.xml
ADNI_002_S_0413_MPRAGE_SENSE2_S217527_I423203.xml
ADNI_002_S_0413_MPRAGE_SENSE2_S322083_I569631.xml
ADNI_002_S_0413_MT1__N3m_S111989_I242896.xml
ADNI_002_S_0413_MT1__N3m_S111992_I242895.xml
ADNI_002_S_0413_MT1__N3m_S150696_I312703.xml
ADNI_002_S_0413_MT1__N3m_S150697_I312701.xml
ADNI_002_S_0413_MT1__N3m_S189127_I373133.xml
ADNI_002_S_0413_MT1__N3m_S189132_I373189.xml
ADNI_002_S_0413_MT1__N3m_S217526_I424741.xml
ADNI_002_S_0413_MT1__N3m_S217527_I424742.xml
ADNI_002_S_0413_MT1__N3m_S322083_I649029.xml
ADNI_002_S_0413_MT1__N3m_S322084_I649030.xml
ADNI_002_S_0685_Axial_T2-Star_S114041_I243894.xml
ADNI_002_S_0685_Axial_T2-Star_S160106_I322439.xml
ADNI_002_S_0685_Field_Mapping_S114043_I243896.xml
ADNI_002_S_0685_Field_Mapping_S114043_I243900.xml
ADNI_002_S_0685_MPRAGE_S114045_I243898.xml
ADNI_002_S_0685_MPRAGE_S160104_I322437.xml
ADNI_002_S_0685_MPRAGE_SENSE2_S114048_I243903.xml
ADNI_002_S_0685_MPRAGE_SENSE2_S160107_I322440.xml
ADNI_002_S_0685_MT1__N3m_S114045_I300264.xml
ADNI_002_S_0685_MT1__N3m_S114048_I300265.xml
ADNI_002_S_0685_MT1__N3m_S160104_I326600.xml
ADNI_002_S_0685_MT1__N3m_S160107_I326603.xml
ADNI_002_S_0729_3_Plane_Localizer_S198149_I385946.xml
ADNI_002_S_0729_3_Plane_Localizer_S198149_I385947.xml
ADNI_002_S_0729_3_Plane_Localizer_S198149_I385952.xml
ADNI_002_S_0729_Axial_T2-Star_S119187_I251178.xml
ADNI_002_S_0729_Axial_T2-Star_S159863_I322048.xml
ADNI_002_S_0729_Axial_T2-Star_S198151_I385950.xml
ADNI_002_S_0729_Field_Mapping_S119182_I251172.xml
ADNI_002_S_0729_Field_Mapping_S119182_I251175.xml
ADNI_002_S_0729_Field_Mapping_S198150_I385948.xml
ADNI_002_S_0729_Field_Mapping_S198150_I385949.xml
ADNI_002_S_0729_MPRAGE_S119186_I251177.xml
ADNI_002_S_0729_MPRAGE_S159861_I322046.xml
ADNI_002_S_0729_MPRAGE_S198152_I385951.xml
ADNI_002_S_0729_MPRAGE_SENSE2_S119183_I251173.xml
ADNI_002_S_0729_MPRAGE_SENSE2_S159864_I322049.xml
ADNI_002_S_0729_MPRAGE_SENSE2_S198148_I385945.xml
ADNI_002_S_0729_MT1__N3m_S119183_I258638.xml
ADNI_002_S_0729_MT1__N3m_S119186_I258637.xml
ADNI_002_S_0729_MT1__N3m_S159861_I334105.xml
ADNI_002_S_0729_MT1__N3m_S159864_I334123.xml
ADNI_002_S_0729_MT1__N3m_S198148_I387869.xml
ADNI_002_S_0729_MT1__N3m_S198152_I387868.xml
ADNI_002_S_1155_Axial_T2-Star_S134617_I274146.xml
ADNI_002_S_1155_Axial_T2-Star_S178669_I352949.xml
ADNI_002_S_1155_Axial_T2-Star_S209924_I404366.xml
ADNI_002_S_1155_Axial_T2-Star_S244439_I467647.xml
ADNI_002_S_1155_Field_Mapping_S134619_I274148.xml
ADNI_002_S_1155_Field_Mapping_S134619_I274150.xml
ADNI_002_S_1155_Field_Mapping_S209927_I404369.xml
ADNI_002_S_1155_Field_Mapping_S209927_I404370.xml
ADNI_002_S_1155_Field_Mapping_S244443_I467651.xml
ADNI_002_S_1155_Field_Mapping_S244443_I467653.xml
ADNI_002_S_1155_HarP_135_final_release_2015_S134623_I474826.xml
ADNI_002_S_1155_HHP_6_DOF_AC-PC_registered_MPRAGE_S134623_I412365.xml
ADNI_002_S_1155_MPRAGE_S134623_I274154.xml
ADNI_002_S_1155_MPRAGE_S178671_I352951.xml
ADNI_002_S_1155_MPRAGE_S209928_I404371.xml
ADNI_002_S_1155_MPRAGE_S244442_I467650.xml
ADNI_002_S_1155_MPRAGE_SENSE2_S134620_I274149.xml
ADNI_002_S_1155_MPRAGE_SENSE2_S178668_I352948.xml
ADNI_002_S_1155_MPRAGE_SENSE2_S209925_I404367.xml
ADNI_002_S_1155_MPRAGE_SENSE2_S244444_I467652.xml
ADNI_002_S_1155_MT1__N3m_S134620_I281854.xml
ADNI_002_S_1155_MT1__N3m_S134623_I281853.xml
ADNI_002_S_1155_MT1__N3m_S178668_I353880.xml
ADNI_002_S_1155_MT1__N3m_S178671_I353879.xml
ADNI_002_S_1155_MT1__N3m_S209925_I427960.xml
ADNI_002_S_1155_MT1__N3m_S209928_I427959.xml
ADNI_002_S_1155_MT1__N3m_S244442_I470395.xml
ADNI_002_S_1155_MT1__N3m_S244444_I470396.xml

Best

@danielliu99
Copy link
Author

Hi @NicolasGensollen

I tried to run without the --xml_path arg, there's no error. So, now the command is:

clinica convert adni-to-bids -sl ./subjects_list.txt ./ADNI/ ./CLINICAL_DATA ./BIDS/ -m T1

And the last few lines of log are:

2023-08-18 09:18:54,996:INFO:Creating sessions files...
2023-08-18 09:18:54,998:INFO:   Reading clinical data file: ADNIMERGE.csv
2023-08-18 09:18:55,172:INFO:   Reading clinical data file: CDR.csv
2023-08-18 09:18:55,204:INFO:   Reading clinical data file: NEUROBAT.csv
2023-08-18 09:18:55,280:INFO:   Reading clinical data file: ADASSCORES.csv
2023-08-18 09:18:55,295:INFO:   Reading clinical data file: CCI.csv
2023-08-18 09:18:55,300:INFO:   Reading clinical data file: ECOGPT.csv
2023-08-18 09:18:55,335:INFO:   Reading clinical data file: ECOGSP.csv
2023-08-18 09:18:55,370:INFO:   Reading clinical data file: FCI.csv
2023-08-18 09:18:55,387:INFO:   Reading clinical data file: GDSCALE.csv
2023-08-18 09:18:55,418:INFO:   Reading clinical data file: MODHACH.csv
2023-08-18 09:18:55,430:INFO:   Reading clinical data file: MOCA.csv
2023-08-18 09:18:55,461:INFO:   Reading clinical data file: NPI.csv
2023-08-18 09:18:55,521:INFO:   Reading clinical data file: NPIQ.csv
2023-08-18 09:18:55,546:INFO:   Reading clinical data file: BHR_EVERYDAY_COGNITION.csv
2023-08-18 09:18:55,550:INFO:   Reading clinical data file: BHR_BASELINE_QUESTIONNAIRE.csv
2023-08-18 09:18:55,554:INFO:   Reading clinical data file: BHR_LONGITUDINAL_QUESTIONNAIRE.csv
2023-08-18 09:18:55,558:INFO:   Reading clinical data file: MEDHIST.csv
2023-08-18 09:18:55,573:INFO:   Reading clinical data file: VITALS.csv
2023-08-18 09:18:55,712:INFO:Creating scans files...

There's no other prompt saying the conversion finished, is it as expected?

Best

@NicolasGensollen
Copy link
Member

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 imageUID field(s) like in the test templates (instead of a variable you should have a valid ID):

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

I tried to run without the --xml_path arg, there's no error.

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.

@danielliu99
Copy link
Author

Hi @NicolasGensollen

Thanks for your suggestions.

This line got an error when looping the xml_file.

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:

Traceback (most recent call last):
  File "check_xml.py", line 12, in <module>
    d = _parse_xml_file(xml_file)
  File "/home/liur1/anaconda/envs/clinicaEnv/lib/python3.8/site-packages/clinica/iotools/converters/adni_to_bids/adni_json.py", line 365, in _parse_xml_file
    original_image, processed_image_rating, derived_image_metadata = _parse_images(
  File "/home/liur1/anaconda/envs/clinicaEnv/lib/python3.8/site-packages/clinica/iotools/converters/adni_to_bids/adni_json.py", line 355, in _parse_images
    return _parse_derived_images(series)
  File "/home/liur1/anaconda/envs/clinicaEnv/lib/python3.8/site-packages/clinica/iotools/converters/adni_to_bids/adni_json.py", line 241, in _parse_derived_images
    derived_metadata.update(_get_derived_image_metadata(deriv))
  File "/home/liur1/anaconda/envs/clinicaEnv/lib/python3.8/site-packages/clinica/iotools/converters/adni_to_bids/adni_json.py", line 136, in _get_derived_image_metadata
    _check_derived_image_xml(derived)
  File "/home/liur1/anaconda/envs/clinicaEnv/lib/python3.8/site-packages/clinica/iotools/converters/adni_to_bids/adni_json.py", line 123, in _check_derived_image_xml
    assert (
AssertionError: creaDate

Here's the list of the 34 files:

ADNI_002_S_0729_MT1__N3m_S119183_I258638.xml
ADNI_002_S_0413_MT1__N3m_S217526_I424741.xml
ADNI_002_S_0685_MT1__N3m_S160107_I326603.xml
ADNI_002_S_0413_MT1__N3m_S111992_I242895.xml
ADNI_002_S_1155_MT1__N3m_S209928_I427959.xml
ADNI_002_S_0729_MT1__N3m_S159864_I334123.xml
ADNI_002_S_0413_MT1__N3m_S322083_I649029.xml
ADNI_002_S_0413_MT1__N3m_S217527_I424742.xml
ADNI_002_S_0413_MT1__N3m_S150696_I312703.xml
ADNI_002_S_0413_MT1__N3m_S189127_I373133.xml
ADNI_002_S_1155_HHP_6_DOF_AC-PC_registered_MPRAGE_S134623_I412365.xml
ADNI_002_S_0729_MT1__N3m_S119186_I258637.xml
ADNI_002_S_0685_MT1__N3m_S160104_I326600.xml
ADNI_002_S_1155_HarP_135_final_release_2015_S134623_I474826.xml
ADNI_002_S_0413_MT1__N3m_S111989_I242896.xml
ADNI_002_S_0295_MT1__N3m_S110477_I241351.xml
ADNI_002_S_0729_MT1__N3m_S198152_I387868.xml
ADNI_002_S_0413_MT1__N3m_S189132_I373189.xml
ADNI_002_S_1155_MT1__N3m_S134623_I281853.xml
ADNI_002_S_0413_MT1__N3m_S322084_I649030.xml
ADNI_002_S_1155_MT1__N3m_S134620_I281854.xml
ADNI_002_S_0729_MT1__N3m_S198148_I387869.xml
ADNI_002_S_0295_MT1__N3m_S150056_I308079.xml
ADNI_002_S_0295_MT1__N3m_S150055_I308078.xml
ADNI_002_S_1155_MT1__N3m_S244444_I470396.xml
ADNI_002_S_1155_MT1__N3m_S209925_I427960.xml
ADNI_002_S_1155_MT1__N3m_S178671_I353879.xml
ADNI_002_S_1155_MT1__N3m_S244442_I470395.xml
ADNI_002_S_0685_MT1__N3m_S114048_I300265.xml
ADNI_002_S_0295_MT1__N3m_S110476_I241350.xml
ADNI_002_S_0413_MT1__N3m_S150697_I312701.xml
ADNI_002_S_0685_MT1__N3m_S114045_I300264.xml
ADNI_002_S_1155_MT1__N3m_S178668_I353880.xml
ADNI_002_S_0729_MT1__N3m_S159861_I334105.xml

Intuitively, all these 34 files have a "creationDate" field, while the other succeeded files do not.
One example of the 34 files is attached (I changed extension from .xml to .txt to make it can be uploaded).

ADNI_002_S_0295_MT1__N3m_S110476_I241350.txt

Thanks

@NicolasGensollen
Copy link
Member

Hi @danielliu99

Thanks for investigating further and for the sample XML file.

As you wrote above, the problem is related to this assertion:

assert (
_check_xml_and_get_text(derived[-1], "creationDate") == "0000-00-00"
), "creaDate"

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 ?

@danielliu99
Copy link
Author

Thank you, @NicolasGensollen

I forked the repo and replaced your new adni_json.py into my repo.
Then I run the conversion without seeing an error. The log is attached.
log.txt

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:

	filename	scan_id	mri_field	acq_time
0	anat/sub-ADNI002S0295_ses-M060_T1w.json	241350	3.0	2011-06-02
1	anat/sub-ADNI002S0295_ses-M060_T1w.nii.gz	241350	3.0	2011-06-02

One is that there's missing column name for the first column.
The other is that the acq_time is not in the format yyyy-MM-ddTHH:mm:ss[.000000].

You can check the error log file:
BIDS_errors.txt

By the way, is it mandatory to have all Original, Pre-processed, Post-processed images before conversion? (For some reason, we just need original images for analyzing the T1 images.)

Thanks

@NicolasGensollen
Copy link
Member

Thanks for experimenting with the patch @danielliu99 ! 👍
The log seems fine to me (although there are a couple warnings we should try to fix when we get a chance...).

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working converter
Projects
None yet
2 participants