def show_downsize():
for im in gen_images(n=-1, crop=True):
t_im = im['T1c']
gt = im['gt']
t_im = np.asarray(t_im, dtype='float32')
gt = np.asarray(gt, dtype='float32')
d_im = zoom(t_im, 0.5, order=3)
d_gt = zoom(gt, 0.5, order=0)
print 'New shape: ', d_im.shape
slices1 = np.arange(0, d_im.shape[0], d_im.shape[0]/20)
slices2 = np.arange(0, t_im.shape[0], t_im.shape[0]/20)
for s1, s2 in zip(slices1, slices2):
d_im_slice = d_im[s1]
d_gt_slice = d_gt[s1]
im_slice = t_im[s2]
gt_slice = gt[s2]
title0= 'Original'
title1= 'Downsized'
vis_ims(im0=im_slice, gt0=gt_slice, im1=d_im_slice,
gt1=d_gt_slice, title0=title0, title1=title1)
评论列表
文章目录