@@ -393,9 +393,11 @@ and _overflow_.
393393value. For example, storing 1000 in a ` uint8 ` image may result in 255 being
394394stored instead (the max value)
395395
396- - Overflow: For NumPy arrays, values outside the valid range are
397- 'wrapped around' to give the new result. For example, storing 256 in a ` uint8 `
398- image (max 255) would give 0, 257 would give 1 and so on...
396+ - Overflow: For NumPy arrays, values outside the valid range may be
397+ 'wrapped around' or create an ` OverflowError ` , depending on what version of
398+ NumPy is installed. Older versions of NumPy may wrap the values around, so
399+ storing 256 in a ` uint8 ` image (max 255) would give 0, 257 would give 1 and so
400+ on... Newer versions of NumPy will raise an ` OverflowError ` .
399401
400402Clipping and overflow result in data loss - you can't get the original values
401403back! So it's always good to keep the data type in mind when doing image
@@ -530,19 +532,19 @@ you should see the one bright pixel you just created.
530532``` python
531533
532534image[15 , 10 ] = 300
533- viewer.layers[" human_mitosis" ].refresh()
534-
535- print (image[15 , 10 ])
536535```
537536
538- ``` output
537+ ``` error
539538
540- 44
541- ```
539+ OverflowError Traceback (most recent call last)
540+ Cell In[8], line 1
541+ ----> 1 image[15, 10] = 300
542542
543- The new value is not correct. This is because 300 exceeds the maximum value for
544- this 8-bit image (max 255). The value therefore overflows and 'wraps around' to
545- give 44 - an incorrect value.
543+ OverflowError: Python integer 300 out of bounds for uint8
544+ ```
545+ An ` OverflowError ` occurs when you try to update this pixel value.
546+ This is because 300 exceeds the maximum value for
547+ this 8-bit image (max 255).
546548
547549:::::::::::::::::::::::::::::::::
548550
0 commit comments