Unsual FD value

Hi Rob,

I have followed steps of FBA analysis. When I try to extract FD value in ROI for each subject, I found the value was very strange.

mrstats -mask ctl-all_fd_cov_fwe_pvalue_thr095.msf -output mean ../upsampled_FOD/L_ALL_026-2014.07.18_fd_reoriented.msf
4.79847e+06

What have I done wrong? I pasted my script below and basically I have just followed the mrtrix3 online document.

Thanks for your help.

Jian

+++++++++++
##############
#step 0: 
#intensitynorm
##############
dwiintensitynorm -force input_dwi input_dwi_mask intensitynorm_dwi fa_template.mif wm_mask.mif

#####################
#step 1: 
#Upsampling DW images
#####################
mkdir upsampled_dwi
for i in `cat ID_time1.txt`; do mrresize intensitynorm_dwi/${i}.mif -scale 2.0 upsampled_dwi/${i}.mif; done

############################################
#step 2: Compute upsampled brain mask images
############################################
mkdir upsampled_dwi_mask
for i in `cat ID_time1.txt`; do mrresize -interp nearest input_dwi_mask/${i}_mask.mif -scale 2.0 upsampled_dwi_mask/${i}.mif; done


##########################################
#step 3 
#Fibre Orientation Distribution estimation
##########################################

#=========================== 
#Calculate response function
#===========================
for i in `cat ID_time1.txt`; do dwi2response tournier upsampled_dwi/${i}.mif upsampled_dwi/${i}response.txt; done
average_response upsampled_dwi/*response.txt average_response.txt

mkdir upsampled_FOD

for i in `cat ID_time1.txt`; do dwiextract upsampled_dwi/${i}.mif - | dwi2fod msmt_csd - average_response.txt upsampled_FOD/${i}.mif -mask upsampled_dwi_mask/${i}.mif;done

################################################
#Step 4:
#Generate a study-specific unbiased FOD template
################################################
mkdir transformed_dir
mkdir upsampled_template_FOD
mkdir upsampled_dwi_tempalte_mask

for i in `cat ID_template.txt`; do cp upsampled_dwi_mask/${i}* upsampled_dwi_template_mask; done
for i in `cat ID_template.txt`; do cp upsampled_FOD/${i}* upsampled_template_FOD; done

population_template -transformed_dir transformed_dir -mask_dir upsampled_dwi_template_mask -tempdir /data/jianc/mrtrixtmp/ upsampled_template_FOD  fod_template.mif -force


####################################################
#Step 5
#Register all subject FOD images to the FOD template
####################################################
for i in `cat ID_time1.txt`; do mrregister upsampled_FOD/${i}.mif -mask1 upsampled_dwi_mask/${i}.mif fod_template.mif -nl_warp upsampled_FOD/${i}_2template_warp.mif upsampled_FOD/template2_${i}_warp.mif;done


################################################################
#Step 6 
#Compute the intersection of all subject masks in template space
################################################################
for i in `cat ID_time1.txt`; do mrtransform upsampled_dwi_mask/${i}.mif -warp upsampled_FOD/${i}_2template_warp.mif -interp nearest upsampled_dwi_mask/${i}_2template_warp.mif; done

mrmath upsampled_dwi_mask/*_2template_warp.mif min template_mask.mif

####################################################
#Step 7 
#Compute a white matter template analysis fixel mask
####################################################
fod2fixel fod_template.mif -mask template_mask.mif -peak template_peaks_image.msf

fixelthreshold -crop template_peaks_image.msf 0.33 analysis_fixel_mask.msf

fixel2voxel analysis_fixel_mask.msf count - | mrthreshold - - -abs 0.5 | mrfilter - median analysis_voxel_mask.mif

fod2fixel -mask analysis_voxel_mask.mif fod_template.mif -peak temp.msf

fixelthreshold temp.msf -crop 0.2 analysis_fixel_mask2.msf -force
rm <temp.msf>


#######################################
#Step 8 
#Transform FOD images to template space
#######################################
for i in `cat ID_time1.txt`; do mrtransform upsampled_FOD/${i}.mif -warp upsampled_FOD/${i}_2template_warp.mif  -noreorientation upsampled_FOD/${i}_warped_fod.mif; done


#################################################################
#Step 9 
#Segment FOD images to estimate fixels and their fibre density (FD)
#################################################################
for i in `cat ID_time1.txt`; do fod2fixel upsampled_FOD/${i}_warped_fod.mif -mask analysis_voxel_mask.mif -afd upsampled_FOD/${i}_fd_not_reoriented.msf;done


############################
#Step 10
#Reorient fixel orientations
############################
for i in `cat ID_time1.txt`; do fixelreorient upsampled_FOD/${i}_fd_not_reoriented.msf   upsampled_FOD/${i}_2template_warp.mif upsampled_FOD/${i}_fd_reoriented.msf;done


#########################################
#Step 11
#Assign subject fixels to template fixels
#########################################
for i in `cat ID_time1.txt`; do fixelcorrespondence upsampled_FOD/${i}_fd_reoriented.msf analysis_fixel_mask.msf upsampled_FOD/${i}_fd.msf;done


########################################
#Step 12 
#Compute fibre cross-section (FC) metric
########################################
#The FC files will be used in the next step. However, for group
#statistical analysis of FC we recommend taking the log (FC) to
#ensure data are centred about zero and normally distributed:

for i in `cat ID_time1.txt`; do warp2metric  upsampled_FOD/${i}_2template_warp.mif -fc analysis_fixel_mask.msf upsampled_FOD/${i}_fc.msf;
fixellog  upsampled_FOD/${i}_fc.msf upsampled_FOD/${i}_log_fc.msf;
done


##################################################################
#Step 13
#Compute a combined measure of fibre density and cross-section (FDC)
##################################################################
for i in `cat ID_time1.txt`; do fixelcalc upsampled_FOD/${i}_fd.msf mult upsampled_FOD/${i}_fc.msf upsampled_FOD/${i}_fdc.msf;done



############################################################
#Step 14
#Perform whole-brain fibre tractography on the FOD template
############################################################
tckgen -angle 22.5 -maxlen 250 -minlen 10 -power 1.0 fod_template.mif -seed_image analysis_voxel_mask.mif -mask analysis_voxel_mask.mif -number 20000000 tracks_20_million.tck


##########################################
#Step 15
#Reduce biases in tractogram densities
######################################
#tcksift2 tracks_20_million.tck fod_template.mif tracks_2_million_sift.txt

tcksift tracks_20_million.tck fod_template.mif tracks_2_million_sift.tck -term_number 2000000

################################################
#Step 16
#Perform statistical analysis of FD, FC, and FDC
################################################
#fixelcfestats -negative list_fd_reoriented.txt analysis_fixel_mask.msf design_matrix.txt design_contrast.txt tracks_2_million_sift.tck ctl-all_fd_reoriented
fixelcfestats -negative list_fd.txt analysis_fixel_mask.msf design_matrix.txt design_contrast.txt tracks_2_million_sift.tck ctl-all_fd
fixelcfestats -negative list_fc.txt analysis_fixel_mask.msf design_matrix.txt design_contrast.txt tracks_2_million_sift.tck ctl-all_fc
fixelcfestats -negative list_fdc.txt analysis_fixel_mask.msf design_matrix.txt design_contrast.txt tracks_2_million_sift.tck ctl-all_fdc

##############################################################
#Step 17
#Visualise the results
#To view the results load the population FOD template image in
#mrview, and overlay the fixel images using the vector plot tool. Note that p-value images are saved as 1-p-value. Therefore to visualise all p-values < 0.05, threshold the fixels using the vector plot tool at 0.95.
################################################################

fixelthreshold -crop ctl-all_fdfwe_pvalue.msf 0.95 ctl-all_fdfwe_pvalue_thr095.msf

Hi Jian,
You will need to use the fixelstats command instead of mrstats.

However, note that in the coming weeks we will be changing to a new fixel image format. When this happens we will no longer be using *.msf files, and the mechanism for extracting values from ROIs (such as significance masks) will require mrstats.

Cheers,
Dave

For the sake of understanding:

The reason you get 4.79847e+06 as your mean value is that when you look at the image L_ALL_026-2014.07.18_fd_reoriented.msf, it actually contains large integer values; these are memory offsets, pointing to an area beyond the image data that contains the fixel information. So taking a mean of these memory offsets is a relatively meaningless thing to do; you need a command that’s aware of the fixel information present in the image that will fetch that information as it performs the statistics, which is fixelstats.

But as Dave said, this is all about to change…

Hi Dave,
Thanks.

Jian