Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sjromuel
Masterarbeit
Commits
ef9d396b
Commit
ef9d396b
authored
Nov 23, 2020
by
sjromuel
Browse files
f
parent
9bcd9389
Changes
4
Hide whitespace changes
Inline
Side-by-side
RobinNet/13unet_mrt_threshgt.py
View file @
ef9d396b
...
...
@@ -67,7 +67,7 @@ class mrt_unet(BaseNetwork):
for
elem
in
full_list
:
if
elem
.
endswith
(
"T1.gipl.npy"
):
X_img_list
.
append
(
elem
)
if
self
.
gt_type
==
"ctthresh_gt"
or
self
.
gt_type
==
"_mr_ctunetpred"
:
if
self
.
gt_type
==
"ctthresh_gt"
:
X_img_list
.
append
(
elem
)
X_img_list
.
append
(
elem
)
elif
elem
.
endswith
(
self
.
gt_type
+
".gipl.npy"
):
...
...
RobinNet/nets/BaseNetwork.py
View file @
ef9d396b
...
...
@@ -108,7 +108,7 @@ class BaseNetwork:
else
:
if
elem
.
endswith
(
"ct.gipl.npy"
):
X_img_list
.
append
(
elem
)
if
self
.
gt_type
==
"thresh"
or
self
.
gt_type
==
"_mr_ctunetpred"
:
if
self
.
gt_type
==
"thresh"
:
X_img_list
.
append
(
elem
)
X_img_list
.
append
(
elem
)
elif
elem
.
endswith
(
self
.
gt_type
+
".gipl.npy"
):
...
...
@@ -117,7 +117,7 @@ class BaseNetwork:
for
elem
in
full_list
:
if
elem
.
endswith
(
"ct.gipl.npy"
):
X_img_list
.
append
(
elem
)
if
self
.
gt_type
==
"thresh"
or
self
.
gt_type
==
"_mr_ctunetpred"
:
if
self
.
gt_type
==
"thresh"
:
X_img_list
.
append
(
elem
)
X_img_list
.
append
(
elem
)
elif
elem
.
endswith
(
self
.
gt_type
+
".gipl.npy"
):
...
...
RobinNet/saveImgs_run_trained_model.py
View file @
ef9d396b
...
...
@@ -21,7 +21,7 @@ def main():
root
=
tk
.
Tk
()
root
.
withdraw
()
file_path
=
filedialog
.
askopenfilename
(
initialdir
=
"
saves
/mr_unet_cv_ctthresh
/
"
)
file_path
=
filedialog
.
askopenfilename
(
initialdir
=
"
finalResults/complete_segmr
/mr_unet_cv_ctthresh"
)
file_path
=
file_path
[:
-
9
]
print
(
file_path
)
...
...
@@ -196,12 +196,12 @@ def main():
y_true
=
onehotencode
(
y_true
)
y_pred
=
Unet
(
image
,
weights
,
filter_multiplier
,
training
=
False
)
if
detailed_images
:
if
npys3d
:
if
y_pred3d
==
[]:
y_pred3d
=
y_pred
[:,:,:,
0
].
numpy
()
else
:
y_pred3d
=
np
.
append
(
y_pred
[:,:,:,
0
].
numpy
(),
y_pred3d
,
axis
=
0
)
print
(
np
.
shape
(
y_pred3d
))
#
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)
...
...
@@ -271,8 +271,9 @@ def main():
y_pred
[
0
,
:,
:,
0
],
cmap
=
plt
.
cm
.
bone
)
if
npys3d
:
np
.
save
(
img_savepath
+
"P"
+
str
(
TP_num
).
zfill
(
2
)
+
"_pred3D"
,
y_pred3d
)
np
.
save
(
"data/npy/"
+
"P"
+
str
(
TP_num
).
zfill
(
2
)
+
"_mr_ctunetpred.gipl"
,
y_pred3d
)
#np.save(img_savepath + "P" + str(TP_num).zfill(2) + "_pred3D", y_pred3d)
np
.
save
(
"data/npy_thresh/"
+
"P"
+
str
(
TP_num
).
zfill
(
2
)
+
"_mr_ctunetpred.gipl"
,
y_pred3d
)
print
(
"ypred shape: "
,
np
.
shape
(
y_pred3d
))
#plt.show()
#print(test_loss)
print
(
"TestLoss Mean for P"
,
test_patients
[
j
],
": "
,
np
.
mean
(
test_loss
))
...
...
RobinNet/tryOut.py
View file @
ef9d396b
...
...
@@ -9,7 +9,14 @@ import matplotlib.pyplot as plt
from
scipy
import
ndimage
from
datetime
import
datetime
mr_img
=
np
.
load
(
"data/npy/P03_mr_T1.gipl.npy"
)
img
=
np
.
load
(
"data/npy_thresh/P01_mr_ctunetpred.gipl.npy"
)
print
(
np
.
shape
(
img
))
plt
.
imshow
(
img
[
5
,:,
:],
cmap
=
plt
.
cm
.
bone
)
plt
.
show
()
'''mr_img = np.load("data/npy/P03_mr_T1.gipl.npy")
ct_img = np.load("data/npy/P03_mr_ctseg_gt.gipl.npy")
mrseg = np.load("data/npy/P03_segmr.gipl.npy")
...
...
@@ -30,7 +37,7 @@ for i in range(18):
plt.imshow(mrseg[i,:, :], cmap=plt.cm.bone)
plt.title('MR Segmentation')
# print(i)
plt
.
show
()
plt.show()
'''
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment