From 26b9ef3d983d662e6c3343d731230bd14125337f Mon Sep 17 00:00:00 2001 From: Joost van Griethuysen Date: Mon, 4 Sep 2017 13:43:49 -0400 Subject: [PATCH] BUG: Fix name of force2D when generating angles (GLRLM and GLSZM) Because GLRLM and GLSZM are forced with distance 1, other parameters are passed manually to the generate angles function. However, the `force2D` parameter was named incorrectly and as such, ignored. Fix the name to enable forced 2D extraction for GLRLM and GLSZM. --- CHANGES.rst | 2 ++ radiomics/glrlm.py | 4 ++-- radiomics/glszm.py | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 0b55041d..39c8cb54 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -33,6 +33,8 @@ Bug fixes - Update docker manually install python2 support (since recently not supported by default in jupyter/datascience-notebook). (`#287 `_) +- For GLRLM and GLSZM, force2D keyword is passed manually, but was incorrectly named and therefore ignored. Fix name to + enable forced 2D extraction for GLRLM and GLSZM. Tests ##### diff --git a/radiomics/glrlm.py b/radiomics/glrlm.py index aee93423..7e72c5ba 100644 --- a/radiomics/glrlm.py +++ b/radiomics/glrlm.py @@ -112,7 +112,7 @@ def _calculateMatrix(self): # Do not pass kwargs directly, as distances may be specified, which must be forced to [1] for this class angles = imageoperations.generateAngles(self.boundingBoxSize, - force2Dextraction=self.kwargs.get('force2D', False), + force2D=self.kwargs.get('force2D', False), force2Ddimension=self.kwargs.get('force2Ddimension', 0)) self.logger.debug('Calculating diagonals') @@ -173,7 +173,7 @@ def _calculateCMatrix(self): # Do not pass kwargs directly, as distances may be specified, which must be forced to [1] for this class angles = imageoperations.generateAngles(self.boundingBoxSize, - force2Dextraction=self.kwargs.get('force2D', False), + force2D=self.kwargs.get('force2D', False), force2Ddimension=self.kwargs.get('force2Ddimension', 0)) P_glrlm = cMatrices.calculate_glrlm(self.matrix, self.maskArray, angles, Ng, Nr) diff --git a/radiomics/glszm.py b/radiomics/glszm.py index 59ae7133..fd12547c 100644 --- a/radiomics/glszm.py +++ b/radiomics/glszm.py @@ -89,7 +89,7 @@ def _calculateMatrix(self): Np = self.coefficients['Np'] # Do not pass kwargs directly, as distances may be specified, which must be forced to [1] for this class angles = imageoperations.generateAngles(self.boundingBoxSize, - force2Dextraction=self.kwargs.get('force2D', False), + force2D=self.kwargs.get('force2D', False), force2Ddimension=self.kwargs.get('force2Ddimension', 0)) grayLevels = self.coefficients['grayLevels'] @@ -146,7 +146,7 @@ def _calculateCMatrix(self): # Do not pass kwargs directly, as distances may be specified, which must be forced to [1] for this class angles = imageoperations.generateAngles(self.boundingBoxSize, - force2Dextraction=self.kwargs.get('force2D', False), + force2D=self.kwargs.get('force2D', False), force2Ddimension=self.kwargs.get('force2Ddimension', 0)) Ng = self.coefficients['Ng'] Ns = self.coefficients['Np']