def nlmeans_denoise(in_file, mask_file, out_file='', N=12): """ Filepath interface to the nlmeans_denoise_img in pypes.preproc.""" import os.path as op import nibabel as nib from pypes.preproc import nlmeans_denoise_img from pypes.utils import rename den = nlmeans_denoise_img(nib.load(in_file), mask=nib.load(mask_file), N=N) if not out_file: out_file = rename(in_file, '_denoised') den.to_filename(out_file) return op.abspath(out_file)
def reslice(in_file, new_zooms=None, order=3, out_file=''): """ Performs regridding of an image to set isotropic voxel sizes using dipy. """ import os.path as op import nibabel as nib from pypes.preproc import reslice_img from pypes.utils import rename img = reslice_img(nib.load(in_file), new_zooms=new_zooms, order=order) if not out_file: out_file = rename(in_file, '_resliced') img.to_filename(out_file) return op.abspath(out_file)