Heudiconv mapped EPI generates additional files

Hi experts,

Recently, our 3T Siemens MRI Scanners have upgraded the image format from .IMA to .dcm, and the parameter settings for our EPI scans are fixed.

In the past, when I used heudiconv to convert EPI (.IMA), only files like figure1 would appear.

But when using heudiconv to convert EPI (.dcm), not every time, an additional file that I did not expect will be generated - “sub … bold2” (as shown in Figure 2,3)

The generated file is shown in Figure 4.

I was wondering if anyone has encountered a similar situation? Is there a way to avoid generating this file?

Pictures are attached to the link:
https://drive.google.com/drive/folders/15DtMBqTWcJlAD5Pn3cvhLfQQznuj02_k?usp=sharing

Any suggestions or opinions are greatly appreciated.

what heuristic do you use? any samples of DICOMs to try on? what do you get if you convert manually using dcm2niix one of those series?

Tanks for your reply.

My heuristic is adapted from what comes with heudiconv.
And the conditional expression comes from the .tsv file reported by heudiconv.
(The .tsv file is shown in figure five, added to the link)
Here’s my “heuristic.py”

# heuristic.py
from __future__ import annotations
from typing import Optional
from heudiconv.utils import SeqInfo
import os 

def create_key(
    template: Optional[str],
    outtype: tuple[str, ...] = ("nii.gz",),
    annotation_classes: None = None,
) -> tuple[str, tuple[str, ...], None]:
    if template is None or not template:
        raise ValueError("Template must be a valid format string")
    return (template, outtype, annotation_classes)


def infotodict(
    seqinfo: list[SeqInfo],
) -> dict[tuple[str, tuple[str, ...], None], list[str]]:

    data = create_key("run{item:03d}")

    t1w        = create_key('sub-{subject}/{session}/anat/sub-{subject}_{session}_T1w')
    t2w        = create_key('sub-{subject}/{session}/anat/sub-{subject}_{session}_T2w')
    epi_cond   = create_key('sub-{subject}/{session}/func/sub-{subject}_{session}_task-cond_bold')
    epi_main_1 = create_key('sub-{subject}/{session}/func/sub-{subject}_{session}_task-main_run-1_bold')
    epi_main_2 = create_key('sub-{subject}/{session}/func/sub-{subject}_{session}_task-main_run-2_bold')
    fmap_mag   = create_key('sub-{subject}/{session}/fmap/sub-{subject}_{session}_magnitude')
    fmap_phase = create_key('sub-{subject}/{session}/fmap/sub-{subject}_{session}_phasediff')
    dwi        = create_key('sub-{subject}/{session}/dwi/sub-{subject}_{session}_dwi')
    
    info: dict[tuple[str, tuple[str, ...], None], list[str]] = {data: []}
    info = {t1w:[], t2w: [], epi_cond:[], epi_main_1:[], epi_main_2:[], fmap_mag:[], fmap_phase:[], dwi:[]}
    
    for idx, s in enumerate(seqinfo):
        
        if (s.dim1 == 288) and (s.dim2 == 288) and ('t1_mprage_sag_p2_3D_64ch' in s.protocol_name):
            info[t1w].append(s.series_id)
        if (s.dim1 == 256) and (s.dim2 == 256) and ('t2_tse_tra_256_4mm_2D_37Slices' in s.protocol_name):
            info[t2w].append(s.series_id)
        if (s.dim1 ==  64) and (s.dim2 ==  64) and ('ep2d_bold_3.9mm_TR2_Exp1_750Scans' in s.protocol_name):
            info[epi_cond].append(s.series_id)
        if (s.dim1 ==  64) and (s.dim2 ==  64) and ('ep2d_bold_3.9mm_TR2_Exp2_750Scans' in s.protocol_name):
            info[epi_main_1].append(s.series_id)
        if (s.dim1 ==  64) and (s.dim2 ==  64) and ('ep2d_bold_3.9mm_TR2_Exp3_750Scans' in s.protocol_name):
            info[epi_main_2].append(s.series_id)
        if (s.series_files == 2) and (s.dim1 == 128) and ('gre_field_mapping' in s.protocol_name):
            info[fmap_mag].append(s.series_id)
        if (s.series_files == 1) and (s.dim1 == 128) and ('gre_field_mapping' in s.protocol_name):
            info[fmap_phase].append(s.series_id)
        if (s.dim1 ==  96) and (s.dim2 ==  96) and ('ep2d_diff_DTI_b1000_30Dir' in s.protocol_name):
            info[dwi].append(s.series_id)
    return info

I have tried manually converting the EPI using MRIcroGL(dcm2niix) and dcm2niigui(dcm2nii),
MRIcroGL will also generate the same file as Figure 4 as Heudiconv, but dcm2niigui will not happen.

Please forgive me for not being able to provide a sample at the moment,
but I will get one as soon as possible.

best regards