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
69c0844c
Commit
69c0844c
authored
Nov 26, 2020
by
sjromuel
Browse files
d
parent
a41ea9fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
RobinNet/allModelsCreatePredNpys.py
View file @
69c0844c
...
...
@@ -7,6 +7,7 @@ import matplotlib
from
tkinter
import
filedialog
from
skimage
import
transform
import
SimpleITK
as
sitk
import
nibabel
as
nib
import
argparse
#import os
#import pydot
...
...
@@ -235,10 +236,24 @@ def main():
y_true3d
=
np
.
append
(
np
.
reshape
(
y_true_np
,
newshape
=
(
1
,
512
,
512
)),
y_true3d
,
axis
=
0
)
except
:
pass
npy_savepath
=
"finalResults/3dnpys/"
+
model_path
npy_savepath
=
"finalResults/3dnpys/"
+
model_path
+
"P"
+
str
(
TP_num
).
zfill
(
2
)
if
not
os
.
path
.
exists
(
npy_savepath
):
os
.
makedirs
(
npy_savepath
)
np
.
save
(
npy_savepath
+
"P"
+
str
(
TP_num
).
zfill
(
2
)
+
"_pred3D"
,
y_pred3d
)
np
.
save
(
npy_savepath
+
"_pred3D"
,
y_pred3d
)
output_volume
=
np
.
squeeze
(
y_pred3d
)
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
=
output_label
.
astype
(
np
.
uint8
)
output_label_nifty
=
nib
.
Nifti1Image
(
output_label
,
np
.
eye
(
4
))
fname
=
npy_savepath
+
'_Label.nii.gz'
nib
.
save
(
output_label_nifty
,
fname
)
#####
...
...
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