This is an old revision of the document!
EPI Correction with polarity images using TOPUP
Steps to setup and apply FSL Topup correction on EPI data collected here with the use of your polarity images
Create your acquisition parameters
There will be two series of single timepoint EPI images. You can grab relevant info to create the acq_params.txt files.
You need to calculate echo train length and get the polarity direction.
the ETL for the parameter file will be:
ETL = ( echospacing * echotrainlength ) / 1000 #in secs
the polarity for the entry will have to be determined from the seriesdescription, which is typically “field map reverse polarity” or “field map regular”
reverse will be “-1” in the acq_params.txt and regular will be “1”
echo '0 1 0 [ETL]' > acq_params.txt echo '0 -1 0 [ETL]' >> acq_params.txt example output: 0 1 0 0.604 0 -1 0 0.604
Create your Blip Up/Down image
Merge the two polarity images together into a 4D file with fsl_merge. Put them in the order of your acq_params.txt file. In the example above, it would be regular, then reversed.
fslmerge -t bud ../bia6_00186_006.nii.gz ../bia6_00186_007.nii.gz tesla:00273 cmp12$ fslinfo bud.nii.gz data_type INT16 dim1 128 dim2 128 dim3 70 dim4 2
Run topup to calculate the field and coefficients images for correction
#run popup calculate the field/coef topup --verbose --imain=bud --datain=acq_params.txt --config=$FSLDIR/src/topup/flirtsch/b02b0.cnf --out=rs_topup --fout=topup_field
Now apply the correction to your functional runs
inindex references the “regular” image index from your acq_params.txt file, which is the same phase encode direction of your functional runs
#apply it applytopup --imain=../bia6_00186_008_01.nii.gz --inindex=1 --method=jac --datain=acq_params.txt --topup=rs_topup --out=run008 --verbose applytopup --imain=../bia6_00186_009_01.nii.gz --inindex=1 --method=jac --datain=acq_params.txt --topup=rs_topup --out=run009 --verbose applytopup --imain=../bia6_00186_010_01.nii.gz --inindex=1 --method=jac --datain=acq_params.txt --topup=rs_topup --out=run010 --verbose
The top two images are an example of the polarity images after correction, which is not necessary. The bottom two images are the mean functional image of a series uncorrected, then corrected by the topup results.