Skip to content

Commit

Permalink
BUG: Fix name of force2D when generating angles (GLRLM and GLSZM)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JoostJM committed Sep 4, 2017
1 parent 5ce9f48 commit 26b9ef3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Expand Up @@ -33,6 +33,8 @@ Bug fixes
- Update docker manually install python2 support (since recently not supported by default in
jupyter/datascience-notebook).
(`#287 <https://github.com/Radiomics/pyradiomics/pull/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
#####
Expand Down
4 changes: 2 additions & 2 deletions radiomics/glrlm.py
Expand Up @@ -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')
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions radiomics/glszm.py
Expand Up @@ -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']
Expand Down Expand Up @@ -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']
Expand Down

0 comments on commit 26b9ef3

Please sign in to comment.