DiffusionFdtNotes - MRC CBU Imaging Wiki

Upload page content

You can upload content for the page named below. If you change the page name, you can also upload content for another page. If the page name is empty, we derive the page name from the file name.

File to load page content from
Page name
Comment
Type the missing letters from: He's no ded, he's jus resing hs eys

location: DiffusionFdtNotes

Fdt diffusion analysis

For CBU data.

These are just notes of work in progress by MatthewBrett.

See SiemensDiffusionImages for an explanation of the images created during a Siemens diffusion run.

Extracting the bvals, bvecs values from Siemens data

Note - this section has changed significantly - you will need to rerun your direction estimation with the scripts here if you have used the old version

This proved a rather more difficult problem to generalize than it seemed at first. In fact our own Guy Williams (WBIC) solved this problem using his own algorithm and the relevant fields in the DICOM header. We've implemented Guy's algorithm for matlab / SPM.

Use these files:

See the documentation in these files for usage. In brief, to write bvals and bvecs file to current directory, selecting the DICOM files from the GUI:

cbu_write_fdt();

bvals

All one one line, one value per DWI acquisition, appears to be exponential format separated by 3 spaces per value, and needs new line at end of file. For example:

   0.0000000e+00   0.0000000e+00   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03  1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   0.0000000e+00   0.0000000e+00   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   1.0000000e+03   0.0000000e+00l

(Note new line at end of file).

bvecs

One line per direction (one line for X direction, one line for Y direction, one line for Z direction). New line at end of each. Need to include zeros for no diffusion gradient acquisitions. E.G:

0  0.0000000e+00   7.6937618e-01   9.9999924e-01   4.0214920e-02   1.9526217e-01   5.1096926e-01   6.4449110e-01   1.1639260e-01  4.1472436e-01   6.8663556e-01   3.8949705e-01   5.0524772e-01   1.1717751e-01   7.6094012e-01   7.8334360e-01   4.4028061e-01   2.0589133e-01   1.3436626e-01   2.7000378e-01   4.4543086e-01   2.1816264e-01   3.6644717e-01   1.9651463e-01   5.6797954e-01   4.2364378e-01   4.8425159e-01   4.8837442e-01   7.1876309e-01   9.3607570e-02   1.7722160e-01 0 0.0000000e+00   5.1711309e-01   7.5808487e-01   8.0234240e-01   1.9735010e-02   3.3516758e-01   6.3448454e-01   8.1168960e-02   1.0445113e-01   2.6766319e-01   6.7016636e-01   1.5391958e-01   4.1367573e-01   8.8398617e-01   2.1753901e-01   9.3271228e-01   6.9488384e-01   8.8211118e-01   6.9509295e-01   8.7347998e-01   7.5283496e-01   8.8371946e-01   8.8840244e-01   5.5232725e-01   9.3679074e-01   9.4961311e-01   6.4277964e-01   3.4381087e-01   9.9971116e-01   9.9821503e-01   4.6606173e-01   1.3874523e-01 0
0  0.0000000e+00   6.6306062e-01   1.6707810e-02  -9.9903292e-01   7.6591725e-01   7.7929365e-01  -7.8747432e-01  -9.9961185e-01 -8.8677651e-01   3.4283814e-01  -4.8693386e-01   8.8074278e-01  -8.8352002e-01  -7.8999910e-02   2.6876947e-01   2.5290552e-01   9.3262713e-01  -3.3491810e-01   3.2593888e-01   7.5894353e-01  -2.6638000e-03  -9.4866592e-01   9.9998147e-01  -7.8726452e-01  -7.2459950e-01  -6.4709189e-01  -1.7825689e-01   5.5582022e-01   8.8285078e-01   4.8544349e-01 0  0.0000000e+00   4.7983043e-01  -4.9330514e-01  -6.0886478e-01  -4.8934133e-01   9.3013284e-01  -3.1901719e-01  -1.8293329e-01  -6.6242333e-01  -8.8671109e-01  -4.2004243e-01  -7.2580995e-01  -9.4553600e-02   4.6713278e-01   6.6282962e-01   3.7641775e-01  -6.4060372e-01  -4.9143385e-01   1.4877920e-02  -1.6054820e-01   5.4879866e-01  -2.8861432e-01   1.8916095e-01   1.5049253e-01   6.7304890e-02  -3.1584415e-01   7.6457665e-01  -4.3058758e-01  -1.6450303e-01   1.8210187e-01   5.8200226e-01   1.4422617e-01 0
0 -0.0000000e+00  -9.1990930e-02  -1.9943366e-01  -2.0091641e-01  -6.4443377e-01  -4.1432263e-01   6.7578430e-02   1.6516763e-01  2.8580159e-01  -6.7159887e-01   8.0699374e-01  -9.5227750e-02   4.9569470e-01   6.7437421e-01   5.9513629e-01  -8.8444514e-01  -3.5758470e-01   9.5384852e-01   9.2785410e-01   5.1541002e-01   9.9621754e-01  -7.6163460e-02  -3.8346860e-02  -3.1251438e-01   5.7925205e-01  -6.2195169e-01   8.7736329e-01   4.6313598e-01   5.0186008e-01  -8.7919767e-01 0  -0.0000000e+00   7.3648370e-01  -4.7117809e-01  -1.5994303e-01  -8.9454291e-01   2.5013402e-01  -7.3192133e-01  -9.9999922e-01   7.6833373e-01  -4.2679184e-01   6.4381118e-01  -6.9968571e-01  -9.2735292e-01   2.0101452e-01   7.4389858e-01  -1.6854941e-01   3.8316412e-01   1.4291280e-01  -7.4610714e-01  -5.0130672e-01  -4.1486259e-01   4.1927689e-01  -4.6369242e-01   8.4400121e-01   3.9742244e-01  -1.9628767e-01   2.0568982e-01  -8.5816073e-01   1.1648077e-01   1.0225989e-01  -6.9578104e-01  -1.0000000e+00 0

Brain mask

FDT requires a binary brain mask in the same space as the diffusion data. This has to be really binary (value 1 for in brain, value 0 for outside). There are two obvious ways of getting there. One is to run FSL BET on the 0 gradient acquisition, or the structural. You'd have to reslice the structural mask to the same space as the diffusion afterwards. I could not get BET to work well on the structural, so I did the following:

  • Trimmed the structural image with trim_img utility to remove the neck tissue.

  • Segmented using SPM segment, writing out CSF partitions as well as default gray and white matter.
  • Make binary brain mask using imcalc on gray, white, csf images, with formula (i1 + i2 + i3) > 0.5

  • Resliced binary brain mask to space of DWI data with SPM coregister reslice.
  • Made the image true binary with avwmaths++ rbrainmask -bin nodif_brain_mask

A recipe, therefore

You will need FSL version >= 3.3.11. See FslInformation for how to set this.

  1. Make diffusion analysis directory - e.g. fdt_analysis, and subdirectory spm_converted_files or similar.

  2. Use SPM5 to convert the diffusion data from dicom format, output to fdt_analysis/spm_converted_files

  3. Use (from unix shell) cd fdt_analysis; avwmerge -t data_raw spm_converted_files/f*.nii or similar to put diffusion series into 4D file in diffusion analysis directory

  4. Create diffusion direction files from matlab with cbu_write_fdt - and select DICOM diffusion files. This creates a bvecs and bvals file in the current directory

  5. Open FSL
  6. Press FDT Diffusion button and run the eddy current correction on the data_raw.nii.gz file created with the avwmerge command above, leaving the reference volume at the default (0).

  7. Create the brain mask - see above (NOTE - FSL 3.3.11 may have a problem displaying the mask, if you wish to inspect it in FSLView. FSL 3.2 doesn't have this problem, though).
  8. Run the FSL dtifit utility to get fractional anisotropy and other files
  9. Reslice the structural to FWI space, and place in the same directory as the other output files, renamed as "nodif.nii".
  10. Run FSL bedpost command (takes at least 12 hours on new linux machines for 64 directions), making sure that you have the 4D data files, the nodif.nii file, the brain mask and the bvecs and bvals files in the chosen directory. Bedpost generates an error at the end of its run: bedpost: line 293: syntax error: unexpected end of file. This is benign, and you can ignore it.

  11. Run probabilistic fiber tracking from FSL, after selecting a seed voxel
  12. Review in fslview, by opening, say FA map, and overlaying (adding) fiber track image.

Some thoughts

  • More averages less directions?
  • Cardiac gating?

Problems?

No doubt. Let MatthewBrett know.