Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
MPBA Radiomics
RADLER
Commits
fa058b89
Commit
fa058b89
authored
Mar 24, 2020
by
Alessia Marcolini
Browse files
Fix Inactive Volume for constant volumes
parent
d8815d99
Changes
1
Hide whitespace changes
Inline
Side-by-side
pyradiomics_radler/myfirstorder.py
View file @
fa058b89
import
numpy
from
scipy
import
ndimage
from
oct2py
import
Oct2Py
,
Oct2PyError
from
scipy
import
ndimage
from
radiomics.firstorder
import
RadiomicsFirstOrder
from
.mybase
import
MyRadiomicsFeaturesBase
...
...
@@ -234,12 +235,12 @@ class MyRadiomicsFirstOrder(MyRadiomicsFeaturesBase):
a threshold of 0.01 × (SUVmax)^2 followed by closing and opening morphological operations were used
to differentiate active and inactive regions on FDG-PET scans
- input: 3D array representing the PET volume in SUV format, with
voxels outside the ROI set to NaNs.
- input: 3D array representing the PET volume in SUV format
.. note::
Extracted from PET scans and not used in the CT feature set.
"""
ROIPet
=
self
.
imageArray
mask
=
self
.
maskArray
...
...
@@ -298,27 +299,31 @@ class MyRadiomicsFirstOrder(MyRadiomicsFeaturesBase):
connObjects
=
oc
.
bwconncomp
(
new_mask
,
26
)
b
=
numpy
.
zeros
((
1
,
int
(
connObjects
.
NumObjects
)
))
if
int
(
connObjects
.
NumObjects
)
>
1
:
for
i
in
range
(
int
(
connObjects
.
NumObjects
)):
if
isinstance
(
connObjects
.
PixelIdxList
[
0
][
i
],
numpy
.
ndarray
):
a
=
connObjects
.
PixelIdxList
[
0
][
i
].
shape
[
0
]
# If the number of of pixel forming and object is lower than 15, reject it
if
a
<
15
:
b
[:,
i
]
=
0
b
=
numpy
.
zeros
((
1
,
int
(
connObjects
.
NumObjects
)))
for
i
in
range
(
int
(
connObjects
.
NumObjects
)):
if
isinstance
(
connObjects
.
PixelIdxList
[
0
][
i
],
numpy
.
ndarray
):
a
=
connObjects
.
PixelIdxList
[
0
][
i
].
shape
[
0
]
# If the number of of pixel forming and object is lower than 15, reject it
if
a
<
15
:
b
[:,
i
]
=
0
else
:
b
[:,
i
]
=
1
else
:
b
[:,
i
]
=
1
else
:
b
[:,
i
]
=
0
b
[:,
i
]
=
0
rows
,
cols
=
numpy
.
where
(
b
>
0
)
sumInactive
=
sum
(
[
connObjects
.
PixelIdxList
[
rows
,
cols
][
i
].
shape
[
0
]
for
i
in
range
(
len
(
cols
))
]
)
rows
,
cols
=
numpy
.
where
(
b
>
0
)
sumInactive
=
sum
(
[
connObjects
.
PixelIdxList
[
rows
,
cols
][
i
].
shape
[
0
]
for
i
in
range
(
len
(
cols
))
]
)
else
:
sumInactive
=
0
sumVolume
=
numpy
.
sum
(
mask
)
except
Oct2PyError
as
e
:
...
...
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