ADNI-to-BIDS Conversion (multimodalities)

61 views
Skip to first unread message

Shahzad ALi

unread,
Mar 10, 2025, 11:02:19 AMMar 10
to clinic...@googlegroups.com

Dear Clinica Support Team,

I hope this message finds you well. I am currently working on converting ADNI data to BIDS format, and I have a question regarding the organization of input data for multiple modalities.

My ADNI data for different modalities (e.g., T1, FDG-PET, AV45-PET) are stored in separate folders. Do I need to manually place all modalities under the same subject folder before running the clinica convert adni-to-bids command, or will the tool handle this automatically if I provide the correct paths and modality flags?

Additionally, are there any specific steps or considerations I should keep in mind to ensure a smooth conversion process for datasets with multiple modalities?

Thank you for your assistance, and I look forward to your guidance.

Best regards,

Shahzad Ali 

-----------------------------------------------------------------------

Alice Joubert

unread,
Mar 10, 2025, 2:09:32 PMMar 10
to clinic...@googlegroups.com
Hello Shahzad,

You don't need to move the files manually if you convert to the same output BIDS folder. For example, you can run : `clinica convert adni-to-bids raw_T1 clinical_data BIDS -m T1` then `clinica convert adni-to-bids raw_PETFDG clinical_data BIDS -m PET_FDG` and it will update the same output folder.

The writing of scans metadata files is expected to fail as it is a known issue that has not been resolved yet, however everything else will be there.

Do not hesitate to tell me if you get another kind of error.

Best,

Alice

Shahzad ALi

unread,
Mar 10, 2025, 2:25:50 PMMar 10
to clinic...@googlegroups.com
Dear Alice,
Thank you for your guidance. 
I have converted a T1, PET (FDG, Amyloid) modalities. At the end of the process, I received the following output:

First i Converted T1:
  • 2025-03-10 16:49:36,148:INFO:[T1] No path specified for 301_S_6297 in session m48

    2025-03-10 16:49:36,285:DEBUG:T1 conversion done.

    2025-03-10 16:49:36,423:INFO:Creating modality agnostic files...

    2025-03-10 16:49:36,451:INFO:Creating participants.tsv...

    2025-03-10 16:49:39,350:INFO:The following subjects of dataset directory were not found in your BIDS folder :

    sub-ADNI126S2360, sub-ADNI941S4187, sub-ADNI098S4095, sub-ADNI003S6158, sub-ADNI005S6393, sub-ADNI003S6479, sub-ADNI153S6633, sub-ADNI153S6679, sub-ADNI153S6694, sub-ADNI114S6758, sub-ADNI141S6779, sub-ADNI012S6837, sub-ADNI305S6879, sub-ADNI035S6927, sub-ADNI021S6978, sub-ADNI114S6039, sub-ADNI341S6960, sub-ADNI341S6981, sub-ADNI341S7018, sub-ADNI037S6991, sub-ADNI035S7031, sub-ADNI037S7012, sub-ADNI011S7089, sub-ADNI123S7125

    /Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/adni_to_bids/adni_utils.py:162: PerformanceWarning: indexing past lexsort depth may impact performance.

      dxsum_df.loc[(alternative_id, "sc"), "DIAGNOSIS"].values[0]

    ....

    /Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/adni_to_bids/adni_utils.py:162: PerformanceWarning: indexing past lexsort depth may impact performance.

      dxsum_df.loc[(alternative_id, "sc"), "DIAGNOSIS"].values[0]

    2025-03-10 16:49:39,610:INFO:Creating sessions files...

    /Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/adni_to_bids/adni_utils.py:208: PerformanceWarning: DataFrame is highly fragmented.  This is usually the result of calling `frame.insert` many times, which has poor performance.  Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`

      df_subj_sessions["a_stat"] = df_subj_sessions.apply(

    /Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/adni_to_bids/adni_utils.py:216: PerformanceWarning: DataFrame is highly fragmented.  This is usually the result of calling `frame.insert` many times, which has poor performance.  Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`

      df_subj_sessions["tau_stat"] = df_subj_sessions.apply(

    2025-03-10 16:50:29,061:INFO:Creating scans files...

    (clinicaEnv) shahzadali@Shahzads-MacBook-Pro ADNI_multimodal % 

The PET-FDG:
  • 2025-03-10 17:23:36,372:DEBUG:FDG PET conversion done.

    2025-03-10 17:23:36,535:INFO:Creating modality agnostic files...

    2025-03-10 17:23:36,563:INFO:Creating participants.tsv...

    2025-03-10 17:23:39,423:INFO:The following subjects of dataset directory were not found in your BIDS folder :

    sub-ADNI003S6158, sub-ADNI005S6393, sub-ADNI114S6758, sub-ADNI305S6879, sub-ADNI021S6978, sub-ADNI341S6960, sub-ADNI341S6981, sub-ADNI341S7018, sub-ADNI037S6991, sub-ADNI037S7012, sub-ADNI011S7089, sub-ADNI123S7125

    /Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/adni_to_bids/adni_utils.py:162: PerformanceWarning: indexing past lexsort depth may impact performance.

      dxsum_df.loc[(alternative_id, "sc"), "DIAGNOSIS"].values[0]

    ...

    /Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/adni_to_bids/adni_utils.py:162: PerformanceWarning: indexing past lexsort depth may impact performance.

      dxsum_df.loc[(alternative_id, "sc"), "DIAGNOSIS"].values[0]

    2025-03-10 17:23:39,639:INFO:Creating sessions files...

    /Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/adni_to_bids/adni_utils.py:208: PerformanceWarning: DataFrame is highly fragmented.  This is usually the result of calling `frame.insert` many times, which has poor performance.  Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`

      df_subj_sessions["a_stat"] = df_subj_sessions.apply(

    /Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/adni_to_bids/adni_utils.py:216: PerformanceWarning: DataFrame is highly fragmented.  This is usually the result of calling `frame.insert` many times, which has poor performance.  Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`

      df_subj_sessions["tau_stat"] = df_subj_sessions.apply(

    2025-03-10 17:24:26,930:INFO:Creating scans files...

    Traceback (most recent call last):

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/bin/clinica", line 8, in <module>

        sys.exit(main())

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/cmdline.py", line 113, in main

        cli()

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/click/core.py", line 1161, in __call__

        return self.main(*args, **kwargs)

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/click/core.py", line 1082, in main

        rv = self.invoke(ctx)

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/click/core.py", line 1697, in invoke

        return _process_result(sub_ctx.command.invoke(sub_ctx))

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/click/core.py", line 1697, in invoke

        return _process_result(sub_ctx.command.invoke(sub_ctx))

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/click/core.py", line 1443, in invoke

        return ctx.invoke(self.callback, **ctx.params)

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/click/core.py", line 788, in invoke

        return __callback(*args, **kwargs)

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/adni_to_bids/adni_to_bids_cli.py", line 64, in cli

        convert(

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/adni_to_bids/adni_to_bids.py", line 47, in convert

        adni_to_bids.convert_clinical_data(

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/adni_to_bids/adni_to_bids.py", line 163, in convert_clinical_data

        create_adni_scans_files(conversion_path, bids_subjects_paths)

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/adni_to_bids/adni_utils.py", line 569, in create_adni_scans_files

        conversion_df = converted_dict[converted_mod]

    KeyError: 't1'

    (clinicaEnv) shahzadali@Shahzads-MacBook-Pro ADNI_multimodal % 

Then PET-Amyloid:
  • 2025-03-10 17:33:06,031:DEBUG:AV45 and Florbetaben PET conversion done.

    2025-03-10 17:33:06,209:INFO:Creating modality agnostic files...

    2025-03-10 17:33:06,240:INFO:Creating participants.tsv...

    2025-03-10 17:33:09,149:INFO:The following subjects of dataset directory were not found in your BIDS folder :

    sub-ADNI114S6758, sub-ADNI305S6879, sub-ADNI123S7125

    /Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/adni_to_bids/adni_utils.py:162: PerformanceWarning: indexing past lexsort depth may impact performance.

      dxsum_df.loc[(alternative_id, "sc"), "DIAGNOSIS"].values[0]

    ...

    /Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/adni_to_bids/adni_utils.py:162: PerformanceWarning: indexing past lexsort depth may impact performance.

      dxsum_df.loc[(alternative_id, "sc"), "DIAGNOSIS"].values[0]

    2025-03-10 17:33:09,386:INFO:Creating sessions files...

    /Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/adni_to_bids/adni_utils.py:208: PerformanceWarning: DataFrame is highly fragmented.  This is usually the result of calling `frame.insert` many times, which has poor performance.  Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`

      df_subj_sessions["a_stat"] = df_subj_sessions.apply(

    /Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/adni_to_bids/adni_utils.py:216: PerformanceWarning: DataFrame is highly fragmented.  This is usually the result of calling `frame.insert` many times, which has poor performance.  Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`

      df_subj_sessions["tau_stat"] = df_subj_sessions.apply(

    2025-03-10 17:33:57,577:INFO:Creating scans files...

    Traceback (most recent call last):

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/bin/clinica", line 8, in <module>

        sys.exit(main())

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/cmdline.py", line 113, in main

        cli()

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/click/core.py", line 1161, in __call__

        return self.main(*args, **kwargs)

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/click/core.py", line 1082, in main

        rv = self.invoke(ctx)

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/click/core.py", line 1697, in invoke

        return _process_result(sub_ctx.command.invoke(sub_ctx))

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/click/core.py", line 1697, in invoke

        return _process_result(sub_ctx.command.invoke(sub_ctx))

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/click/core.py", line 1443, in invoke

        return ctx.invoke(self.callback, **ctx.params)

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/click/core.py", line 788, in invoke

        return __callback(*args, **kwargs)

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/adni_to_bids/adni_to_bids_cli.py", line 64, in cli

        convert(

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/adni_to_bids/adni_to_bids.py", line 47, in convert

        adni_to_bids.convert_clinical_data(

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/adni_to_bids/adni_to_bids.py", line 163, in convert_clinical_data

        create_adni_scans_files(conversion_path, bids_subjects_paths)

      File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/adni_to_bids/adni_utils.py", line 569, in create_adni_scans_files

        conversion_df = converted_dict[converted_mod]

    KeyError: 't1'

    (clinicaEnv) shahzadali@Shahzads-MacBook-Pro ADNI_multimodal % 



Could you kindly confirm if this indicates a normal finish, or if there’s anything I should address?
Looking forward to your response.
Best regards,
Shahzad

-----------------------------------------------------------------------



--
You received this message because you are subscribed to the Google Groups "Clinica" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clinica-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/clinica-user/CAP_epFuHA4rtoyHFN7Wkw-eM5LvgyKY%3Dz%2BqzwXMXPv2VdvRmwA%40mail.gmail.com.

Alice Joubert

unread,
Mar 10, 2025, 2:42:37 PMMar 10
to clinic...@googlegroups.com
That looks like the expected error so it should be fine ! If you want to check the subjects/sessions or modalities maybe you can check out our iotools check-missing-modalities or create-subjects-visits .

Shahzad ALi

unread,
Mar 12, 2025, 7:36:35 AMMar 12
to clinic...@googlegroups.com
Thank you Dear Alice,
I have successfully done conversion. and performed t1-linear. Hover when i am trying to run the pet-linear using: 
 clinica run pet-linear BIDS_Converted/BIDS_Multimodal CAPD_DIR/CAPS_Multimodal 18FFDG pons -tsv participants.tsv
I am getting following error:

2025-03-12 12:26:13,316:INFO:The CAPS dataset 'None', located at /ADNI_multimodal/CAPD_DIR/CAPS_Multimodal, already contains a 'dataset_description.json' file.

2025-03-12 12:26:13,317:WARNING:The existing CAPS dataset, located at /ADNI_multimodal/CAPD_DIR/CAPS_Multimodal has a name 'b351f3ce-6e7f-4e38-83a2-98d8b336accf' different from the new name 'eb45ac02-b10a-4009-a078-c366d9302c24'. The old name will be kept.

/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/utils/stream.py:103: UserWarning: The existing CAPS dataset, located at /ADNI_multimodal/CAPD_DIR/CAPS_Multimodal has a name 'b351f3ce-6e7f-4e38-83a2-98d8b336accf' different from the new name 'eb45ac02-b10a-4009-a078-c366d9302c24'. The old name will be kept.

  warnings.warn(message, warning_type)

2025-03-12 12:26:14,911:INFO:Found installation of ants with version 2.5.4, satisfying >=2.2.0.

2025-03-12 12:26:16,271:ERROR:Clinica faced error(s) while trying to read pet files in your BIDS directory.

Clinica encountered 262 problem(s) while getting PET data with 18FFDG tracer:

* (sub-ADNI007S0316 | ses-M000): No file found


* (sub-ADNI002S6652 | ses-M000): No file found


* (sub-ADNI009S4814 | ses-M000): No file found


* (sub-ADNI011S4906 | ses-M000): No file found


* (sub-ADNI013S4791 | ses-M000): No file found


* (sub-ADNI016S2007 | ses-M000): No file found


* (sub-ADNI018S4399 | ses-M000): No file found


* (sub-ADNI021S0424 | ses-M000): No file found


* (sub-ADNI005S0929 | ses-M000): No file found


* (sub-ADNI007S0344 | ses-M000): No file found

I am getting this error for all the subjects. However, the BIDS directory contains the pet files for specified session. The CAPs dir contains the t1-linear files.


Shahzad

-----------------------------------------------------------------------



Shahzad ALi

unread,
Mar 12, 2025, 7:57:32 AMMar 12
to clinic...@googlegroups.com
for example for subject (* (sub-ADNI007S0316 | ses-M000): No file found) you can see in attached screenshot.


Best,

----------------------------------------------


Screenshot 2025-03-12 at 12.55.25.png

Alice Joubert

unread,
Mar 14, 2025, 9:12:39 AMMar 14
to clinic...@googlegroups.com
Hello, 

Can you tell us the version of clinica you used to get this result ? (dev or a published version) We are looking into it !

Best,

Alice

Shahzad ALi

unread,
Mar 14, 2025, 9:15:17 AMMar 14
to clinic...@googlegroups.com
I am using:
(clinicaEnv) shahzadali@Mac ~ % clinica --version 
clinica, version 0.9.1

Best,

Shahzad Ali 

---------------------------------



Shahzad ALi

unread,
Mar 17, 2025, 9:52:40 AMMar 17
to Clinica
Hi, Dear Alice,
Can you help me the query I mentioned above.
Waiting for your response.
Best,
Shahzad
---------------------

Alice Joubert

unread,
Mar 18, 2025, 4:18:21 AMMar 18
to clinic...@googlegroups.com
Hello,

We fixed this issue in pull request #1470 . A new release has not been planned yet (at least not this week) but the code is accessible in the dev version of clinica. Would that work for you ? If yes, do you need guidance to get it ?

Best,

Alice 

Shahzad ALi

unread,
Mar 25, 2025, 8:12:19 PMMar 25
to clinic...@googlegroups.com
Dear Alice,
Thank you for your response. 
Yes, I would like to use the dev version of Clinica to access the fix in #1470.
However, I’m concerned about potential compatibility issues with pipelines I’ve already run on my current stable version of Clinica. Could you clarify:
  • Whether the dev version might affect existing data/results from previous pipelines?
  • If there are any precautions I should take when switching to the dev version (e.g., environment isolation, data backups)?
I’d also appreciate guidance on setting up the dev version alongside my current installation to minimize disruptions.

Thank you for your support!🙏
Best,

Shahzad

-----------------------------------------------------------------------



Alice Joubert

unread,
Mar 27, 2025, 5:55:23 AMMar 27
to clinic...@googlegroups.com
Hello !

Can you tell me which pipelines / clinica tools (converters...) you are interested in using or have used so I can answer more precisely ? Can you also tell me how you installed clinica already ? (specific environment, local git repository ?...)

Best,

Alice

Shahzad ALi

unread,
Mar 27, 2025, 6:16:15 AMMar 27
to clinic...@googlegroups.com
Dear Alice,
yes, I have already installed clinica (clinica --version: clinica, version 0.9.1).
I am interested in running pipeline (for now): pet-linear 

Thanks & Best,

Shahzad

-----------------------------------------------------------------------



Nicolas Gensollen

unread,
Apr 1, 2025, 5:17:53 AMApr 1
to Clinica
Hello Shahzad

We just made a patch release (0.9.4) with the fix mentioned above by Alice. Compared to 0.9.3, this release almost only adds the fix, so you should be fine to try it out.
We encourage you to create a new virtual environment (using conda or another tool), and in this environment you can run "pip install clinica" which should install the 0.9.4 version since it is the latest atm.
Once installed, you can confirm that by running "clinica --version".

Hope this helps!
Best,
Nicolas

Shahzad ALi

unread,
Apr 3, 2025, 5:04:55 AMApr 3
to clinic...@googlegroups.com
Dear Alice, and Nicolas. 
Thank you very much. The latest release of Clinica (0.9.4) works for the pet-linear pipeline. 

Thanks & Best,

Shahzad

------------------------


Reply all
Reply to author
Forward
0 new messages