AIBL-to-BIDS Conversion - PET

15 views
Skip to first unread message

Muhammad Orhan

unread,
Mar 25, 2025, 8:01:05 AMMar 25
to clinic...@googlegroups.com

Hi Dear Clinica Support Teams, 


I am converting AIBL PEt scans to BIDS using:

clinica convert aibl-to-bids raw_AIBL/raw_PET ClinicalData BIDS_Dir/BIDS_PET 



and encountered following error: 

2025-03-25 12:45:30,825:INFO:Found installation of dcm2niix with version 1.0.20240202, satisfying >=1.0.20240202.

multiprocessing.pool.RemoteTraceback: 

"""

Traceback (most recent call last):

  File "/Users/Muhammad/miniconda3/envs/clinicaEnv/lib/python3.10/multiprocessing/pool.py", line 125, in worker

    result = (True, func(*args, **kwds))

  File "/Users/Muhammad/miniconda3/envs/clinicaEnv/lib/python3.10/multiprocessing/pool.py", line 48, in mapstar

    return list(map(*args))

  File "/Users/Muhammad/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/aibl_to_bids/utils/bids.py", line 678, in _create_file

    json_from_dcm(image_path, output_path.with_suffix(".json"))

  File "/Users/Muhammad/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/bids_utils.py", line 1109, in json_from_dcm

    f.write(json.dumps(json_dict, skipkeys=True, indent=4))

  File "/Users/Muhammad/miniconda3/envs/clinicaEnv/lib/python3.10/json/__init__.py", line 238, in dumps

    **kw).encode(obj)

  File "/Users/Muhammad/miniconda3/envs/clinicaEnv/lib/python3.10/json/encoder.py", line 201, in encode

    chunks = list(chunks)

  File "/Users/Muhammad/miniconda3/envs/clinicaEnv/lib/python3.10/json/encoder.py", line 431, in _iterencode

    yield from _iterencode_dict(o, _current_indent_level)

  File "/Users/Muhammad/miniconda3/envs/clinicaEnv/lib/python3.10/json/encoder.py", line 405, in _iterencode_dict

    yield from chunks

  File "/Users/Muhammad/miniconda3/envs/clinicaEnv/lib/python3.10/json/encoder.py", line 438, in _iterencode

    o = _default(o)

  File "/Users/Muhammad/miniconda3/envs/clinicaEnv/lib/python3.10/json/encoder.py", line 179, in default

    raise TypeError(f'Object of type {o.__class__.__name__} '

TypeError: Object of type MultiValue is not JSON serializable

"""

 

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

 

Traceback (most recent call last):

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

    sys.exit(main())

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

    cli()

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

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

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

    rv = self.invoke(ctx)

  File "/Users/Muhammad/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/Muhammad/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/Muhammad/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/click/core.py", line 1443, in invoke

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

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

    return __callback(*args, **kwargs)

  File "/Users/Muhammad/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/aibl_to_bids/aibl_to_bids_cli.py", line 36, in cli

    convert(

  File "/Users/Muhammad/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/aibl_to_bids/aibl_to_bids.py", line 74, in convert

    _convert_images(

  File "/Users/Muhammad/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/aibl_to_bids/aibl_to_bids.py", line 115, in _convert_images

    created_files = [

  File "/Users/Muhammad/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/aibl_to_bids/aibl_to_bids.py", line 116, in <listcomp>

    paths_to_bids(

  File "/Users/Muhammad/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/iotools/converters/aibl_to_bids/utils/bids.py", line 164, in paths_to_bids

    output_file_treated = pool.map(create_file_, images_list)

  File "/Users/Muhammad/miniconda3/envs/clinicaEnv/lib/python3.10/multiprocessing/pool.py", line 367, in map

    return self._map_async(func, iterable, mapstar, chunksize).get()

  File "/Users/Muhammad/miniconda3/envs/clinicaEnv/lib/python3.10/multiprocessing/pool.py", line 774, in get

    raise self._value

TypeError: Object of type MultiValue is not JSON serializable

 

Looking forward to your help in this regard.

Thanks & Best,

Muhammad

 

Alice Joubert

unread,
Mar 31, 2025, 12:59:08 PMMar 31
to clinic...@googlegroups.com
Hello,

In order to help you as best as possible, I have a few questions :
- What version of clinica are you working with ?
- Did you recently download AIBL images and clinical data ? 
- Are you working with a specific PET tracer ?

Best,

Alice

--
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/CAN5GZA0ub3Ydx8JEaNcNASA1N%2BDCjczXH95MRvXg9Wzh55S-CA%40mail.gmail.com.

Muhammad Orhan

unread,
Mar 31, 2025, 1:14:19 PMMar 31
to clinic...@googlegroups.com
Hi, Dear Alice, 
Thanks for your reply.
    • What version of clinica are you working with ?
    • clinica --version: clinica, version 0.9.1.
    • Are you working with a specific PET tracer ?
    • I downloaded all PET scans at baseline.
    • Did you recently download AIBL images and clinical data ? 
    • yes, I downloaded recently. (March 2025)
    Best regards,
    Muhammad

    Alice Joubert

    unread,
    Mar 31, 2025, 1:22:54 PMMar 31
    to clinic...@googlegroups.com
    Thanks ! Do you know if this happened for all images or a subset of your data ?

    Muhammad Orhan

    unread,
    Mar 31, 2025, 5:04:12 PMMar 31
    to clinic...@googlegroups.com

    Muhammad Orhan

    unread,
    Apr 4, 2025, 1:55:00 PMApr 4
    to clinic...@googlegroups.com
    Hi, 
    I have downloaded the PET (F18) scans from AIBL and trying to convert to BIDS using Clinica 0.9.4 (also tried with 0.9.1):

    clinica convert aibl-to-bids raw_AIBL/raw_PET ClinicalData BIDS_Dir/BIDS_PET 


    The PET AV45 scans were converted to BIDS, however, for others it throws  error as I mentioned above. TypeError: Object of type MultiValue is not JSON serializable
    The complete log file is attached.

    Best Regards,
    Muhammad
    PETConversion_Log.rtf

    Alice Joubert

    unread,
    Apr 7, 2025, 5:58:17 AMApr 7
    to clinic...@googlegroups.com
    Hello,

    I succeeded in reproducing the bug and will investigate. In the meantime you can try to do the conversion without subject 139 !

    Best,

    Alice

    Muhammad Orhan

    unread,
    Apr 7, 2025, 7:37:53 AMApr 7
    to clinic...@googlegroups.com
    Dear Alice, 
    Thank you for your response. 
    I am able to convert subjects (PET scans), excluding a few subjects. 
    I have attached the screenshot of dcm files of the subjects left (for your reference.)

    Best Regards,

    Screenshot 2025-04-07 at 13.30.57.png
    Screenshot 2025-04-07 at 13.32.39.png
    Screenshot 2025-04-07 at 13.32.49.png
    Screenshot 2025-04-07 at 13.32.59.png
    Screenshot 2025-04-07 at 13.31.43.png
    Screenshot 2025-04-07 at 13.33.11.png
    Screenshot 2025-04-07 at 13.33.22.png

    Alice Joubert

    unread,
    Apr 7, 2025, 8:14:11 AMApr 7
    to clinic...@googlegroups.com
    Alright thanks, I will see what is wrong with them.

    Best,

    Alice

    Muhammad Orhan

    unread,
    Apr 7, 2025, 10:51:49 AMApr 7
    to clinic...@googlegroups.com
    Dear Alice, 
    Sorry to reach you again:
    I just noticed another thing while using AIBL-to-BIDS converter:
    • I have 667 subjects (T1) . When I converted to BIDS, I found 605 subjects in BIDS directory.
    • Similarly, for PET, I have 469 subjects, and after conversion I found 462 subjects in the BIDS converted folder.
    Just to verify: I ran the converter again on the remaining 62 T1 subjects (62 = 667-605). The pipeline runs without any error and the log file is attached for your reference.

    Could you please check what is happening?

    Thanks and Best,
    Muhammad


    log_T1_bl copy.rtf

    Alice Joubert

    unread,
    Apr 7, 2025, 11:14:04 AMApr 7
    to clinic...@googlegroups.com
    No problem. The logs look fine to me, can you give an example of subject that was not converted ?

    Muhammad Orhan

    unread,
    Apr 7, 2025, 11:18:59 AMApr 7
    to clinic...@googlegroups.com
    Sure, Here is the List of subjects w.r.t. modality:

    T1: ['0151083', '1013', '1050', '1066', '1089', '1102', '1135', '1145', '1197', '135', '152', '1599', '1628', '1632', '194', '207', '212', '217', '244', '278', '281', '289', '315', '340', '362', '388', '390', '394', '395', '448', '471', '472', '480', '482', '509', '510', '527', '528', '550', '551', '556', '588', '605', '615', '653', '657', '666', '702', '736', '772', '815', '827', '843', '844', '851', '86', '930', '931', '99', '990', '993', '995']

    PET: ['147', '445', '1202', '1253', '1262', '1383', '1535']

    Thanks

    Alice Joubert

    unread,
    Apr 8, 2025, 5:25:38 AMApr 8
    to clinic...@googlegroups.com
    Hello,

    I investigated a bit using these lists of subjects, and this behavior is expected. 

    - Subject "0151083" seems to be a known subject that will never ever be converted, probably because it's invalid
    - For any other, the converter checks in the metadata if it can find the session from the raw data using its exam date and if can't, it won't convert this session in particular. For example for subject 990 for T1 :

    image.png

    The `-4` in column EXAMDATE means there is no info about it so the converter can't find correspondence with the session in the raw data and will not convert it.

    What we could do however is at least warn the user about it because there is no information about this when running the converter...

    Hope that helps,

    Alice

    Muhammad Orhan

    unread,
    Apr 8, 2025, 5:28:33 AMApr 8
    to clinic...@googlegroups.com
    Hi! Dear Alice,
    Thank you very much. This is helpful.

    Best Regards,
    Muhammad

    Reply all
    Reply to author
    Forward
    0 new messages