Dcm2bids phase encoding direction

I have a BOLD sequence that I am preprocessing with fmriprep. I noticed the phase encoding direction on the output.html was different than I had anticipated (screenshot below).
Screenshot from 2023-02-21 14-18-32

I expected it be AP as is indicated in my sequence settings from the scanner (see below).

Expected encoding directions:
BOLD: A>>P
fmap1: A>>P
fmap2: P>>A

I checked the .json file of the BOLD scan in the BIDS root that stated "PhaseEncodingDirection": "j". Likewise, I have two field maps that should be AP and PA but the .json lists the "PhaseEncodingDirection": "j-" for both fmaps.

I used dcm2bids to convert from DICOM to NifTi. I was wondering whether there was perhaps a mistake in the conversion that would cause the phase encoding directions to be altered or any other ideas as to what’s going on?

Hi @aftonnelson,

It would be hard for us to debug without seeing at least your dcm2bids config file and your fmap jsons before reorganization. Can you also confirm you are on the latest version of dcm2bids?

Best,
Steven

@Steven, sure thing!

dcm2bids config file:

{
    	"dataType": "fmap",
    	"modalityLabel": "epi", 
    	"customLabels": "dir-AP_run-1", 
    	"criteria": {
    		"SidecarFilename": "009*"
    		},
    	"intendedFor": 3
    	},
    	{
    	"dataType": "fmap",
    	"modalityLabel": "epi", 
    	"customLabels": "dir-PA_run-1", 
    	"criteria": {
    		"SidecarFilename": "010*"
    		},
    	"intendedFor": 3
    	},
    	{
    	"dataType": "func",
    	"modalityLabel": "bold", 
    	"customLabels": "task-int", 
    	"criteria": {
    		"SidecarFilename": "011*"
    		},
    		"sidecarChanges": {
    			"TaskName": "task-int"
    		}

And I only have the DICOM of the fmaps before running dcm2bids.

I had been using version 2.1.6.

You can run dcm2bids_helper to regenerate the jsons. I’ll add that SidecarFilename is usually not the best field to base matching off of, since that assumes the scan order is the same for each scan. So, if something had to be repeated or order changed, this would no longer work.

I have recreated the .json for both field maps. I have different config files for each participant to match the SidecarFilename accordingly.

AP-fmap

"PercentPhaseFOV": 100,
	"PercentSampling": 100,
	"EchoTrainLength": 70,
	"PhaseEncodingSteps": 70,
	"AcquisitionMatrixPE": 70,
	"ReconMatrixPE": 70,
	"BandwidthPerPixelPhaseEncode": 24.631,
	"EffectiveEchoSpacing": 0.000579989,
	"DerivedVendorReportedEchoSpacing": 0.000579989,
	"TotalReadoutTime": 0.0400193,
	"PixelBandwidth": 2305,
	"DwellTime": 3.1e-06,
	"PhaseEncodingDirection": "j-",
	"SliceTiming": [
		3.99,
		0,
		4.24,
		0.25,
		4.49,
		0.5,
		4.74,
		0.75,
		4.9875,
		0.9975,
		5.2375,
		1.2475,
		5.4875,
		1.4975,
		5.7375,
		1.7475,
		5.985,
		1.995,
		6.235,
		2.245,
		6.485,
		2.495,
		6.735,
		2.745,
		6.9825,
		2.9925,
		7.2325,
		3.2425,
		7.4825,
		3.4925,
		7.7325,
		3.7425	],
	"ImageOrientationPatientDICOM": [
		0.997792,
		-0.0603142,
		0.027818,
		0.0596293,
		0.997912,
		0.0248255	],
	"ImageOrientationText": "Tra>Sag(1.7)>Cor(1.3)",
	"InPlanePhaseEncodingDirectionDICOM": "COL",
	"ConversionSoftware": "dcm2niix",
	"ConversionSoftwareVersion": "v1.0.20220720"
}

PA fmap

"PercentPhaseFOV": 100,
	"PercentSampling": 100,
	"EchoTrainLength": 70,
	"PhaseEncodingSteps": 70,
	"AcquisitionMatrixPE": 70,
	"ReconMatrixPE": 70,
	"BandwidthPerPixelPhaseEncode": 24.631,
	"EffectiveEchoSpacing": 0.000579989,
	"DerivedVendorReportedEchoSpacing": 0.000579989,
	"TotalReadoutTime": 0.0400193,
	"PixelBandwidth": 2305,
	"DwellTime": 3.1e-06,
	"PhaseEncodingDirection": "j-",
	"SliceTiming": [
		3.99,
		0,
		4.24,
		0.25,
		4.4875,
		0.4975,
		4.7375,
		0.7475,
		4.9875,
		0.9975,
		5.2375,
		1.2475,
		5.485,
		1.495,
		5.735,
		1.745,
		5.985,
		1.995,
		6.235,
		2.245,
		6.4825,
		2.4925,
		6.7325,
		2.7425,
		6.9825,
		2.9925,
		7.2325,
		3.2425,
		7.48,
		3.49,
		7.73,
		3.74	],
	"ImageOrientationPatientDICOM": [
		0.998104,
		-0.0548317,
		0.0279731,
		0.0596479,
		0.973784,
		-0.219517	],
	"ImageOrientationText": "Tra>Cor(-12.8)>Sag(0.9)",
	"InPlanePhaseEncodingDirectionDICOM": "COL",
	"ConversionSoftware": "dcm2niix",
	"ConversionSoftwareVersion": "v1.0.20220720"

Comparing the json files from helper and after in the BIDS format, it looks like the encoding direction is the same for both field maps "PhaseEncodingDirection": "j-" and the BOLD scan "PhaseEncodingDirection": "j". Could it be something with how helper recreates the .json?

Altneratively, I would be unsure why the DICOMs do not match the sequence settings.

I do not recommend this strategy. It would be best to have a single config file, using specific criteria based on something like sequence name, for example.

The helper is basically just doing dcm2niix, so probably not. I would bet it is something with the sequence on the scanner.

If you are absolutely certain the fieldmaps are correct and that the phase encoding direction on one of the jsons is a mistake, you can try hard coding a phase encoding direction with the sidecarChanges option (see here for example)

Best,
Steven

I would suggest you open both fieldmaps and compare the images. If they look about the same in areas were you can expect significant distortions, then the phase encoding direction was indeed the same in both cases. If they look clearly different, then they were opposite.