Commit 7296d372 authored by Alessia Marcolini's avatar Alessia Marcolini
Browse files

Add SUVMax and SUVMean features for PET modality

parent 2fa3bde1
import numpy
from scipy import ndimage
from radiomics.firstorder import RadiomicsFirstOrder
from .mybase import MyRadiomicsFeaturesBase
class MyRadiomicsFirstOrder(MyRadiomicsFeaturesBase):
def __init__(self, inputImage, inputMask, **kwargs):
super().__init__(inputImage, inputMask, **kwargs)
self.pixelSpacing = inputImage.GetSpacing()
self.voxelArrayShift = kwargs.get('voxelArrayShift', 0)
def _initCalculation(self):
return super()._initSegmentBasedCalculation()
self.targetVoxelArray = self.imageArray[self.labelledVoxelCoordinates].astype(
'float'
)
self.discretizedTargetVoxelArray = None # Lazy instantiation
self.logger.debug('First order feature class initialized')
def _moment(self, a, moment=1, axis=0):
return RadiomicsFirstOrder._moment(self, a, moment, axis)
def _getDiscretizedTargetVoxelArray(self):
return RadiomicsFirstOrder._getDiscretizedTargetVoxelArray(self)
def getSuvMaxFeatureValue(self):
r"""
**20. SUV max**
Implemented as one of the intensity features extracted by Vallieres et al.
Maximum SUV of the tumour region.
- 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
ROIPet[~mask] = numpy.nan
return numpy.max(ROIPet[~numpy.isnan(ROIPet)])
def getSuvMeanFeatureValue(self):
r"""
**21. SUV mean**
Implemented as one of the intensity features extracted by valieres et al.
Average SUV of the tumour region.
- 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
ROIPet[~mask] = numpy.nan
return numpy.mean(ROIPet[~numpy.isnan(ROIPet)])
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