ChristophKirst / ClearMap

ClearMap is a python toolbox for the analysis and registration of volumetric data from cleared tissues.
http://christophkirst.github.io/ClearMap/build/html/index.html
GNU General Public License v3.0
49 stars 40 forks source link

IndexError when callling plt.plotOverlayPoints(data, cells, z = (10,16)) #22

Open vzickus opened 5 years ago

vzickus commented 5 years ago

Following the tutorial

File "/home/vzickus/anaconda3/envs/Python27/lib/python2.7/site-packages/ClearMap-0.9.2-py2.7-linux-x86_64.egg/ClearMap/Visualization/Plot.py", line 250, in plotOverlayPoints cimg = overlayPoints(dataSource, pointSource, pointColor = pointColor, x = x, y = y, z = z); File "/home/vzickus/anaconda3/envs/Python27/lib/python2.7/site-packages/ClearMap-0.9.2-py2.7-linux-x86_64.egg/ClearMap/Visualization/Plot.py", line 220, in overlayPoints cimage[p[0], p[1], p[2], :] = pointColor; IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

alexcwsmith commented 4 years ago

Did you ever find a solution for this? Currently trying to work through the same error...

alexcwsmith commented 4 years ago

I just figured this out. The error is because of the dtype of the variable 'cells'.

Change:

dataShape = detectCellShape(dataDoG, cells, threshold = 50);

to:

dataShape = detectCellShape(dataDoG, cells.astype(int), threshold = 50);

You may also have to specify cells.astype(int) in other places, depending on your script, but this fixed it for me.