In [ ]:
%pylab inline
In [12]:
import numpy as np
import imtools
import imtools.misc
import imtools.sample_data
import imtools.image_manipulation as imma
import sed3
In [13]:
datap = imtools.sample_data.generate()
data3d = datap["data3d"]
segmentation = datap["segmentation"]
print(data3d.shape, data3d.dtype)
In [14]:
sed3.show_slices(data3d, slice_step=20)
In [15]:
plt.imshow(data3d[30,:,:])
Out[15]:
In [16]:
crinfo = [[10, 56], [14, 64], [39, 78]]
data3d_cropped = imma.crop(data3d, crinfo)
print(data3d.shape, data3d.dtype)
#sed3.show_slices(data3d_cropped, slice_step=20)
plt.imshow(data3d_cropped[30,:,:])
Out[16]:
In [17]:
plt.imshow(segmentation[30,:,:])
Out[17]:
In [18]:
crinfo_auto = imma.crinfo_from_specific_data(segmentation, 5)
crinfo_auto
Out[18]:
In [19]:
crinfo_auto = imma.crinfo_from_specific_data(segmentation, [5])
crinfo_auto
Out[19]:
In [20]:
crinfo_auto = imma.crinfo_from_specific_data(segmentation, [5, 5, 5])
crinfo_auto
Out[20]:
In [21]:
data3d_cropped_auto = imma.crop(data3d, crinfo_auto)
plt.imshow(data3d_cropped_auto[30,:,:])
Out[21]:
In [22]:
data3d_uncropped = imma.uncrop(
data3d_cropped_auto,
crinfo_auto,
[100, 100, 100])
plt.imshow(data3d_uncropped[30,:,:])
Out[22]: