I’ve recently completed an FDC stats analysis and I’m trying to find a way to automatically identify the significant tracts. I’m unaware of any way to do this natively in MRtrix (please correct me if there is), so I’m hoping to create a tract file of only the significant fixels from that analysis to use in DSIStudio to recognize the tracts. I’ve tried a few different things such as masking the tract file but it hasn’t worked. I just need the tracts that are specifically in the significant fixel regions. How can I accomplish this?
Hi @Ivan_Campbell I do something similar in code used for my paper (Fiber-specific structural properties relate to reading skills in children and adolescents | eLife).
You would first need to convert your .tck files to fixels with tck2fixel (tck2fixel — MRtrix3 3.0 documentation). For example, my command is below, but of course you would need to alter for your paths. Also note that my tractography was in template, not native space, based on the FOD template generated as part of the FBA.
for tck in $ts_out/TOM_trackings/*.tck # This is where my TractSeg tcks are
do tract=$(basename "$tck" .tck)
$mrtrix tck2fixel $tck $fixel_dir/template/fixel_mask $tractseg_out/tck_fixels $tract.mif
done
echo 'BINARIZING TRACT FIXEL MASKS'
for tract in $tractseg_out/tck_fixels/*.mif
do $mrtrix mrthreshold $tract ${tract//.mif}_bin.mif -abs 1 -force
done
Then it is as simple as intersecting these tract fixel masks with fixel-wise maps of your FDR p-values.
# Loop over tract masks
for track in $outdir/template/tractseg/tck_fixels/*bin*; # The binary tract fixel masks from the last step
# Calculate proportion of tract occupied by significant fixels
do proportion=$($mrtrix mrstats $outdir/template/modelarray_outputs/mifs_${metric}_${subtest}${suffix}/sig_fixels.mif -mask $track -output mean);
# Get number of significant fixels per tract
count_tract=$($mrtrix mrstats $outdir/template/modelarray_outputs/mifs_${metric}_${subtest}${suffix}/sig_fixels.mif -mask $track -output count);
# Get number of total fixels per tract
num_fixels=$(echo "$proportion * $count_tract" | bc);
# Get max effect size achieved in tract
max_eff_tract=$($mrtrix mrstats $outdir/template/modelarray_outputs/mifs_${metric}_${subtest}${suffix}/result_gam_${subtest}_DM.delta.adj.rsq.mif -mask $track -output max);
# Add information to text file
echo $(basename $track) >> $out_file;
printf "%.0f\n" $num_fixels >> $out_file;
echo $proportion >> $out_file;
echo $max_eff_tract >> $out_file;
done
Note that I used modelarray to run my FBA statistics. But you can run the mrstats on any of your fixel outputs.
Best,
Steven
Hello! thank you very much for sharing your paper, as well as the code in detail. I am trying to run a whole brain FBA for my thesis as well, and I want to extract tracts from significant fixels too. I wanted to ask, through TractSeg is there a way you may know through which I could limit the number of tracts and filter some of them out? because 72 tracts is a lot, I have been unable to find more information on how I may be able to do so.
Yes, they show an example in the TractSeg documentation:
Tracking -i peaks.nii.gz --bundles CST_right,CA,IFO_right
Thank you so much!