GabrieleLozupone / AXIAL

This is a code implemention of the diagnosis and XAI framework proposed in the paper "Attention-based eXplainability for Interpretable Alzheimer's Localized Diagnosis using 2D CNNs on 3D MRI brain scans".
Other
24 stars 3 forks source link

Converting ADNI to BIDS - Error with Clinical Data #2

Closed Wusat824 closed 1 week ago

Wusat824 commented 1 week ago

I encountered an issue while attempting to convert the ADNI data to BIDS format using Clinica. The command I am running is:

"clinica convert adni-to-bids -m T1 DATASET_DIRECTORY CLINICAL_DATA_DIRECTORY BIDS_DIRECTORY" the error is 2024-09-14 11:09:50,281:INFO:No T1 image path found for subject 035_S_7121 in visit bl with image ID 1669252 2024-09-14 11:09:50,347:INFO:Paths of T1 images found. Exporting images into BIDS ... 2024-09-14 11:09:53,315:INFO:Creating modality agnostic files... 2024-09-14 11:09:53,324:INFO:Creating participants.tsv... Traceback (most recent call last): File "C:\Users\wusat\Desktop\AXIAL-main.venv\Lib\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: 'APGEN1'

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

Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Users\wusat\Desktop\AXIAL-main.venv\Scripts\clinica.exe__main.py", line 7, in File "C:\Users\wusat\Desktop\AXIAL-main.venv\Lib\site-packages\clinica\cmdline.py", line 92, in main cli() File "C:\Users\wusat\Desktop\AXIAL-main.venv\Lib\site-packages\click\core.py", line 1157, in call return self.main(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\wusat\Desktop\AXIAL-main.venv\Lib\site-packages\click\core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Users\wusat\Desktop\AXIAL-main.venv\Lib\site-packages\click\core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\wusat\Desktop\AXIAL-main.venv\Lib\site-packages\click\core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\wusat\Desktop\AXIAL-main.venv\Lib\site-packages\click\core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\wusat\Desktop\AXIAL-main.venv\Lib\site-packages\click\core.py", line 783, in invoke return callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\wusat\Desktop\AXIAL-main.venv\Lib\site-packages\clinica\iotools\converters\adni_to_bids\adni_to_bids_cli.py", line 79, in cli adni_to_bids.convert_clinical_data( File "C:\Users\wusat\Desktop\AXIAL-main.venv\Lib\site-packages\clinica\iotools\converters\adni_to_bids\adni_to_bids.py", line 123, in convert_clinical_data participants_df = bids.create_participants_df( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\wusat\Desktop\AXIAL-main.venv\Lib\site-packages\clinica\iotools\bids_utils.py", line 125, in create_participants_df value_to_read = file_to_read[participant_fields_db[i]]


  File "C:\Users\wusat\Desktop\AXIAL-main\.venv\Lib\site-packages\pandas\core\frame.py", line 3807, in __getitem__
    indexer = self.columns.get_loc(key)
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\wusat\Desktop\AXIAL-main\.venv\Lib\site-packages\pandas\core\indexes\base.py", line 3804, in get_loc
    raise KeyError(key) from err
KeyError: 'APGEN1'

i need data APGEN1 and APGEN2 

have downloaded the data directly from the ADNI official site, and I suspect that the 'APGEN1' field may be missing or incorrectly named in the clinical data CSV file. Do you have any suggestions on how to resolve this issue?

I would greatly appreciate any guidance or recommendations you might have to help me move forward with the BIDS conversion process.

Thank you very much for your time and assistance.

Best regards,
GabrieleLozupone commented 1 week ago

I've tried to figure out what is the problem. According to the Clinica GitHub issues section Bug APGEN1, it is a bug due to the ADNI 4 update. The ADNI team changed the file structure with the latest dataset update, and the Clinica conversion tool needs to be updated accordingly.

I've tried to solve the issue by myself using the Clinica source code, but I have not yet found a solution.