Dcm2bids dcm2niix more runs than expected

Hello everyone,

I am very new to BIDS and dcm2bids, the solution may be simpler than I think…
I’m trying to convert my own DICOMs to BIDS-compatible nitfi using dcm2bids. However, something strange happens: dcm2niix extracts and converts more runs than expected (exactly 3 more runs).
Stranger still: I tested the dcm2niix conversion using mricroGL and it gives me the right number of runs.

The only difference I can see is that I used a configuration file in dcm2bids and not in mricoGL. I don’t know if that’s the key…

Here’s the config_file.json file (it’s a test file, more acquisitions will be added) :

{
  "descriptions": [
    {
      "datatype": "anat",
      "suffix": "T1w",
      "criteria": {
        "SeriesDescription": "T1_MPRAGE_AX"
      },
      "sidecar_changes": {
        "ProtocolName": "T1"
      }
    }
  ]
}

The dcm2bids command:

D:\TE_VIDEO_dcm2bids>dcm2bids -d D:\TE_VIDEO_dcm2bids\sourcedata\dicoms -p TE03 -c D:\TE_VIDEO_dcm2bids\code\config_file.json --auto_extract_entities

The dcm2niix command (automatically built & run by dcm2bids):

dcm2niix -b y -ba y -z y -f %3s_%f_%p_%t -o D:\TE_VIDEO_dcm2bids\tmp_dcm2bids\sub-TE03 D:\TE_VIDEO_dcm2bids\sourcedata\dicoms

Any help will be appreciated!

Thanks,

Alex


Hi @Alexandre,

You might need to add more criteria to your config file. For T1s, the series description may not be specific enough as you may need to additionally use the ImageType field to get the specific T1 dicom (for example, the RMS image across echoes).

Best,
Steven

Hi @Steven,

Thanks for your reply.
I revised the config_file.json, including the value found in T1w json file (I had converted DICOM with dcm2niix in mricroGL to obtain json file, as it seems working well).
However, I always got 3 runs.
From the json fies of these 3 runs, I saw that the “SeriesNumber” is correct (i.e. same as the json file obtained from mricroGL dcm2niix conversion). However, “AcquisitionTime” is incorrect for the run2 and run3 created by dcm2niix through dcm2bids.

The revised config_file:

{
  "descriptions": [
    {
      "datatype": "anat",
      "suffix": "T1w",
      "criteria": {
        "SeriesDescription": "T1_MPRAGE_AX",
		"ImageType": ["ORIGINAL", "PRIMARY", "M", "ND", "NORM", "FM3", "2", "FIL"]
      },
      "sidecar_changes": {
        "ProtocolName": "T1"
      }
    }
  ]
}

Hi @Alexandre,

Without seeing json files from your dcm2niix output it is hard to provide you with concrete suggestions for changing your config file.

Best,
Steven

Indeed!
Here a json file of a T1 image

{
	"Modality": "MR",
	"MagneticFieldStrength": 3,
	"ImagingFrequency": 123.219,
	"Manufacturer": "Siemens",
	"ManufacturersModelName": "Skyra",
	"InstitutionName": "CHU",
	"InstitutionalDepartmentName": "Department",
	"InstitutionAddress": "XX",
	"DeviceSerialNumber": "46055",
	"StationName": "AWP46055",
	"BodyPartExamined": "BRAIN",
	"PatientPosition": "HFS",
	"ProcedureStepDescription": "MR_FONCTIONNELLE CEREBRALE",
	"SoftwareVersions": "syngo MR E11",
	"MRAcquisitionType": "3D",
	"SeriesDescription": "T1_MPRAGE_AX",
	"ProtocolName": "T1_MPRAGE_AX",
	"ScanningSequence": "GR\\IR",
	"SequenceVariant": "SK\\SP\\MP\\OSP",
	"ScanOptions": "IR",
	"SequenceName": "*tfl3d1_16",
	"ImageType": ["ORIGINAL", "PRIMARY", "M", "ND", "NORM", "FM3", "2", "FIL"],
	"NonlinearGradientCorrection": false,
	"SeriesNumber": 14,
	"AcquisitionTime": "11:26:1.462500",
	"AcquisitionNumber": 1,
	"SliceThickness": 0.9,
	"SAR": 0.0682011,
	"EchoTime": 0.00251,
	"RepetitionTime": 2.2,
	"SpoilingState": true,
	"InversionTime": 0.9,
	"FlipAngle": 8,
	"PartialFourier": 1,
	"BaseResolution": 256,
	"ShimSetting": [
		3373,
		1095,
		2174,
		-19,
		-74,
		206,
		-19,
		12	],
	"TxRefAmp": 360.186,
	"PhaseResolution": 1,
	"PhaseOversampling": 0.1,
	"ReceiveCoilName": "HeadNeck_20",
	"ReceiveCoilActiveElements": "HE1-4;NE1,2",
	"PulseSequenceDetails": "%SiemensSeq%\\tfl",
	"RefLinesPE": 24,
	"CoilCombinationMethod": "Adaptive Combine",
	"ConsistencyInfo": "N4_VE11A_LATEST_20140830",
	"MatrixCoilMode": "GRAPPA",
	"PercentPhaseFOV": 100,
	"PercentSampling": 100,
	"PhaseEncodingSteps": 282,
	"AcquisitionMatrixPE": 256,
	"ReconMatrixPE": 256,
	"ParallelReductionFactorInPlane": 2,
	"PixelBandwidth": 250,
	"DwellTime": 7.8e-06,
	"ImageOrientationPatientDICOM": [
		0.999699,
		0.012244,
		0.0212834,
		-0.00244273,
		0.912093,
		-0.409976	],
	"ImageOrientationText": "Tra>Cor(-24.2)>Sag(1.4)",
	"InPlanePhaseEncodingDirectionDICOM": "ROW",
	"ConversionSoftware": "dcm2niix",
	"ConversionSoftwareVersion": "v1.0.20220720"
}

Can you also share those for the runs that get included in dcm2bids that you don’t want?

Sure! The first one is the same as in my previous response (obtain from mricroGL dcm2niix conversion). The others are obtain from dcm2niix embedded in dcm2bids.

014_TE04_AU-CL_T1_MPRAGE_AX_20170713121201.txt (2.1 KB)
sub-TE04_run-01_T1w.txt (2.5 KB)
sub-TE04_run-02_T1w.txt (2.5 KB)
sub-TE04_run-03_T1w.txt (2.5 KB)

I have personally never seen T1 files with the ImageType ["FM3", "2", "FIL"], so I am not sure what these image types are. The fact that you get different AcquisitionTimes suggests that these three runs are coming across different scans, as usually all converted T1 outputs for a single scan (e.g., the individual echoes) will all have the same AcqusitionTime. But, that you have the same SeriesNumber suggests that perhaps your dicom dir has multiple subjects? Of the three runs converted, do they look different when viewed by a file viewer? Different enough that it could be different subjects? Are file sizes similar / the same?

I have personally never seen T1 files with the ImageType ["FM3", "2", "FIL" ], so I am not sure what these image types are.

Unfortunately, I’m an end user and I confess I don’t know either :confused:

The fact that you get different AcquisitionTimes suggests that these three runs are coming across different scans, as usually all converted T1 outputs for a single scan (e.g., the individual echoes) will all have the same AcqusitionTime. But, that you have the same SeriesNumber suggests that perhaps your dicom dir has multiple subjects? Of the three runs converted, do they look different when viewed by a file viewer? Different enough that it could be different subjects? Are file sizes similar / the same?

In fact, I was thinking it was a strange coincidence that it gives me 3 runs when I had 3 test subjects in my working directory. Looking at the acquisition times, I see that the first one corresponds to subject TE03 in the code

dcm2bids -d D:\TE_VIDEO_dcm2bids\sourcedata\dicoms -p TE03 -c D:\TE_VIDEO_dcm2bids\code\config_file.json --auto_extract_entities

and the other acquisition times in the two other json files correspond to the images of the other two subjects! In other words, dcm2bids (or dcm2niix) search for all images matching the criteria, even if I stipulate TE03? In fact, stipulating TE03 simply means that all the images it extracts belong to subject TE03? I thought it was targeting the dicoms directory…

Subject names are not encoded in dicoms. It will look at everything in the dicom directory. Make sure subject dicoms are in their own folders, and pass those subject-specific folders in to the -d argument.

Best,
Steven

I am very new to BIDS and dcm2bids, the solution may be simpler than I think…

It definitly was !

Thanks!