aramis-lab / clinica

Software platform for clinical neuroimaging studies
http://www.clinica.run/
Other
218 stars 72 forks source link

TotalReadoutTime and PhaseEncodingDirection #1098

Open ta4218 opened 3 months ago

ta4218 commented 3 months ago

Hello,

I am working with Clinica 0.7.7, Python 3.10. My OS is Red Hat Enterprise Linux 8.5 (Ootpa). When running the following dwi_preprocessing pipeline, the program crashes with the attached error. clinica run dwi-preprocessing-using-t1 $EPHEMERAL/ADNI234_2/adni_bids_centered $EPHEMERAL/ADNI234_2/adni_caps_final -tsv $EPHEMERAL/ADNI234_2/missing_modalities_dwi/batches_dwi_updated/dwi_session_batch_0.tsv --n_procs 128 -wd $EPHEMERAL

File: /rds/general/user/ta4218/home/crash-20240311-131134-ta4218-0-InitNode.a005-9a3d9221-33be-41d8-afe7-ff4882c11ba3.pklz
Node: dwi-preprocessing-using-t1.0-InitNode
Working directory: /rds/general/ephemeral/user/ta4218/ephemeral/dwi-preprocessing-using-t1/2744ebd6d34d56fd34ad7ab1cc4e87d16a6de534/0-InitNode

Node inputs:

bval = /rds/general/ephemeral/user/ta4218/ephemeral/ADNI234_2/adni_bids_centered/sub-ADNI100S6273/ses-M018/dwi/sub-ADNI100S6273_ses-M018_dwi.bval
bvec = /rds/general/ephemeral/user/ta4218/ephemeral/ADNI234_2/adni_bids_centered/sub-ADNI100S6273/ses-M018/dwi/sub-ADNI100S6273_ses-M018_dwi.bvec
dwi = /rds/general/ephemeral/user/ta4218/ephemeral/ADNI234_2/adni_bids_centered/sub-ADNI100S6273/ses-M018/dwi/sub-ADNI100S6273_ses-M018_dwi.nii.gz
dwi_json = /rds/general/ephemeral/user/ta4218/ephemeral/ADNI234_2/adni_bids_centered/sub-ADNI100S6273/ses-M018/dwi/sub-ADNI100S6273_ses-M018_dwi.json
function_str = def init_input_node(t1w, dwi, bvec, bval, dwi_json):
    """Initialize the pipeline."""
    from clinica.utils.dwi import bids_dir_to_fsl_dir, check_dwi_volume
    from clinica.utils.filemanip import extract_metadata_from_json, get_subject_id
    from clinica.utils.ux import print_begin_image

    # Extract image ID
    image_id = get_subject_id(t1w)

    # Check that the number of DWI, bvec & bval are the same
    check_dwi_volume(dwi, bvec, bval)

    # Read metadata from DWI JSON file:
    [total_readout_time, phase_encoding_direction] = extract_metadata_from_json(
        dwi_json, ["TotalReadoutTime", "PhaseEncodingDirection"]
    )
    phase_encoding_direction = bids_dir_to_fsl_dir(phase_encoding_direction)

    # Print begin message
    print_begin_image(
        image_id,
        ["TotalReadoutTime", "PhaseEncodingDirection"],
        [str(total_readout_time), phase_encoding_direction],
    )

    return (
        image_id,
        t1w,
        dwi,
        bvec,
        bval,
        total_readout_time,
        phase_encoding_direction,
    )

t1w = /rds/general/ephemeral/user/ta4218/ephemeral/ADNI234_2/adni_bids_centered/sub-ADNI100S6273/ses-M018/anat/sub-ADNI100S6273_ses-M018_T1w.nii.gz

Traceback: 
Traceback (most recent call last):
  File "/rds/general/user/ta4218/home/anaconda3/envs/clinica/lib/python3.10/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/rds/general/user/ta4218/home/anaconda3/envs/clinica/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 524, in run
    result = self._run_interface(execute=True)
  File "/rds/general/user/ta4218/home/anaconda3/envs/clinica/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 642, in _run_interface
    return self._run_command(execute)
  File "/rds/general/user/ta4218/home/anaconda3/envs/clinica/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 750, in _run_command
    raise NodeExecutionError(
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node 0-InitNode.

Traceback (most recent call last):
  File "/rds/general/user/ta4218/home/anaconda3/envs/clinica/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 398, in run
    runtime = self._run_interface(runtime)
  File "/rds/general/user/ta4218/home/anaconda3/envs/clinica/lib/python3.10/site-packages/nipype/interfaces/utility/wrappers.py", line 142, in _run_interface
    out = function_handle(**args)
  File "<string>", line 14, in init_input_node
  File "/rds/general/user/ta4218/home/anaconda3/envs/clinica/lib/python3.10/site-packages/clinica/utils/filemanip.py", line 469, in extract_metadata_from_json
    raise ClinicaException(error_message)
clinica.utils.exceptions.ClinicaException: Clinica could not find the following keys in the following JSON file: /rds/general/ephemeral/user/ta4218/ephemeral/ADNI234_2/adni_bids_centered/sub-ADNI100S6273/ses-M018/dwi/sub-ADNI100S6273_ses-M018_dwi.json:
- TotalReadoutTime
- PhaseEncodingDirection

I have attempted to remove images that cause this error-- but each time it crashes with a new image. Any guidance is greatly appreciated. Looking into this error, it seems that there is a problem with images from Philips scans. The referenced json files do not have a TotalReadoutTime or PhaseEncodingDirection.

Best, Tom

github-actions[bot] commented 3 weeks ago

This issue is considered stale because it has not received further activity for the last 14 days. You may remove the inactive label or add a comment, otherwise it will be closed after the next 14 days.