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
1f1795a3
Commit
1f1795a3
authored
Dec 02, 2020
by
sjromuel
Browse files
Merge branch 'master' of
https://fsstud.is.uni-due.de:8090/sjromuel/Masterarbeit
parents
fa135035
d3661208
Changes
3
Hide whitespace changes
Inline
Side-by-side
RobinNet/allModelsCreatePredNpys.py
View file @
1f1795a3
...
...
@@ -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
))
...
...
RobinNet/dice_gt_seg.py
View file @
1f1795a3
...
...
@@ -18,7 +18,7 @@ from nets.Unet import dice_loss
def
main
():
mr
=
Tru
e
mr
=
Fals
e
if
mr
:
file_path
=
"data/npy_thresh/"
gt_types
=
[
'ctseg'
,
'ctthresh'
,
'unetpred'
]
...
...
@@ -190,6 +190,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))
...
...
@@ -425,4 +429,4 @@ def show_loss_plot(slice, loss_list):
if
__name__
==
"__main__"
:
main
()
\ No newline at end of file
main
()
necro_to_nifty.py
0 → 100644
View file @
1f1795a3
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
)
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