Skip to content

ValueError: "There must be no dates in .json sidecar" on Philips #843

@Camilo-Castelblanco

Description

@Camilo-Castelblanco

1. Example NIfTI files converted separately (via dcm2niix)
From one subject/session (BRK0312_MRI_TP1_01252025), converting DICOMs directly with dcm2niix gives filenames like:

BRK0312_MRI_TP1_01252025_sT1W_3D_TFE_20250125082423_201.nii(.json)
BRK0312_MRI_TP1_01252025_T2W_FFE_20250125082423_701.nii(.json)
BRK0312_MRI_TP1_01252025_3D_Brain_VIEW_FLAIR_20250125082423_401.nii(.json)
BRK0312_MRI_TP1_01252025_DTI_low_20250125082423_601.nii(.json/.bval/.bvec)
BRK0312_MRI_TP1_01252025_pCASL_20250125082423_501.nii(.json)
BRK0312_MRI_TP1_01252025_RESTING_STATE-fMRI_20250125082423_801.nii(.json and many *_tNNNNN.nii/.json)
Scanner: Philips (shows “Philips Scaling Values RS:RI:SS = ...” in dcm2niix output).

2. Heuristic file (simplified)

def create_key(template, outtype=('nii.gz',), annotation_classes=None):
    return template, outtype, annotation_classes

t1w   = create_key('sub-{subject}/ses-{session}/anat/sub-{subject}_ses-{session}_T1w')
t2w   = create_key('sub-{subject}/ses-{session}/anat/sub-{subject}_ses-{session}_T2w')
flair = create_key('sub-{subject}/ses-{session}/anat/sub-{subject}_ses-{session}_FLAIR')
dwi   = create_key('sub-{subject}/ses-{session}/dwi/sub-{subject}_ses-{session}_dwi')
asl   = create_key('sub-{subject}/ses-{session}/perf/sub-{subject}_ses-{session}_asl')
rest  = create_key('sub-{subject}/ses-{session}/func/sub-{subject}_ses-{session}_task-rest_bold')

def infotodict(seqinfo):
    info = {t1w: [], t2w: [], flair: [], dwi: [], asl: [], rest: []}
    for s in seqinfo:
        desc = (s.series_description or '').lower()
        if 'st1w_3d_tfe' in desc:
            info[t1w].append(s.series_id)
        elif 't2w_ffe' in desc:
            info[t2w].append(s.series_id)
        elif '3d_brain_view_flair' in desc:
            info[flair].append(s.series_id)
        elif 'dti_low' in desc:
            info[dwi].append(s.series_id)
        elif 'pcasl' in desc:
            info[asl].append(s.series_id)
        elif 'resting_state-fmri' in desc or 'resting_state' in desc:
            info[rest].append(s.series_id)
    return info

3. Command

heudiconv
--files /filepath/BRK0312_MRI_TP1_01252025/*/DICOM
-o /filepath/bids
-f /dartfs/.../brk_heuristic.py
-s brk0312
--ses tp1
-c dcm2niix
-b
--minmeta

4. Error
Only the FLAIR series converts; then HeuDiConv crashes with:
INFO: Converting ... FLAIR ... (320 DICOMs) -> ...sub-brk0312_ses-ses-tp1_FLAIR_heudiconv954.nii
...
Traceback (most recent call last):
File "/.../envs/heudiconv38/bin/heudiconv", line 10, in
sys.exit(main())
File "/.../envs/heudiconv38/lib/python3.8/site-packages/heudiconv/cli/run.py", line 30, in main
workflow(**kwargs)
File "/.../envs/heudiconv38/lib/python3.8/site-packages/heudiconv/main.py", line 479, in workflow
prep_conversion(
File "/.../envs/heudiconv38/lib/python3.8/site-packages/heudiconv/convert.py", line 259, in prep_conversion
convert(
File "/.../envs/heudiconv38/lib/python3.8/site-packages/heudiconv/convert.py", line 639, in convert
tuneup_bids_json_files(bids_outfiles)
File "/.../envs/heudiconv38/lib/python3.8/site-packages/heudiconv/bids.py", line 331, in tuneup_bids_json_files
raise ValueError("There must be no dates in .json sidecar")
ValueError: There must be no dates in .json sidecar
So even with HEUDICONV_ALLOW_DATES=1 and --minmeta, tuneup_bids_json_files still raises ValueError.

5. Environment (HPC)

System: university HPC cluster (SLURM)
OS: Linux x86_64
Python: 3.8 (conda env)

conda create -n heudiconv38 -c conda-forge python=3.8 heudiconv dcm2niix
conda activate heudiconv38
HeuDiConv version: 1.1.6 (INFO: Running heudiconv version 1.1.6)
dcm2niix: v1.0.20250505 (reported in log)
Scanner: Philips (Philips scaling values reported in dcm2niix output).

6. Tried solutions

Set HEUDICONV_ALLOW_DATES=1 (exported in shell; confirmed visible in the same process).
Added --minmeta to reduce metadata from dcm2niix.
Verified that conversion itself runs (FLAIR NIfTI is created successfully).
Error consistently arises during tuneup_bids_json_files(bids_outfiles) with ValueError("There must be no dates in .json sidecar").

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions