Do_PostTORTOISE_2014.tcsh 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #!/bin/tcsh -xef
  2. # Here, we'll go from the DWI + (TORTOISE-style) B-matrix information
  3. # to do tensor reconstruction and tracking.
  4. # For the Sept, 2014 NIH Bootcamp:
  5. # these commands can be run in the TORTOISE-processed demo data set
  6. # (AFNI_bootcamp_TORTOISE_tutorial_data.tar.gz) in the following
  7. # directory--
  8. # TORTOISE_tutorial_2014/DR-BUDDI_example/final/dti_35vol_AP_scan1_up_bupdown_DMC_L0_SAVE_AFNI/
  9. # *******************************************************************
  10. # slightly more svelte brain mask
  11. 3dAutomask \
  12. -prefix mask2.nii.gz \
  13. INPREF_MD.nii \
  14. -overwrite
  15. # We could convert the TORTOISE-style B-matrix to either AFNI-style
  16. # one or to grads (see "1dDW_Grad_o_Mat" help for more about style
  17. # differences); here, I'll opt for 3 columns of gradient components,
  18. # and we won't need to keep the single row of zeros at the top (i.e.,
  19. # don't need to turn on a switch to keep it-- 3dDWItoDT expects b=0
  20. # data in the first DWI brick, and no row of zeros in the grad file
  21. # for it).
  22. #
  23. # We will also need to check if one of the grads needs to be flipped
  24. # at all-- only way for sure I know to check this is to process
  25. # through to whole brain tracking and see that it looks ok (checking
  26. # through corpus callosum and cingulate bundles seems good procedure).
  27. # -> after first attempt with no flip, I saw that the CC was pretty
  28. # empty in the middle, probably falsely so, so I invoked a -flip_z...
  29. 1dDW_Grad_o_Mat \
  30. -in_bmatT_cols BMTXT.txt \
  31. -out_grad_cols GRADS.txt \
  32. -flip_z
  33. # tensor reconstruction-- sep_dsets is useful here; nonlinear is
  34. # default anyways.
  35. 3dDWItoDT -nonlinear -eigs -sep_dsets \
  36. -mask mask2.nii.gz \
  37. -prefix DT \
  38. GRADS.txt \
  39. DWI.nii \
  40. -overwrite
  41. # simple deterministic, WB tracking; just use 1 seed per vox for speed
  42. 3dTrackID -mode DET \
  43. -mask mask2.nii.gz \
  44. -netrois mask2.nii.gz \
  45. -logic OR \
  46. -prefix o.WB \
  47. -dti_in DT \
  48. -alg_Nseed_X 1 \
  49. -alg_Nseed_Y 1 \
  50. -alg_Nseed_Z 1 \
  51. -overwrite
  52. # view it-- looks lovely!
  53. suma -tract o.WB_000.niml.tract
  54. # *******************************************************************
  55. # and now a probabilistic example:
  56. # First, we need to estimate uncertainty of a few key DT parameters
  57. # that are used in tracking. Below a *very* small number of
  58. # iterations is used, just for the sake of brevity.
  59. 3dDWUncert \
  60. -grads GRADS.txt \
  61. -inset DWI.nii \
  62. -input DT \
  63. -mask mask2.nii.gz \
  64. -prefix o.UNC \
  65. -iters 10 \
  66. -overwrite
  67. # a really simple mini-probabilistic procedure.
  68. 3dTrackID -mode MINIP \
  69. -mask mask2.nii.gz \
  70. -netrois mask2.nii.gz \
  71. -logic OR \
  72. -prefix o.WB_MP \
  73. -dti_in DT \
  74. -uncert o.UNC_UNC+orig \
  75. -mini_num 5 \
  76. -alg_Nseed_X 1 \
  77. -alg_Nseed_Y 1 \
  78. -alg_Nseed_Z 1 \
  79. -overwrite
  80. # View it!
  81. suma -tract o.WB_000.niml.tract