# Work in progress
import k3d
import math
import numpy as np
import nibabel as nib
from k3d.helpers import download
filename = download('https://github.com/FNNDSC/data/raw/master/nifti/adi_brain/adi_brain.nii.gz')
nii_source = nib.load(filename)
img = nii_source.get_fdata()
dx, dy, dz = nii_source.header.get_zooms()
img = np.swapaxes(img,0,2).astype(np.float32)
nz, ny, nx = img.shape
volume = k3d.volume(img, color_range=[50,1000], color_map=np.array(k3d.basic_color_maps.Jet, dtype=np.float32))
plot = k3d.plot()
plot += volume
plot.display()
volume.samples = 1024.0
volume.color_range = [650,1500]