import numpy as np
import os
from matplotlib import pyplot as plt
sampled_batch = np.load("train_npz/case0005_slice000.npz")
image = sampled_batch["image"].T
plt.imshow(image, cmap='gray')
plt.show()
label = sampled_batch["label"].T
plt.imshow(label, cmap='gray')
plt.show()
查看文件尺寸信息
sampled_batch["image"].shape,sampled_batch["label"].shape
查看文件包含哪些信息((512, 512), (512, 512))
sampled_batch.files
查看图像中的像素范围[‘image’, ‘label’]
sampled_batch['image'].min(), sampled_batch['image'].max()
关闭文件(0.0, 1.0)
sampled_batch.close()
查看h5文件信息
import h5py
f = h5py.File('test_vol_h5/case0001.npy.h5', 'r')
for key in f.keys():
print(f[key].name)
print(f[key].shape)
查看图像shape/image
(147, 512, 512)
/label
(147, 512, 512)
f['image'].shape,f['label'].shape
((147, 512, 512), (147, 512, 512))
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)