From 348ea21bf28d3d950ee39c5ea31b375c42a3f410 Mon Sep 17 00:00:00 2001 From: Joost van Griethuysen Date: Tue, 28 Mar 2017 14:43:36 +0200 Subject: [PATCH] BUG: Correct Np when weighting is applied Every voxel in the ROI is considered once per angle in GLRLM. When weighting is applied in GLRLM, Np has to be corrected, as all angles are combined into one matrix, which mean Np has to reflect the number of voxels assessed (equals number of voxels in ROI * number of times each voxel is assessed). --- radiomics/glrlm.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/radiomics/glrlm.py b/radiomics/glrlm.py index 629012a2..2d628073 100644 --- a/radiomics/glrlm.py +++ b/radiomics/glrlm.py @@ -197,6 +197,9 @@ def _applyMatrixOptions(self, P_glrlm, angles): # Optionally apply a weighting factor if self.weightingNorm is not None: self.logger.debug('Applying weighting (%s)', self.weightingNorm) + # Correct the number of voxels for the number of times it is used (once per angle), affects run percentage + self.coefficients['Np'] *= len(angles) + pixelSpacing = self.inputImage.GetSpacing()[::-1] weights = numpy.empty(len(angles)) for a_idx, a in enumerate(angles):