Skip to content

Commit

Permalink
BUG: Fix a bug in MCC function
Browse files Browse the repository at this point in the history
Improve the fix added in e15f169.

In case of a flat region, GLCM has shape [1, 1, a], thereby resulting only in 1 eigenvalue (1). To prevent an indexing error, return arbitrary 1 in this case.

In certain cases linalg.eigvals returns a complex number. Cast to float to ensure just the real part is returned.
  • Loading branch information
JoostJM committed Oct 2, 2018
1 parent e85f05c commit 6542181
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion radiomics/glcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ def getMCCFeatureValue(self):

MCC = numpy.sqrt(Q_eigenValue[:, -2])

return float(numpy.mean(MCC)) # 2nd highest eigenvalue
return numpy.mean(MCC).real # 2nd highest eigenvalue

def getIdmnFeatureValue(self):
r"""
Expand Down

0 comments on commit 6542181

Please sign in to comment.