Commit d3661208 authored by Robin's avatar Robin
Browse files

d

parent e4fa4640
......@@ -238,13 +238,13 @@ def main():
os.makedirs(npy_savepath)
np.save(npy_savepath + "_pred3D", y_pred3d)
output_volume = np.squeeze(y_pred3d)
output_volume = np.squeeze(X_test)
output_nifty = nib.Nifti1Image(output_volume, np.eye(4))
fname = npy_savepath+'_Scan.nii.gz'
nib.save(output_nifty, fname)
output_label = np.argmax(output_volume, axis=-1)
output_label = np.argmax(y_pred3d, axis=-1)
output_label = output_label.astype(np.uint8)
output_label_nifty = nib.Nifti1Image(output_label, np.eye(4))
......
......@@ -18,7 +18,7 @@ from nets.Unet import dice_loss
def main():
mr = True
mr = False
if mr:
file_path = "data/npy_thresh/"
gt_types = ['ctseg', 'ctthresh', 'unetpred']
......@@ -189,6 +189,10 @@ def main():
all3dhdds.append(hdd3d)
except:
pass
dice_Score16.append(np.mean(patient_dsc))
print("Dice Score for patient", patientnumber, np.mean(patient_dsc))
print("All 3d-HDDs for", gt_type, ": ", all3dhdds)
#print("Dice-Score mean: ", np.mean(dice_Score16))
#print("Dice-Score std: ", np.std(dice_Score16))
......@@ -422,4 +426,4 @@ def show_loss_plot(slice, loss_list):
if __name__ == "__main__":
main()
\ No newline at end of file
main()
import numpy as np
import os
import nibabel as nib
from os import listdir
from os.path import isfile, join
import SimpleITK as sitk
src_path = "../hueftdaten/"
folders = ["T1/", "T2/"]
for folder in folders:
for i in range(1, 40):
patient_folder = 'P'+str(i).zfill(2)
if os.path.exists(os.path.join(src_path+folder, patient_folder)):
reader = sitk.ImageFileReader()
for f in listdir(os.path.join(src_path, patient_folder)):
cur_file_path = join(src_path, patient_folder, f)
print(f)
if isfile(cur_file_path):
if '.gipl' in f:
# cur_file_path_dst = join(dst_path, f)
reader.SetFileName(cur_file_path)
pimgs = reader.Execute()
pimgs_array = sitk.GetArrayFromImage(pimgs)
if "seg" in cur_file_path:
output_label = np.argmax(pimgs_array, axis=-1)
output_label = output_label.astype(np.uint8)
output_label_nifty = nib.Nifti1Image(output_label, np.eye(4))
fname = cur_file_path+'.nii.gz'
nib.save(output_label_nifty, fname)
elif "necro" in cur_file_path or "kopf" in cur_file_path:
output_volume = np.squeeze(pimgs_array)
output_nifty = nib.Nifti1Image(output_volume, np.eye(4))
fname = cur_file_path+'.nii.gz'
nib.save(output_nifty, fname)
Markdown is supported
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