u_volume.append(u_i * norm) target_volume.append(feed_dict[data.target][0] * norm) zf_volume.append(feed_dict[data.u][0] * norm) # postprocessing u_volume = mriutils.postprocess(np.asarray(u_volume), data_config['dataset']['name']) target_volume = mriutils.postprocess(np.asarray(target_volume), data_config['dataset']['name']) zf_volume = mriutils.postprocess(np.asarray(zf_volume), data_config['dataset']['name']) # evaluation rmse_vn = mriutils.rmse(u_volume, target_volume) rmse_zf = mriutils.rmse(zf_volume, target_volume) ssim_vn = mriutils.ssim(u_volume, target_volume) ssim_zf = mriutils.ssim(zf_volume, target_volume) print( "Zero filling: RMSE={:.4f} SSIM={:.4f} VN: RMSE={:.4f} SSIM={:.4f}" .format(rmse_zf, ssim_zf, rmse_vn, ssim_vn)) time_reco = time.time() - eval_start_time print('reconstruction of {} image took {:f}s'.format( u_volume.shape, time_reco)) print('saving reconstructed image to "{}"'.format(output_name)) # save mat files patient_id = '%s-p%d' % (data_config['dataset']['name'], data_config['dataset']['patient']) mriutils.saveAsMat(u_volume,
# re-normalize images output.append(u_i[0] * norm) target.append(feed_dict[data.target][0] * norm) input0.append(feed_dict[data.u][0] * norm) normalization.append(norm) # postprocess images output = mriutils.postprocess(np.asarray(output), dataset['name']) target = mriutils.postprocess(np.asarray(target), dataset['name']) input0 = mriutils.postprocess(np.asarray(input0), dataset['name']) # evaluation ssim_patient = mriutils.ssim(output, target) rmse_patient = mriutils.rmse(output, target) ssim_eval_dataset.append(ssim_patient) rmse_eval_dataset.append(rmse_patient) print(" Patient {:d}: {:8.4f} {:8.4f}".format( patient, rmse_patient, ssim_patient)) output_path = '%s/%s/%d/' % (eval_output_dir, dataset['name'], patient) mriutils.saveAsMat( output, '%s/vn-%d.mat' % (output_path, epoch), 'result_vn', mat_dict={'normalization': np.asarray(normalization)}) mriutils.saveAsMat(
u_i = sess.run(u_op, feed_dict=feed_dict)[0] u_i = u_i * norm u_i = mriutils.postprocess(u_i, data_config['dataset']['name']) # target target = feed_dict[data.target][0]*norm target = mriutils.postprocess(target, data_config['dataset']['name']) # zero filling zero_filling = feed_dict[data.u][0]*norm zero_filling = mriutils.postprocess(zero_filling, data_config['dataset']['name']) # evaluation rmse_vn = mriutils.rmse(u_i, target) rmse_zf = mriutils.rmse(zero_filling, target) ssim_vn = mriutils.ssim(u_i, target) ssim_zf = mriutils.ssim(zero_filling, target) print("Zero filling: RMSE={:.4f} SSIM={:.4f} VN: RMSE={:.4f} SSIM={:.4f}".format(rmse_zf, ssim_zf, rmse_vn, ssim_vn)) time_reco = time.time() - eval_start_time print('reconstruction of {} image took {:f}s'.format(u_i.shape, time_reco)) print('saving reconstructed image to "{}"'.format(output_name)) # save mat files patient_id = '%s-p%d-sl%d' % (data_config['dataset']['name'], data_config['dataset']['patient'], data_config['dataset']['slice']) mriutils.saveAsMat(u_i, '%s-vn-%s' % (output_name, patient_id), 'result_vn', mat_dict={'normalization': np.asarray(norm)}) mriutils.saveAsMat(zero_filling, '%s-zf-%s' % (output_name, patient_id), 'result_zf',