In [1]:
%pylab inline
import io3d
import numpy as np
import matplotlib.pyplot as plt
data3d = (np.random.random([6, 100, 120]) * 30).astype(np.int16)
data3d[0:4, 20:60, 60:70] += 60
metadata = {'voxelsize_mm': [0.5, 0.5, 4]}
import sed3
plt.figure(figsize=(10,5))
sed3.show_slices(data3d)
In [2]:
io3d.write(data3d=data3d.astype("uint16"), path="~/data/temp0/singlefile.dcm")
In [3]:
io3d.write(data3d=data3d.astype("uint8"), path="~/data/temp1/image_{:04d}.jpg")
In [6]:
io3d.write(data3d=data3d.astype("uint16"), path="~/data/temp2/image_{:04d}.dcm", metadata={"voxelsize_mm": [1., 5., .5]})