brain_segmentation
brain_segmentation copied to clipboard
Cannot visualize the Segmentation
Hey, I am getting just a black image if I am trying to visualize the predicted image.
imgs = sitk.GetArrayFromImage(sitk.ReadImage(tests[10])) plist = []
create patches from an entire slice
for img in imgs[:-1]: if np.max(img) != 0: img /= np.max(img) p = extract_patches_2d(img, (33,33)) plist.append(p) patches = np.array(zip(np.array(plist[0]), np.array(plist[1]), np.array(plist[2]), np.array(plist[3])))
predict classes of each pixel based on model
full_pred = model.predict_classes(patches) fp1 = full_pred.reshape(208,208
full_pred = model.predict_classes(imgs) imgs = sitk.GetArrayFromImage(sitk.ReadImage(tests[10]))
plt.figure(figsize=(10,10)) plt.subplot(121) plt.imshow(imgs[70]) plt.subplot(122) plt.imshow(fp1) plt.show()
I am trying to create an image with the Segmentation like in the description. But with the code it does not work. Can somebody help me out