# Phase encoding direction and total readout time parameters in examcard

Hi there,

I was wondering if anybody would be able to find the variable names corresponding to the phase encoding direction and total readout time of topup scans in this examcard file (.txt version) attached.

Scans were acquired with a Philips machine and the variables are not present in the dicom headers. I need these to convert my dataset in BIDS format.

Thanks,
Best,
-Loïc
noise_20201117_2_.txt (491.0 KB)

EX_STACKS_0__prep_dir : AP should be j-.

The total readout time can be calculated from the WFS and ETL. From Philips B0 maps for unwarping EPI.pdf

E. Calculation of the echo spacing or dwell time
To calculate the echo spacing and/or dwell time, you need two pieces of information from
the scan protocol: the “EPI train length” and the “Act. WFS / BW (Hz)” in pixels. Both are
found on the info page. Hints: The EPI train length (ETL) is always odd. The WFS is usually in the range
8-16 pixels, or 50-200Hz. Ignore the “BW in the freq dir” which is much higher (typically several kilohertz).

You also need to know the water-fat shift in Hz at your magnet’s field strength. Hints: if you
use gamma = 42.57 MHz/T, B0 in Tesla, and the water-fat shift as 3.4ppm, you can just multiply them
together and the answer will be in Hz. Eg: at 3.0T, the wfs is 42.57 x 3 x 3.4 = 434.214Hz
Calculate the echo spacing in ms using this equation: Eg: if the WFS is 8.129 pixels and the ETL is
43, the echo spacing (ES) comes to 0.4255ms.

ES = 1000 * WFS(pixels) / (wfs * (ETL + 1))

The “dwell time” is the total duration of the EPI echo train, which can now be calculated:
(18.1ms in the example given before).

Dwell = ES * ETL

Since the ETL takes care of the SENSE factor, you don‟t need to do any further calculation
to calculate an “effective dwell time”.

I do not know when and why, but on our system heudiconv (dcm2niix) is able to guess the echospacing since some time.

I use for the bold scans

``````#!/usr/bin/env python3

from bids import BIDSLayout
import json
import os
import stat
import nibabel as nib

layout = BIDSLayout('my_nifti_path')
bold_files=layout.get( suffix='bold', extension='nii.gz')

for epi_file in bold_files:
myjson.update({'SliceTiming': [slicescantime * 2./slices for slicescantime in range(slices//2)]*2 })
myjson.update({'PhaseEncodingDirection':'j-'})
myjson.update({'EffectiveEchoSpacing':epi_file.tags['EstimatedEffectiveEchoSpacing'].value})
os.chmod(epi_file.path.replace('.nii.gz', '.json'), stat.S_IWRITE | stat.S_IREAD | stat.S_IRGRP | stat.S_IROTH )
with open (epi_file.path.replace('.nii.gz', '.json'),'w') as jf:
jf.write(json.dumps(myjson, indent=4))

``````

Please see dcm2niix issue and dcm2niix notes. I forget all the details, but it is impossible to calculate the FSL-definition of these values in all cases. You can always work with the Philips Clinical Scientist responsible for your center to determine these values (and have them lobby the manufacturer to create DICOM images that allow reproducible science).

Thanks for all these helpful replies. In terms of the naming, is Dwell time the same as Total Readout time?

Also, looking at the EX_STACKS_0__prep_dir : AP
variable, it looks like both my experimental scans and my topup scans have the same encoding direction (that is, AP or j-). Do you think we made a mistake in the acquisition?

Isn’t the topup scan supposed to have an opposite phase encoding direction from the experimental scan?

Thanks!
Best,
-Loïc