-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreprocessing.py
32 lines (22 loc) · 1.13 KB
/
preprocessing.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
__author__ = 'Jrudascas'
import warnings
warnings.filterwarnings("always")
import core as c
import definitions as d
def preprocessing(path_dwi_input, path_out, path_bvec, path_bval):
# bvals, bvecs = read_bvals_bvecs(bval_path, bvec_path)
# ref_bo = str(np.where(gradient_table(bvals, bvecs).b0s_mask == True)[0])
ref_bo = str(0)
process = {}
process['pathEddy'] = c.eddy_correction(path_dwi_input, path_out, ref_bo)
process['pathNonLocalMean'] = c.nonLocalMean(process['pathEddy'], path_out)
process['pathReslicing'] = c.reslicing(process['pathNonLocalMean'], path_out, d.vox_sz)
# maskedVolume, binaryMask = processData.medianOtsu(process[process.__len__() - 1], outPath)
dwi_masked, binary_mask, b0_masked = c.betDWI(process['pathReslicing'], path_out)
process['pathDWIMasked'] = dwi_masked
process['pathBinaryMask'] = binary_mask
process['pathb0Masked'] = b0_masked
path_normalized, mapping = c.to_register_dwi_to_mni(process['pathDWIMasked'], path_out, path_bvec, path_bval)
process['pathNormalized'] = path_normalized
process['mapping_b0_to_NMI'] = mapping
return process