Hi -
I’ve been having an issue with corrupted or missing data when I do image processing. I have put together an automated script for processing multi-shell diffusion MRI data for shells b=0, 1000, 2200 which has worked completely fine for numerous datasets and I’ve never had a problem with it. However, I have been attempting to rerun some processing only on shells b=0, 1000 from this data set and this is when the issues started.
For reference, my script does:
mrconvert input.nii.gz -fslgrad input_bvecs.txt input_bvals.txt data.mif
dwi2mask data.mif - | maskfilter - dilate preproc_mask.mif -npass 5 -force
mrview data.mif -roi.load preproc_mask.mif -roi.opacity 0.4
dwidenoise data.mif denoise.mif -noise noiselevel.mif -mask preproc_mask.mif -force
mrdegibbs denoise.mif degibbs.mif -force
fslroi input.nii.gz b0.nii.gz 0 1
fslmerge -t b0pair.nii.gz b0.nii.gz input_negPE.nii.gz
dwifslpreproc -rpe_pair -se_epi b0pair.nii.gz -pe_dir AP -eddy_options "–repol " degibbs.mif dwi.mif
This process normally works quite well. However, the problems started when I began extracting shells b=0 and 1000 out of the original data. I tested two methods:
(1) dwiextract input.nii.gz -fslgrad input_bvecs.txt input_bvals.txt -shells 0,1000 data.mif
and
(2) mrconvert input.nii.gz -fslgrad input_bvecs.txt input_bvals.txt -coord 3 0:67 data.mif
Both of these methods extracts b=0,1000 and the files look fine in mrview. However, in the first method, I started noticing that dwifslpreproc just wouldn’t finish running. When I took a look at the degibbs.mif file, I noticed that a lot of the volumes had the correct number of voxels but had 0 value.
In the second method, degibbs.mif looked fine, so I thought this had rectified the problem and that dwiextract had simply corrupted some of the data in the first method. dwifslpreproc managed to run, but when I took a look at the dwi.mif output, I realised that there were multiple volumes with 0 value again.
To give you an example using the second method: mrstats output for the degibbs.mif file is:
volume mean median std min max count
[ 0 ] 1028.48 0.0761709 2116.18 -506.125 16994 798600
[ 1 ] 1028.6 0.0762776 2115.07 -485.798 17368.9 798600
[ 2 ] 381.953 0.0385988 822.829 -91.1275 7741.76 798600
[ 3 ] 370.787 0.0389791 797.417 -68.2304 7537.9 798600
[ 4 ] 378.247 0.0383717 812.865 -89.9921 8549.25 798600
[ 5 ] 382.439 0.038663 821.987 -82.8401 8181.37 798600
[ 6 ] 367.223 0.0392471 789.457 -78.6496 7644.03 798600
[ 7 ] 377.25 0.0368577 808.509 -72.1566 7715.76 798600
[ 8 ] 382.511 0.0388334 823.681 -61.602 8389.03 798600
[ 9 ] 375.622 0.0385257 807.511 -87.0571 7705.26 798600
[ 10 ] 373.453 0.0384367 802.154 -60.9324 7514.77 798600
[ 11 ] 382.483 0.0387772 824.391 -75.3824 7440.82 798600
[ 12 ] 1029.41 0.0782203 2117.63 -498.636 17256.2 798600
[ 13 ] 383.533 0.0392468 822.351 -68.1592 7546.43 798600
[ 14 ] 375.384 0.037986 808.045 -110.295 8101.96 798600
[ 15 ] 368.978 0.0389684 796.2 -88.0598 7660 798600
[ 16 ] 374.749 0.0399694 806.23 -68.3451 8036.32 798600
[ 17 ] 371.481 0.0406786 797.495 -86.9211 7217.57 798600
[ 18 ] 365.081 0.0397597 787.301 -62.9788 7527.6 798600
[ 19 ] 353.297 0.0382874 769.697 -81.3567 6954.38 798600
[ 20 ] 375.266 0.0385869 809.124 -92.1132 8015 798600
[ 21 ] 361.002 0.0396556 775.402 -77.8972 7528.77 798600
[ 22 ] 379.933 0.0400379 819.096 -66.0535 8181.23 798600
[ 23 ] 1026.34 0.0805953 2108.13 -447.597 17609.1 798600
[ 24 ] 381.566 0.0408174 819.055 -59.8296 8302.08 798600
[ 25 ] 377.26 0.039632 807.593 -97.3235 7885.15 798600
[ 26 ] 382.602 0.0391143 819.567 -77.009 7936.07 798600
[ 27 ] 371.113 0.0409547 796.134 -70.4814 7355.4 798600
[ 28 ] 382.998 0.0420775 819.8 -91.0985 7647.92 798600
[ 29 ] 384.252 0.0402247 823.239 -95.1693 7851.96 798600
[ 30 ] 384.325 0.0390861 823.245 -59.2584 7601.9 798600
[ 31 ] 370.947 0.038472 796.144 -93.3001 7733.59 798600
[ 32 ] 379.126 0.0396561 815.123 -72.5338 8082.69 798600
[ 33 ] 375.572 0.0379457 809.689 -148.108 7775.14 798600
[ 34 ] 1020.35 0.0768617 2104.73 -392.213 18085.5 798600
[ 35 ] 381.839 0.0391412 820.372 -81.1561 7930.92 798600
[ 36 ] 381.901 0.0401659 818.698 -82.3314 7476.25 798600
[ 37 ] 382.585 0.0387524 823.599 -73.118 7821.06 798600
[ 38 ] 372.278 0.0396694 799.508 -68.4374 7845.83 798600
[ 39 ] 386.846 0.0396756 830.507 -75.3975 8408.71 798600
[ 40 ] 380.926 0.0389068 816.253 -106.231 7479.26 798600
[ 41 ] 380.089 0.0397559 818.278 -111.178 8316.64 798600
[ 42 ] 378.988 0.0376264 816.217 -77.6012 8175.61 798600
[ 43 ] 384.635 0.0384802 829.904 -126.896 7776 798600
[ 44 ] 374.177 0.0397852 804.508 -65.5267 8145.87 798600
[ 45 ] 1032.84 0.0785424 2127.72 -513.125 17084.8 798600
[ 46 ] 380.855 0.0393857 821.787 -77.8292 7956.63 798600
[ 47 ] 374.746 0.0397121 808.023 -82.2328 7736.78 798600
[ 48 ] 370.297 0.0355648 800.792 -93.0965 6553.58 798600
[ 49 ] 370.272 0.039406 796.16 -80.2741 7536.98 798600
[ 50 ] 381.1 0.0376397 817.993 -114.383 7969.07 798600
[ 51 ] 376.33 0.0381881 811.477 -58.725 7462.29 798600
[ 52 ] 382.748 0.0393228 821.479 -80.1691 7939.32 798600
[ 53 ] 381.237 0.036993 821.958 -84.5733 7861.06 798600
[ 54 ] 374.884 0.0383478 804.779 -149.023 7513.71 798600
[ 55 ] 374.648 0.039105 805.498 -75.9159 7532.35 798600
[ 56 ] 1029.02 0.0716483 2124.13 -397.294 17556.2 798600
[ 57 ] 383.008 0.0389625 825.853 -72.659 7563.85 798600
[ 58 ] 383.91 0.0390766 825.076 -111.37 7902.87 798600
[ 59 ] 376.128 0.0377505 811.324 -82.9359 7613.07 798600
[ 60 ] 375.004 0.0395775 803.932 -104.794 7127.61 798600
[ 61 ] 374.331 0.0388976 804.409 -98.044 7750.16 798600
[ 62 ] 385.088 0.0379255 826.887 -72.4372 8092.81 798600
[ 63 ] 374.157 0.0390976 804.809 -81.831 7970.98 798600
[ 64 ] 384.962 0.0404262 825.714 -147.717 7449.95 798600
[ 65 ] 376.663 0.0371148 809.522 -87.3545 7082.71 798600
[ 66 ] 373.877 0.0395336 807.653 -105.54 7103.87 798600
[ 67 ] 1021.13 0.0705839 2111.58 -383.996 17712 798600
And for the dwi.mif file after running dwifslpreproc the mrstats output is this:
[ 0 ] 1027.69 0.0718035 2115.83 -506.125 16994 798600
[ 1 ] 1027.83 0.0718082 2114.74 -485.798 17368.9 798600
[ 2 ] 381.818 0.036165 822.813 -78.9924 7723.37 798600
[ 3 ] 370.637 0.036228 797.383 -77.7432 7542.51 798600
[ 4 ] 378.127 0.0358158 812.861 -113.083 8521.04 798600
[ 5 ] 382.327 0.036383 821.983 -78.6645 8168.29 798600
[ 6 ] 367.077 0.0367666 789.432 -88.8371 7609.68 798600
[ 7 ] 377.126 0.0343139 808.508 -89.337 7714.04 798600
[ 8 ] 382.389 0.0361904 823.671 -68.1341 8359.88 798600
[ 9 ] 375.458 0.0359702 807.467 -86.8996 7690.64 798600
[ 10 ] 373.316 0.0358502 802.142 -66.2282 7499.68 798600
[ 11 ] 382.357 0.0364646 824.388 -79.8978 7418.54 798600
[ 12 ] 1028.64 0.073511 2117.28 -498.636 17256.2 798600
[ 13 ] 383.4 0.0364904 822.337 -68.3494 7527.1 798600
[ 14 ] 375.24 0.0356197 808.015 -138.741 8055.21 798600
[ 15 ] 368.823 0.0363485 796.163 -88.1229 7632.4 798600
[ 16 ] 374.636 0.0375119 806.225 -87.8092 8019.47 798600
[ 17 ] 371.361 0.0379921 797.498 -112.402 7144.86 798600
[ 18 ] 364.945 0.0372456 787.267 -72.2086 7522.97 798600
[ 19 ] 353.222 0.0361257 769.653 -91.8469 6891.27 798600
[ 20 ] 375.127 0.0358289 809.099 -118.08 8055.67 798600
[ 21 ] 360.898 0.0370067 775.393 -95.7351 7503.42 798600
[ 22 ] 379.841 0.0374772 819.097 -74.4587 8180.48 798600
[ 23 ] 1025.56 0.0759199 2107.76 -447.597 17609.1 798600
[ 24 ] 380.413 0.0345064 819.181 -81.794 8244.63 798600
[ 25 ] 0 0 0 0 0 798600
[ 26 ] 0 0 0 0 0 798600
[ 27 ] 0 0 0 0 0 798600
[ 28 ] 0 0 0 0 0 798600
[ 29 ] 0 0 0 0 0 798600
[ 30 ] 0 0 0 0 0 798600
[ 31 ] 0 0 0 0 0 798600
[ 32 ] 0 0 0 0 0 798600
[ 33 ] 0 0 0 0 0 798600
[ 34 ] 0 0 0 0 0 798600
[ 35 ] 0 0 0 0 0 798600
[ 36 ] 0 0 0 0 0 798600
[ 37 ] 0 0 0 0 0 798600
[ 38 ] 0 0 0 0 0 798600
[ 39 ] 0 0 0 0 0 798600
[ 40 ] 0 0 0 0 0 798600
[ 41 ] 0 0 0 0 0 798600
[ 42 ] 0 0 0 0 0 798600
[ 43 ] 0 0 0 0 0 798600
[ 44 ] 0 0 0 0 0 798600
[ 45 ] 0 0 0 0 0 798600
[ 46 ] 0 0 0 0 0 798600
[ 47 ] 0 0 0 0 0 798600
[ 48 ] 0 0 0 0 0 798600
[ 49 ] 0 0 0 0 0 798600
[ 50 ] 0 0 0 0 0 798600
[ 51 ] 0 0 0 0 0 798600
[ 52 ] 0 0 0 0 0 798600
[ 53 ] 0 0 0 0 0 798600
[ 54 ] 0 0 0 0 0 798600
[ 55 ] 0 0 0 0 0 798600
[ 56 ] 0 0 0 0 0 798600
[ 57 ] 0 0 0 0 0 798600
[ 58 ] 0 0 0 0 0 798600
[ 59 ] 0 0 0 0 0 798600
[ 60 ] 0 0 0 0 0 798600
[ 61 ] 0 0 0 0 0 798600
[ 62 ] 0 0 0 0 0 798600
[ 63 ] 0 0 0 0 0 798600
[ 64 ] 0 0 0 0 0 798600
[ 65 ] 0 0 0 0 0 798600
[ 66 ] 0 0 0 0 0 798600
[ 67 ] 0 0 0 0 0 798600
This is not a problem when the full dataset with all volumes b=0,1000,2200 is processed.
Is there something I am missing?
Best wishes,
Emily