No dwi_norm_scale_factor output for dwinormalise


I am trying to recreate a single tissue CSD analysis that included group-wise global intensity normalization. dwinormalise runs without error when using the group algorithm and the resulting fa image and corresponding mask look reasonable. However, the output mif files do not contain the dwi_norm_scale_factor. I also tried using the individual algorithm with the created fa template and got the same result.

I plan to update the analysis with mtnormalise and the dhollander SS3T strategy (our data is b=0,2000) but want to reproduce the original results first. Is there a way to store the dwi_norm_scale_factor in the mif or to export it when running dwinormalise?

Thanks for your help! Sorry if I’m missing something obvious here.



I still can’t figure out what the scale factor isn’t being written to the mif file, but I wrote a quick bash script to do this manually:


calc() { awk "BEGIN{ printf \"%.6f\n\", $* }"; }

FILES=(*)  #assuming in right directory 

mkdir tmp
for f in ${FILES[@]}
    cp $f ./tmp/dwi.mif
    dwi2mask ./tmp/dwi.mif ./tmp/dwi_mask.mif 
    dwi2tensor ./tmp/dwi.mif -mask ./tmp/dwi_mask.mif ./tmp/dwi_tensor.mif
    tensor2metric ./tmp/dwi_tensor.mif -fa ./tmp/fa.mif
    mrregister ../fa_template.mif ./tmp/fa.mif -mask2 ./tmp/dwi_mask.mif -nl_scale 0.5,0.75,1.0 -nl_niter 5,5,15 -nl_warp ./tmp/temp2sub.mif ./tmp/sub2temp.mif 
    mrtransform ../fa_template_wm_mask.mif -template ./tmp/dwi.mif -warp ./tmp/temp2sub.mif ./tmp/template_in_subject.mif
    median=$(dwiextract ./tmp/dwi.mif -bzero - | mrmath - mean - -axis 3 | mrstats - -mask ./tmp/template_in_subject.mif -output median)
    scaleFactor=$(calc $ref/$median)
    echo $scaleFactor >> scale_factors.txt
    rm ./tmp/*


I will keep this post up in case it is helpful to others but if you feel it is not needed, let me know and I can delete it.


1 Like