Jovian
⭐️
Sign In
In [63]:
import h5py
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
In [61]:
data_hdfs = h5py.File('images/%d.mat' %i)
In [67]:
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
In [37]:
data_ = img_data['cjdata']
In [49]:
plt.imsave?
In [54]:
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
In [39]:
import matplotlib.pyplot as plt
In [40]:
plt.imshow(data_['image'].value, cmap='gray')
Out[40]:
<matplotlib.image.AxesImage at 0x7f03f174f310>
Notebook Image
In [ ]:
 
In [41]:
plt.imshow(data_['tumorMask'].value, cmap='gray')
Out[41]:
<matplotlib.image.AxesImage at 0x7f03f04ce6d0>
Notebook Image
In [ ]: