import h5py
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
data_hdfs = h5py.File('images/%d.mat' %i)
for i in range(1, 200, 20):
data_hdfs = h5py.File('images/%d.mat' %i)
print(i)
data_ = data_hdfs['cjdata']
img = data_['image'].value
plt.imsave('%d.png' % i, img, cmap='gray')
plt.imsave('%d_mask.png' %i, data_['tumorMask'].value, cmap='gray')
1
21
41
61
81
101
121
141
161
181
data_ = img_data['cjdata']
plt.imsave?
i = 0
for name in data_:
if i%20:
img = data_['image'].value
plt.imsave('%d.png' % i, img, cmap='gray')
plt.imsave('%d_mask.png' %i, data_['tumorMask'].value, cmap='gray')
i += 1
import matplotlib.pyplot as plt
plt.imshow(data_['image'].value, cmap='gray')
<matplotlib.image.AxesImage at 0x7f03f174f310>
plt.imshow(data_['tumorMask'].value, cmap='gray')
<matplotlib.image.AxesImage at 0x7f03f04ce6d0>