Dear Afni forum,
I have generated a script to run fatcat (steps as described on 7. FATCAT — AFNI, SUMA and FATCAT: v23.1.06). I have run the scripts on about 13 subjects, with only one set of “good” results.
This is my processing pipeline (i apologize for the amount of txt, in this script “i” refers to the subject ID, and this is all in for loops. I have 3 different scripts doing this):
#----- Converting DWIs to nii files -------------------------------------
fat_proc_convert_dcm_dwis
-indir “$path_Base_ss/$dti_folder”
-prefix “path_Base_ss/dti_raw/{i}_dti”
#read -n 1 -p “hit enter to continue…”
echo “-------------------------------STEP ONE COMPLETE-----------------------------------”
#----- Convert anatomy to nii
fat_proc_convert_dcm_anat
-indir $t1_path
-prefix $path_Base_ss/t1w/{$i}t1
echo “-------------------------------STEP TWO COMPLETE-----------------------------------”
#------- axialization with reference to icbm152 t1w image ----------------------
ref_t1w="$home_dir/mni_icbm152_nlin_sym_09c/mni_icbm152_t1_tal_nlin_sym_09c.nii"
ref_t1w_wt="$home_dir/mni_icbm152_nlin_sym_09c/mni_icbm152_wm_tal_nlin_sym_09c.nii"
fat_proc_axialize_anat \
-inset "$path_Base_ss/t1w/${i}_t1_.nii.gz" \
-prefix "$path_Base_ss/t1w/${i}_t1_axial" \
-mode_t1w \
-refset $ref_t1w \
-extra_al_wtmask $ref_t1w_wt \
-out_match_ref \
-extra_al_opts "-newgrid 1.0" \
-pre_center_mass \
-remove_inf_sli 20
echo "Current Subject is :$i"
# or do whatever with individual element of the array
# for I/O, "basic" (= DICOM) and "proc" (= NIFTI) directories
path_Base_ss="$home_dir/$i"
echo "Subject path is : $path_Base_ss"
t1_axial_loc="$path_Base_ss/t1w/${i}_t1_axial.nii.gz"
# ID of individual subj from "tail" of path, above
ss_id="fs"
# FS function
recon-all \
-all \
-sd $path_Base_ss \
-subjid fs \
-i $t1_axial_loc
# AFNI-SUMA function: convert FS output
@SUMA_Make_Spec_FS \
-NIFTI \
-fspath $path_Base_ss/fs \
-sid $ss_id
echo "--------------FILTER DTI IMAGES--------------------------"
# filter from both AP and PA dwi sets, both vols and b-matrices
fat_proc_filter_dwis \
-in_dwi $path_P_ss/${i}_dti.nii.gz \
-in_col_matT $path_P_ss/${i}_dti_matT.dat \
-select `cat $path_P_ss/${i}_dti_sel_ap_goods.txt` \
-prefix $path_P_ss/${i}_dti_filt
read -n 1 -p “hit enter to continue…”
echo "---------------- DIFFPREP STARTED ---------------------"
# make a directory to hold 'starter' data for DIFFPREP, as well
# as all the files it creates
odir=$path_P_ss/diffprep_starter
if test ! -d $odir; then
mkdir $odir
fi
# uncompress the anatomical
gunzip $path_P_ss/${i}_dti_filt.nii.gz
# for DIFFPREP command line, need row-vec and row-bval format
1dDW_Grad_o_Mat++ \
-in_col_matT $path_P_ss/${i}_dti_matT.dat \
-unit_mag_out \
-out_row_vec $odir/${i}_dti_rvec.dat \
-out_row_bval_sep $odir/${i}_dti_bval.dat
read -n 1 -p “hit enter to continue…”
# the NIFTI file must be unzipped
3dcopy \
$path_P_ss/${i}_dti_filt.nii \
$odir/${i}_dti_filt.nii
# finally, the main command itself
DIFFPREP \
--dwi $odir/${i}_dti_filt.nii \
--bvecs $odir/${i}_dti_rvec.dat \
--bvals $odir/${i}_dti_bval.dat \
--structural $home_dir/$i/t1w/${i}_t1_axial.nii.gz \
--phase vertical \
--will_be_drbuddied 0 \
--reg_settings example_registration_settings.dmc
read -n 1 -p “hit enter to continue…”
# shortcut names for what will be our input (-> from TORT proc)
# and output (-> another dwi_* directory)
itort=$path_P_ss/diffprep_starter
# A) do autoflip check: not ideal to need this, but such is life
@GradFlipTest \
-in_dwi $itort/${i}_dti_filt_DMC.nii \
-in_col_matT $itort/${i}_dti_filt_DMC.bmtxt \
-prefix $itort/GradFlipTest_rec.txt
# get the 'recommended' flip; still should verify visually!!
my_flip=`cat $itort/GradFlipTest_rec.txt`
# B) DT+parameter estimates, with flip chosen from @GradFlipTest
fat_proc_dwi_to_dt \
-in_dwi $itort/${i}_dti_filt_DMC.nii \
-in_col_matT $itort/${i}_dti_filt_DMC.bmtxt \
-in_struc_res $itort/${i}_dti_filt_DMC_structural.nii \
-in_ref_orig $home_dir/$i//t1w/${i}_t1_axial.nii \
-prefix $itort/${i} \
-mask_from_struc \
$my_flip
read -n 1 -p “hit enter to continue…”
fat_proc_decmap \
-in_fa $itort/dt_FA.nii.gz \
-in_v1 $itort/dt_V1.nii.gz \
-mask $itort/${i}_mask.nii.gz \
-prefix $itort/${i}_decmap
read -n 1 -p “hit enter to continue…”
fat_proc_map_to_dti \
-source $home_dir/$i/fs/SUMA/brain.nii \
-base $itort/${i}_dwi.nii.gz'[0]' \
-prefix $itort/indt \
-followers_NN $home_dir/$i/fs/SUMA/aparc*_REN_*.nii.gz \
-followers_surf $home_dir/$i/fs/SUMA/std.141.*.gii \
-followers_ndset $home_dir/$i/fs/SUMA/std.141.*.niml.dset \
-followers_spec $home_dir/$i/fs/SUMA/std.141.*.spec
read -n 1 -p “hit enter to continue…”
3dmask_tool \
-dilate_inputs -2 \
-inputs $itort/${i}_mask.nii.gz \
-prefix $itort/${i}_mask_ERODE.nii.gz
# basic whole-brain, mini-prob tracking in it.
3dTrackID \
-mode MINIP \
-mini_num 10 \
-mask $itort/${i}_mask_ERODE.nii.gz \
-netrois $itort/${i}_mask_ERODE.nii.gz \
-dti_in $itort/dt \
-prefix $itort/TTT \
-uncert $itort/dt_UNC.nii.gz \
-logic AND \
-alg_Nseed_X 1 \
-alg_Nseed_Y 1 \
-alg_Nseed_Z 1
read -n 1 -p “hit enter to continue…”
I have messed around with some of the varaibles, however I do not seem to get a good results (the mini_num number of sli to remove before axialization). the same script has run on all subjects, it has run very well on only one subject ( i have attached png images from the good run and one of the bad runs). Any help is appreciated, thank you!