Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yaoyuping
nnDetection
Commits
e6f7e946
Commit
e6f7e946
authored
Jun 21, 2021
by
mibaumgartner
Browse files
remove usage of deprecated fn
parent
e7d0d0ec
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
scripts/convert_seg2det.py
scripts/convert_seg2det.py
+10
-2
No files found.
scripts/convert_seg2det.py
View file @
e6f7e946
...
...
@@ -58,7 +58,11 @@ def prepare_detection_label(case_id: str,
if
stuff_classes
:
for
new_class
,
old_class
in
enumerate
(
stuff_classes
,
start
=
1
):
stuff_seg
[
seg
==
old_class
]
=
new_class
stuff_seg_itk
=
copy_meta_data_itk
(
seg_itk
,
sitk
.
GetImageFromArray
(
stuff_seg
))
stuff_seg_itk
=
sitk
.
GetImageFromArray
(
stuff_seg
)
stuff_seg_itk
.
SetOrigin
(
seg_itk
.
GetOrigin
())
stuff_seg_itk
.
SetDirection
(
seg_itk
.
GetDirection
())
stuff_seg_itk
.
SetSpacing
(
seg_itk
.
GetSpacing
())
sitk
.
WriteImage
(
stuff_seg_itk
,
str
(
label_dir
/
f
"
{
case_id
}
_stuff.nii.gz"
))
# prepare things information
...
...
@@ -97,7 +101,11 @@ def prepare_detection_label(case_id: str,
else
:
instances
=
np
.
zeros_like
(
instances_not_filtered
)
final_instances_itk
=
copy_meta_data_itk
(
seg_itk
,
sitk
.
GetImageFromArray
(
instances
))
final_instances_itk
=
sitk
.
GetImageFromArray
(
instances
)
final_instances_itk
.
SetOrigin
(
seg_itk
.
GetOrigin
())
final_instances_itk
.
SetDirection
(
seg_itk
.
GetDirection
())
final_instances_itk
.
SetSpacing
(
seg_itk
.
GetSpacing
())
sitk
.
WriteImage
(
final_instances_itk
,
str
(
label_dir
/
f
"
{
case_id
}
.nii.gz"
))
save_json
({
"instances"
:
final_mapping
},
label_dir
/
f
"
{
case_id
}
.json"
)
...
...
Write
Preview
Markdown
is supported
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