Created
June 2, 2017 20:50
-
-
Save ssheybani/ef61d1a2032989d0b69e720568bc94ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dipy.denoise.nlmeans import nlmeans | |
from dipy.denoise.non_local_means import non_local_means | |
from dipy.denoise.noise_estimate import estimate_sigma | |
input_dir = '/home/saber/Courses/Semester_1/Garyfallidis_Lab/Denoising/NLMeans/Wu/Wu_HYDI/Preprocessed' | |
fname = input_dir + '/DWI_d_68s_eddy_fm.nii.gz' | |
s_img = nib.load(fname) | |
s_data = s_img.get_data() | |
s_data_red = s_data[..., 1:15] | |
t = time() | |
sigma = estimate_sigma(s_data_red) | |
sigma = sigma.astype(np.float) | |
print "Sigma estimation time:", time()-t | |
sigma_arr = sigma | |
sigma = np.mean(sigma) | |
t = time() | |
s_den1 = nlmeans(s_data_red, sigma=5) | |
print "Time taken for nlmeans", time() - t | |
t = time() | |
s_den2 = non_local_means(s_data_red, sigma=5) | |
print "Time taken for non_local_means", time() - t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment