What I want to do?
Perform epi-distorition correction over our dwi images using fugue.
Our dataset for this experiment can be downloaded from here (dcm ; converted data; data4fuguePartI; data4fuguePart2; data4fuguePart3 ) which consists of:
- ax-ap (SET1_acq1_AP_6)
- ax-pa (SET1_acq1_PA_7)
- fieldmap (fieldmap_16x16x32_14)
- magnitudes of multi echos (coilsens_multiecho_32)
- phases of multi echos (coilsens_multiecho_33)
(P.S. the data in data4fugue folder is splited to 3 parts due to the limitation on uploading the files.)
To run fugue command line:
fugue -i b0AP --icorr --unwarpdir=y --dwell=dwellTime --loadfmap=FieldMap -u result
I set the dwell time (echo spacing) to: Echo Spacing (s) = 1 / [(0019,1028) * (0051,100b component #1)]
= 1/[ 5.5019999999999998 * 128 ]= 0.0014
I run fugue considering the following options to set FieldMap (FM):
OPTION1: the FM in hand (fieldmap_16x16x32_14)

| Intensity properties: Minimum -4096.000000000000000 Maximum 4094.000000000000000 Mean -47.703113902698867 Variance 2603513.713320951443166 Sum -42986230.000000000000000 Geometric properties: Size: [128, 128, 55] StartIndex: [0, 0, 0] Spacing: [1.593750000000000, 1.593750000000000, 3.200004577636719] Origin: [-92.558097839355469, -76.970733642578125, -57.719863891601562] |
FM_resample_B0AP_brain.nii.gz in our dataset represents the resampled and brain-masked FM image (the above). Its values are between [-4096 4096]. If I feed this image directly to fugue:
fugue -i ../SET1_acq1_AP_6/b0AP.nii --icorr --unwarpdir=y --dwell=0.0014 --loadfmap=./FM_resample_B0AP_brain.nii.gz -u ../out_fugue_FM_resample_B0AP_brain
The output resutl (out_fugue_FM_resample_B0AP_brain) is not correct.

out_fugue_FM_resample_B0AP_brain.nii | 
b0AP.nii |
That means that we need to map the values of our FM image to proper unit. Would you please guide me what is the proper mapping to do so?
PTION2: compute FM using fsl_prepare_filedmap
In our dataset, we have the manitude (mag1.nii mag2.nii mag3.nii mag4.nii) and phase (pha1.nii pha2.nii pha3.nii pha4.nii) images of 4 echos.

| ============ mag1.nii ============Intensity properties: Minimum 0.000000000000000 Maximum 1084.000000000000000 Mean 83.806185404459640 Variance 16717.556370987054834 Sum 65907866.000000000000000 Geometric properties: Size: [128, 128, 48] StartIndex: [0, 0, 0] Spacing: [1.593799948692322, 1.593799948692322, 3.200000047683716] |

| ============ pha1.nii ============Intensity properties: Minimum -4096.000000000000000 Maximum 4094.000000000000000 Mean -154.429211934407562 Variance 5765004.457419949583709 Sum -121448074.000000000000000 Geometric properties: Size: [128, 128, 48] StartIndex: [0, 0, 0] Spacing: [1.593799948692322, 1.593799948692322, 3.200000047683716] |

| ============ pha2.nii ============Intensity properties: Minimum -4096.000000000000000 Maximum 4094.000000000000000 Mean -124.518488566080734 Variance 5395802.720908988267183 Sum -97925324.000000000000000 Geometric properties: Size: [128, 128, 48] StartIndex: [0, 0, 0] Spacing: [1.593799948692322, 1.593799948692322, 3.200000047683716] |
 | ============ pha3.nii ============ Intensity properties: Minimum -4096.000000000000000 Maximum 4094.000000000000000 Mean 26.398208618164062 Variance 5284832.440826209262013 Sum 20760396.000000000000000 Geometric properties: Size: [128, 128, 48] StartIndex: [0, 0, 0] Spacing: [1.593750000000000, 1.593750000000000, 3.200000762939453] Origin: [-92.558097839355469, -76.970733642578125, -47.300003051757812] |
 | ============ pha4.nii ============ Intensity properties: Minimum -4096.000000000000000 Maximum 4094.000000000000000 Mean -15.623992919921875 Variance 5366888.233273105695844 Sum -12287208.000000000000000 Geometric properties: Size: [128, 128, 48] StartIndex: [0, 0, 0] Spacing: [1.593750000000000, 1.593750000000000, 3.200000762939453] Origin: [-92.558097839355469, -76.970733642578125, -47.300003051757812] |
The values of our phase images are between [-4096 +4096]. I assume that these values are corresponding to [-\(\pi\) \(+\pi\)]. To make the range of the phase images be between [0 2\(\pi\)], I did the following:
- step1: map the values to [-\(\pi\) \(+\pi\)] simply by rescaling as follows:
fslmaths pha1.nii -div 4096 -mul 3.1416 pha1_range_NegPi_PosPi.nii -odt float
fslmaths pha2.nii -div 4096 -mul 3.1416 pha2_range_NegPi_PosPi.nii -odt float
- step2: add 2\(\pi\) to voxels with negative values.
The final images following the above steps are shown here:

out prelude: | ============ pha1_0To2Pi.nii.gz ============ Intensity properties: Minimum 0.000000000000000 Maximum 6.281665802001953 Mean 3.088931463426006 Variance 3.305485068272457 Sum 2429234.548645040951669 Geometric properties: Size: [128, 128, 48] StartIndex: [0, 0, 0] Spacing: [1.593750000000000, 1.593750000000000, 3.200000762939453] Origin: [-92.558097839355469, -76.970733642578125, -47.300003051757812] |
 | ============ pha2_0To2Pi.nii.gz ============ Intensity properties: Minimum 0.000000000000000 Maximum 6.281665802001953 Mean 3.114725006161946 Variance 3.515247404286431 Sum 2449519.416045951191336 Geometric properties: Size: [128, 128, 48] StartIndex: [0, 0, 0] Spacing: [1.593750000000000, 1.593750000000000, 3.200000762939453] Origin: [-92.558097839355469, -76.970733642578125, -47.300003051757812] |
 | ============ pha3_0To2Pi.nii.gz ============ Intensity properties: Minimum 0.000000000000000 Maximum 6.281665802001953 Mean 2.999124929375997 Variance 3.569161460006509 Sum 2358607.816459024325013 Geometric properties: Size: [128, 128, 48] StartIndex: [0, 0, 0] Spacing: [1.593750000000000, 1.593750000000000, 3.200000762939453] Origin: [-92.558097839355469, -76.970733642578125, -47.300003051757812] |
 | ============ pha4_0To2Pi.nii.gz ============ Intensity properties: Minimum 0.000000000000000 Maximum 6.281665802001953 Mean 3.040485530163449 Variance 3.527428407162822 Sum 2391135.116457501426339 Geometric properties: Size: [128, 128, 48] StartIndex: [0, 0, 0] Spacing: [1.593750000000000, 1.593750000000000, 3.200000762939453] Origin: [-92.558097839355469, -76.970733642578125, -47.300003051757812] |
Then, phase difference of the first two echos is computed as:
fslmaths pha2_0To2Pi.nii.gz -sub pha1_0To2Pi.nii.gz sub_pha2_pha1_0To2Pi.nii -odt float

| ============ sub_pha2_pha1_0To2Pi.nii.gz ============ Intensity properties: Minimum -6.270927906036377 Maximum 6.281665802001953 Mean 0.025793543054518 Variance 6.347289289345887 Sum 20284.867651450913399 Geometric properties: Size: [128, 128, 48] StartIndex: [0, 0, 0] Spacing: [1.593750000000000, 1.593750000000000, 3.200000762939453] Origin: [-92.558097839355469, -76.970733642578125, -47.300003051757812] |
since fsl_prepare_fieldmap is expecting at least 90% of 0 to 4096; I follow the same steps mentioned in the above (adding 2\(\pi\) to negative values and then rescaling).
And the following is the output of fsl_pep:
fsl_prepare_fieldmap SIEMENS sub_pha2_pha1_0To2Pi_cor4NegValues.nii mag1_brain.nii.gz out_fslprep.nii.gz 2.63
 | ============ ../out_fslprep.nii.gz ============ Intensity properties: Minimum -3484.412597656250000 Maximum 2522.610839843750000 Mean -28.863866216069862 Variance 82732.142100835044403 Sum -22699468.036036252975464 Geometric properties: Size: [128, 128, 48] StartIndex: [0, 0, 0] Spacing: [1.593750000000000, 1.593750000000000, 3.200000762939453] Origin: [-92.558097839355469, -76.970733642578125, -47.300003051757812] |
and feed the computed FM (res_fsl_prep.nii.gz) to
fugue -i ./data4fugue/b0Aap.nii.gz --dwell=0.0014 --loadfmap=./data4fugue/res_fsl_prep.nii.gz -u ./data4fugue/resFugue_option2_ypos --unwarpdir=y
 | ============ ../out_fugue_fslPrep.nii.gz ============ Intensity properties: Minimum 0.000000000000000 Maximum 4095.000000000000000 Mean 182.933863771004752 Variance 142380.295101588475518 Sum 1198875369.609656810760498 Geometric properties: Size: [256, 256, 100] StartIndex: [0, 0, 0] Spacing: [0.796875000000000, 0.796875000000000, 1.599998474121094] Origin: [-92.558097839355469, -76.970733642578125, -50.519859313964844] |
OPTION3: compute FM using two gradient echos; The phase images need to be in RAD; so,
Given the computed phases in rad (pha1_0To2Pi.nii.gz and pha2_0To2Pi.nii.gz), I run prelude to unwarp them:
prelude -a mag1_brain.nii -p pha1_0To2Pi.nii.gz -o pha1_rad_unwrapped_rad.nii
Outputs of the prelude cmd are shown in the following:
and then, get the FM in rad/s:
fslmaths ./data4fugue/pha2_resampledOnb0Aap__unwrapped_rad.nii.gz -sub ./data4fugue/pha1_resampledOnb0Aap__unwrapped_rad.nii.gz -mul 1000 -div 2.67 ./data4fugue/res_fieldmap_rads_option3 -odt float
 | ============ ./data4fugue/res_fieldmap_rads_option3.nii.gz ============ Intensity properties: Minimum -6612.202636718750000 Maximum 4763.383789062500000 Mean -25.735924166325969 Variance 486072.281850565457717 Sum -168662952.616433858871460 Geometric properties: Size: [256, 256, 100] StartIndex: [0, 0, 0] Spacing: [0.796875000000000, 0.796875000000000, 1.599998474121094] |
and then, run fugue:
fugue -i ./data4fugue/b0Aap.nii.gz --dwell=0.0014 --loadfmap=./data4fugue/res_fieldmap_rads_option3.nii.gz -u ./data4fugue/resFugue_option3_ypos --unwarpdir=y

/resFugue_option3_ypo (which is not correct) |