Learn practical skills, build real-world projects, and advance your career
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?