Commit cfd821c9 authored by Alessia Marcolini's avatar Alessia Marcolini
Browse files

Fix calculation of InactiveVolume feature

parent 5ebbe3f7
......@@ -234,7 +234,8 @@ 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
- input: 3D array representing the PET volume in SUV format, with
voxels outside the ROI set to NaNs.
.. note::
Extracted from PET scans and not used in the CT feature set.
......@@ -244,7 +245,8 @@ class MyRadiomicsFirstOrder(MyRadiomicsFeaturesBase):
thresh = 0.01 * (numpy.max(ROIPet[~numpy.isnan(ROIPet)]) ** 2)
mask_inactive = ROIPet > thresh
mask_thresholded = ROIPet > thresh
mask_inactive = numpy.logical_and(mask_thresholded, mask)
# MORPHOLOGICAL OPERATIONS
conn = numpy.zeros([5, 5, 5])
......@@ -288,6 +290,7 @@ class MyRadiomicsFirstOrder(MyRadiomicsFeaturesBase):
mask_inactive = oc.imopen(mask_inactive, conn)
new_mask = mask_inactive + perimeter
new_mask[mask == 0] = 10
new_mask[new_mask == 1] = 10
new_mask[new_mask == 2] = 10
new_mask[new_mask == 0] = 1
......@@ -298,21 +301,23 @@ class MyRadiomicsFirstOrder(MyRadiomicsFeaturesBase):
b = numpy.zeros((1, int(connObjects.NumObjects)))
for i in range(int(connObjects.NumObjects)):
a = numpy.where(
len(connObjects.PixelIdxList[i]) >= 15
) # If the number of of pixel forming and object is lower than 15, reject it
if a.size == 0:
b[i] = 0
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
row, col = numpy.where(b > 0)
sumInactive = 0
b[:, i] = 0
for i in range(len(col)):
sumInactive = sumInactive + len(
connObjects.PixelIdxList[row[i], col[i]]
)
rows, cols = numpy.where(b > 0)
sumInactive = sum(
[
connObjects.PixelIdxList[rows, cols][i].shape[0]
for i in range(len(cols))
]
)
sumVolume = numpy.sum(mask)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment