Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using bincounts gives an exception: "setting an array element with a sequence"? #399

Closed
aydindemircioglu opened this issue Jul 18, 2018 · 2 comments
Labels

Comments

@aydindemircioglu
Copy link

maybe i'm doing something utterly wrong here-- but if i use bincount instead of binwidth, i get an error. it seems to stem from numpy, the code in imageoperations.py reads:

    binEdges = numpy.histogram(parameterMatrix[parameterMatrixCoordinates], bincount)
    [...]
    parameterMatrix[parameterMatrixCoordinates] = numpy.digitize(parameterMatrix[parameterMatrixCoordinates], binEdges)

but at least in the latest numpy lib numpy.histogram gives back a tuple with the transformed values and the binedges-- so i get an error of the form "setting an array element with a sequence."
when modifying the above line to
_, binEdges = numpy.histogram(parameterMatrix[parameterMatrixCoordinates], bincount)
the code seems to run without an error (and hopefully work as intended).

is it just my peculiar setup or is this a bug?

@aydindemircioglu aydindemircioglu changed the title Using bincounts? Using bincounts gives an exception: "setting an array element with a sequence"? Jul 18, 2018
@andbiz
Copy link

andbiz commented Jul 23, 2018

Hi!
I get this error, too.
I confirm that the proposed fix is working.

pyradiomics=2.0.0
numpy=1.14.5

fedorov added a commit that referenced this issue Jul 23, 2018
As noted in #399, numpy.histogram returns a tuple, appears that the index was missed earlier.
@fedorov fedorov added the bug label Jul 23, 2018
@fedorov
Copy link
Collaborator

fedorov commented Jul 23, 2018

Thanks for pointing this out! I committed a fix, let us know if you continue experiencing problems.

@fedorov fedorov closed this as completed Jul 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants