|
20 | 20 | from designer.plotting import snrplot, outlierplot, motionplot |
21 | 21 | from designer.fitting import dwipy as dp |
22 | 22 | from designer.postprocessing import filters |
| 23 | +from designer.tractography import dsistudio as ds |
23 | 24 | DWIFile = util.DWIFile |
24 | 25 | DWIParser = util.DWIParser |
25 | 26 |
|
@@ -591,6 +592,8 @@ def main(): |
591 | 592 | undistorted_name_full = str(step_count)+ '_' + undistorted_name |
592 | 593 | nii_undistorted = op.join(intermediatepath, undistorted_name_full + '.nii') |
593 | 594 | mif_undistorted = op.join(outpath, undistorted_name_full + '.mif') |
| 595 | + if args.noqc: |
| 596 | + eddyqcpath = None |
594 | 597 | # check to see if this already exists |
595 | 598 | if not (args.resume and op.exists(nii_undistorted)): |
596 | 599 | # run undistort function |
@@ -764,15 +767,19 @@ def main(): |
764 | 767 | files = [] |
765 | 768 | files.append(init_nii) |
766 | 769 | files.append(filetable['HEAD'].getFull()) |
767 | | - if 'mask' in filetable: |
768 | | - snr = snrplot.makesnr(dwilist=files, |
769 | | - noisepath=nii_noisemap, |
770 | | - maskpath=filetable['mask'].getFull()) |
771 | | - else: |
772 | | - snr = snrplot.makesnr(dwilist=files, |
773 | | - noisepath=filetable['noisemap'].getFull(), |
774 | | - maskpath=None) |
775 | | - snr.makeplot(path=qcpath, smooth=True, smoothfactor=3) |
| 770 | + try: |
| 771 | + if 'mask' in filetable: |
| 772 | + snr = snrplot.makesnr(dwilist=files, |
| 773 | + noisepath=nii_noisemap, |
| 774 | + maskpath=filetable['mask'].getFull()) |
| 775 | + else: |
| 776 | + snr = snrplot.makesnr(dwilist=files, |
| 777 | + noisepath=filetable['noisemap'].getFull(), |
| 778 | + maskpath=None) |
| 779 | + snr.makeplot(path=qcpath, smooth=True, smoothfactor=3) |
| 780 | + except: |
| 781 | + print('[WARNING] SNR plotting failed, see above. ' |
| 782 | + 'Proceeding with processing.') |
776 | 783 |
|
777 | 784 | #----------------------------------------------------------------- |
778 | 785 | # Write logs |
@@ -823,6 +830,7 @@ def main(): |
823 | 830 | fn_fbi_zeta = 'fbi_zeta' |
824 | 831 | fn_fbi_faa = 'fbi_faa' |
825 | 832 | fn_fbi_sph = 'fbi_fodf' |
| 833 | + fn_fbi_tract = 'fbi_tractography_dsi' |
826 | 834 | fn_fbi_awf = 'fbwm_awf' |
827 | 835 | fn_fbi_Da = 'fbwm_da' |
828 | 836 | fn_fbi_De_mean = 'fbwm_de_mean' |
@@ -875,9 +883,10 @@ def main(): |
875 | 883 | if (img.isdti() or img.isdki()) and not args.noakc: |
876 | 884 | akc_out = img.akcoutliers() |
877 | 885 | img.akccorrect(akc_out) |
878 | | - dp.writeNii(akc_out, |
879 | | - img.hdr, |
880 | | - op.join(fitqcpath, 'outliers_akc')) |
| 886 | + if not args.noqc: |
| 887 | + dp.writeNii(akc_out, |
| 888 | + img.hdr, |
| 889 | + op.join(fitqcpath, 'outliers_akc')) |
881 | 890 |
|
882 | 891 | # reorder tensor for mrtrix3 |
883 | 892 | if 'dki' in img.tensorType(): |
@@ -1015,6 +1024,17 @@ def main(): |
1015 | 1024 | input=op.join(metricpath, x + fn_ext), |
1016 | 1025 | output=op.join(metricpath, x + fn_ext), |
1017 | 1026 | mask=filetable['mask'].getFull()) |
1018 | | - |
| 1027 | + if 'mask' in filetable: |
| 1028 | + ds.makefib( |
| 1029 | + input=op.join(metricpath, fn_fbi_sph + fn_ext), |
| 1030 | + output=op.join(metricpath, fn_fbi_tract + '.fib'), |
| 1031 | + mask=filetable['mask'].getFull() |
| 1032 | + ) |
| 1033 | + else: |
| 1034 | + ds.makefib( |
| 1035 | + input=op.join(metricpath, fn_fbi_sph + fn_ext), |
| 1036 | + output=op.join(metricpath, fn_fbi_tract + '.fib'), |
| 1037 | + mask=None |
| 1038 | + ) |
1019 | 1039 | if __name__ == '__main__': |
1020 | 1040 | main() |
0 commit comments