Commit 94d6b5d3 authored by sjromuel's avatar sjromuel
Browse files

d

parent 410b8d3c
......@@ -135,14 +135,6 @@ def main():
npys3d = True
###################################################################################
if npys3d:
#test_patient_pred = run_test_patient(test_dataset, weights, filter_multiplier)
np.save(img_savepath + "P" + str(TP_num).zfill(2) +"_Inputimg3D", X_test)
np.save(img_savepath + "P" + str(TP_num).zfill(2) + "_gt3D", GT_test)
np.save(img_savepath + "P" + str(TP_num).zfill(2) + "_true3D", ytrue)
test_loss = []
test_loss_hdd = []
......@@ -161,31 +153,7 @@ def main():
y_pred3d = np.append(y_pred[:,:,:,0].numpy(), y_pred3d, axis=0)
#print(np.shape(y_pred3d))
# print(tf.shape(y_pred), tf.shape(y_true))
#y_true = onehotencode(tf.reshape(y_true, (1, 512, 512, 1)), autoencoder=True)
#y_pred = tf.reshape(y_pred, (1, 512, 512, 2))
fig = plt.figure()
fig.add_subplot(1, 4, 1)
plt.title("Input_img")
plt.axis('off')
plt.imshow(image[0,:,:,0], cmap=plt.cm.bone)
fig.add_subplot(1, 4, 2)
plt.title("Pred")
plt.axis('off')
plt.imshow(y_pred[0, :, :, 0], cmap=plt.cm.bone)
fig.add_subplot(1, 4, 3)
plt.title("True Seg")
plt.axis('off')
plt.imshow(y_true[0, :, :, 0], cmap=plt.cm.bone)
fig.add_subplot(1, 4, 4)
plt.title("Fake GT")
plt.axis('off')
plt.imshow(GT_test[counter, :, :, 0], cmap=plt.cm.bone)
if not os.path.exists(img_savepath+ "4Imgs_P" + str(TP_num).zfill(2)):
os.makedirs(img_savepath+ "4Imgs_P" + str(TP_num).zfill(2))
fig.savefig(img_savepath + "4Imgs_P" + str(TP_num).zfill(2) +"/" + str(counter+1).zfill(2)+".png")
plt.close(fig)
counter = counter+1
loss = dice_loss(y_pred, y_true)
......@@ -208,25 +176,7 @@ def main():
pass
# save images:
if detailed_images:
matplotlib.image.imsave(img_savepath + "P" + str(TP_num).zfill(2) +"_" + str(counter).zfill(2)+"_Inputimg.png", image[0,:,:,0],
cmap=plt.cm.bone)
matplotlib.image.imsave(img_savepath + "P" + str(TP_num).zfill(2) +"_" + str(counter).zfill(2) + "_ytrue.png",
y_true[0, :, :, 0],
cmap=plt.cm.bone)
matplotlib.image.imsave(img_savepath + "P" + str(TP_num).zfill(2) +"_" + str(counter).zfill(2) + "_ytrain.png",
GT_test[counter-1, :, :, 0],
cmap=plt.cm.bone)
if 'Cluster' in file_path:
matplotlib.image.imsave(img_savepath + "P" + str(TP_num).zfill(2) +"_" + str(counter).zfill(2) + "_clusterpred"+ str(loss)[0:6] +".png",
y_pred[0, :, :, 0], cmap=plt.cm.bone)
elif 'class' in file_path:
matplotlib.image.imsave(img_savepath + "P" + str(TP_num).zfill(2) +"_" + str(counter).zfill(2) + "_classpred"+ str(loss)[0:6] +".png",
y_pred[0, :, :, 0], cmap=plt.cm.bone)
else:
matplotlib.image.imsave(img_savepath + "P" + str(TP_num).zfill(2) + "_" + str(counter).zfill(2) + "_unetpred"+ str(loss)[0:6] +".png",
y_pred[0, :, :, 0], cmap=plt.cm.bone)
if npys3d:
#np.save(img_savepath + "P" + str(TP_num).zfill(2) + "_pred3D", y_pred3d)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment