Closed shaw2thefloor closed 1 year ago
Thanks for pointing this out @shaw2thefloor! The error can be avoided by adding maize = np.array(maize)
after the line with iio.imread
. It seems that I missed a few instances when implementing #247 - I will fix it as soon as I can. If you could point me to any other instances you found that would be a great help. Thank you!
@uschille , a couple notes:
imageio
as of v2.28.1
https://github.com/imageio/imageio/pull/976. The latest is v2.31.1
, so if the learner creates an environment themselves, they will likely get a version of imageio
that doesn't have the bug.imageio
that ships with the base Anaconda distribution is different for Windows and MacOS 😱. https://docs.anaconda.com/free/anaconda/reference/packages/pkg-docs/. Anaconda on Windows still has imageio v2.26.0
(weird read behavior), but Mac and Linux users get imageio v2.31.1
(consistent read behavior).I suppose, in light of point 3, we need to keep the np.array(img)
work-around for now, but I put in a request to have Anaconda bump the version for Windows to match Mac+Linux (https://github.com/ContinuumIO/anaconda-issues/issues/13242). I have no idea what the constraints might be to doing that, so we shall see.
@deppen8 thanks for taking care of this!
@shaw2thefloor the latest version of the lesson reads: """
# read input image
maize_roots = iio.imread(uri="data/maize-root-cluster.jpg")
maize_roots = np.array(maize_roots)
# display original image
fig, ax = plt.subplots()
plt.imshow(maize_roots)
Now we can threshold the image and display the result. PYTHON
# keep only high-intensity pixels
maize_roots[maize_roots < 128] = 0
""" Does it run properly for you?
I am going to close this since we believe the issue had been resolved now. @shaw2thefloor please post back here if you think there is still an issue here, and we'll be happy to re-open.
In some examples, using this version of the imread command caused the following error:
maize = iio.imread("maize-root-cluster.jpg") maize[ maize < 128 ] = 0 fig, ax = plt.subplots() plt.imshow(maize)
ValueError Traceback (most recent call last) Cell In[18], line 1 ----> 1 maize[ maize < 128 ] = 0 2 fig, ax = plt.subplots() 3 plt.imshow(maize)
ValueError: assignment destination is read-only
Going back to the skimage.io.imread version fixes this issue.