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): ...@@ -234,7 +234,8 @@ class MyRadiomicsFirstOrder(MyRadiomicsFeaturesBase):
a threshold of 0.01 × (SUVmax)^2 followed by closing and opening morphological operations were used 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 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:: .. note::
Extracted from PET scans and not used in the CT feature set. Extracted from PET scans and not used in the CT feature set.
...@@ -244,7 +245,8 @@ class MyRadiomicsFirstOrder(MyRadiomicsFeaturesBase): ...@@ -244,7 +245,8 @@ class MyRadiomicsFirstOrder(MyRadiomicsFeaturesBase):
thresh = 0.01 * (numpy.max(ROIPet[~numpy.isnan(ROIPet)]) ** 2) 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 # MORPHOLOGICAL OPERATIONS
conn = numpy.zeros([5, 5, 5]) conn = numpy.zeros([5, 5, 5])
...@@ -288,6 +290,7 @@ class MyRadiomicsFirstOrder(MyRadiomicsFeaturesBase): ...@@ -288,6 +290,7 @@ class MyRadiomicsFirstOrder(MyRadiomicsFeaturesBase):
mask_inactive = oc.imopen(mask_inactive, conn) mask_inactive = oc.imopen(mask_inactive, conn)
new_mask = mask_inactive + perimeter new_mask = mask_inactive + perimeter
new_mask[mask == 0] = 10
new_mask[new_mask == 1] = 10 new_mask[new_mask == 1] = 10
new_mask[new_mask == 2] = 10 new_mask[new_mask == 2] = 10
new_mask[new_mask == 0] = 1 new_mask[new_mask == 0] = 1
...@@ -298,20 +301,22 @@ class MyRadiomicsFirstOrder(MyRadiomicsFeaturesBase): ...@@ -298,20 +301,22 @@ class MyRadiomicsFirstOrder(MyRadiomicsFeaturesBase):
b = numpy.zeros((1, int(connObjects.NumObjects))) b = numpy.zeros((1, int(connObjects.NumObjects)))
for i in range(int(connObjects.NumObjects)): for i in range(int(connObjects.NumObjects)):
a = numpy.where( if isinstance(connObjects.PixelIdxList[0][i], numpy.ndarray):
len(connObjects.PixelIdxList[i]) >= 15 a = connObjects.PixelIdxList[0][i].shape[0]
) # If the number of of pixel forming and object is lower than 15, reject it # If the number of of pixel forming and object is lower than 15, reject it
if a.size == 0: if a < 15:
b[i] = 0 b[:, i] = 0
else: else:
b[i] = 1 b[:, i] = 1
else:
row, col = numpy.where(b > 0) b[:, i] = 0
sumInactive = 0
for i in range(len(col)): rows, cols = numpy.where(b > 0)
sumInactive = sumInactive + len( sumInactive = sum(
connObjects.PixelIdxList[row[i], col[i]] [
connObjects.PixelIdxList[rows, cols][i].shape[0]
for i in range(len(cols))
]
) )
sumVolume = numpy.sum(mask) 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