def reg_dti_pngs(dti, loc, atlas, outdir):
"""
outdir: directory where output png file is saved
fname: name of output file WITHOUT FULL PATH. Path provided in outdir.
"""
atlas_data = nb.load(atlas).get_data()
dti_data = nb.load(dti).get_data()
b0_data = dti_data[:,:,:,loc]
cmap1 = LinearSegmentedColormap.from_list('mycmap1', ['black', 'magenta'])
cmap2 = LinearSegmentedColormap.from_list('mycmap2', ['black', 'green'])
fig = plot_overlays(atlas_data, b0_data, (cmap1, cmap2))
# name and save the file
fname = os.path.split(dti)[1].split(".")[0] + '.png'
plt.savefig(outdir + '/' + fname, format='png')
评论列表
文章目录