How to automatically find pe_dir when using dwifslpreproc?

Hi experts!

I’m trying to run dwifslpreproc on lots of DWI images, I have no reversed phase-encoding image data, so I’m using the command to perform eddy current and motion correction only. I first tried using this command:

for_each ${pth}/*/preprocessing : dwifslpreproc IN/DWI_denoised.nii IN/DWI_preprocessed.nii -json_import IN/*DTI*json -fslgrad IN/*DTI*bvec IN/*DTI*bval -rpe_header -eddy_options " --slm=linear"

But I’m getting an error with some images:
dwifslpreproc: [ERROR] No phase encoding information found in DWI image header

When I changed the command to this:

for_each ${pth}/*/preprocessing : dwifslpreproc IN/DWI_denoised.nii IN/DWI_preprocessed.nii -json_import IN/*DTI*json -fslgrad IN/*DTI*bvec IN/*DTI*bval -rpe_none -pe_dir j -eddy_options " --slm=linear"

It solved the problem, the thing is that not all the images are pe_dir j there are also j- so I want to know how to adapt the command above to make it find the pe_dir in the header and use it: I’m sure that information is in the header, I just don’t know why when using rpe_header it’s not found (I think it’s because of notation, In some of the examples I’ve run, I’ve noticed that I got the error when in the .json says "PhaseEncodingAxis": "j" but when it says "PhaseEncodingDirection": "j" there is no error.

Thanks.

Al.

Hi Al,

In some of the examples I’ve run, I’ve noticed that I got the error when in the .json says "PhaseEncodingAxis": "j" but when it says "PhaseEncodingDirection": "j" there is no error.

If “PhaseEncodingAxis” appears in the image header / JSON instead ofPhaseEncodingDirection”, it’s because the software used for DICOM conversion was not able to extract from those data information regarding the polarity of phase encoding. Siemens has to provide this information via an additional CSA field “PhaseEncodingDirectionPositive”; for data from other vendors the information is not to my knowledge available, and so generation of a phase encoding table cannot be achieved. For acquisitions with no variation in phase encoding the polarity probably isn’t actually of consequence, though this depends on the internals of eddy which is outside of my expertise.

There is nothing stopping you from manually inserting that information into the JSONs prior to processing, provided you are confident that your knowledge of such is correct.

Rob

Thank you Rob,

I’ve run dwifslpreproc on some DW Images where the polarity couldn’t be extracted, using pe_dir j (as in the "PhaseEncodingAxis") and inspecting the data I can’t find anything wrong (although I’m not an expert). But I wonder if there’s no consequences in the bvecs table or any other information of interest when fitting the DTI model later.

Al.

But I wonder if there’s no consequences in the bvecs table or any other information of interest when fitting the DTI model later.

Modulation of bvecs is based on participant rotation only. The logic I’ve held on to for some time is: the only theoretical consequence of getting the phase encoding polarity wrong, in the absence of susceptibility distortion correction, is if there is an explicit model linking diffusion gradient direction to expected eddy current distortions based on the phase encoding direction. If however there is no such model, and estimation of eddy current distortions is based on image registration only agnostic to gradient direction / phase encoding, then the polarity of phase encoding can’t have any influence on such. But this is a question of the internals of eddy for which I don’t know the answer.

Rob

1 Like