-
Notifications
You must be signed in to change notification settings - Fork 221
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
floating point issue in FloatStatistics.java #25
Comments
Please upload a 32-bit image that I can use to reproduce this error. |
Hi Rasband Thank you for looking into this matter, I do get that error occasionally, but it is not related to the actual it seems that the pixelCount as determined in getStatisics(...) is still In my simulations i am keeping a local reference of the pixel array and Anyways, I cannot give you an image that would reproduce the error, so Cheers, On 11/10/2016 08:10 PM, rasband wrote:
|
Upgrade to the latest ImageJ daily build (1.51i3) and you should no longer experience this error since the Brightness/Contrast adjuster no longer calculates the median. |
Wow, this also had the nice side_effect of speeding up the B&C adjuster On 11/19/2016 05:04 AM, rasband wrote:
|
It may be a very rare corner case, but in FloatStatistics.java there are
float v;
and
double v;
used in different places for the same purpose of holding a temporary copy of a float pixel value and doing range checks. It appears that the use of "double v" in line 50 could lead to inconsistent pixelCounts and then in turn the float[] pixels2 array from line 230 maybe too short. In particular I got the very strange Error when setting the pixels in a 512x512 32bit image without any ROIs or masks.
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 262143
at ij.process.FloatStatistics.getMedian(FloatStatistics.java:242)
at ij.process.FloatStatistics.(FloatStatistics.java:44)
at ij.process.ImageStatistics.getStatistics(ImageStatistics.java:82)
at ij.ImagePlus.getStatistics(ImagePlus.java:891)
at ij.ImagePlus.getStatistics(ImagePlus.java:863)
at ij.ImagePlus.getStatistics(ImagePlus.java:843)
at ij.plugin.frame.ContrastAdjuster.plotHistogram(ContrastAdjuster.java:610)
at ij.plugin.frame.ContrastAdjuster.setupNewImage(ContrastAdjuster.java:396)
at ij.plugin.frame.ContrastAdjuster.setup(ContrastAdjuster.java:317)
at ij.plugin.frame.ContrastAdjuster.setup(ContrastAdjuster.java:275)
at ij.plugin.frame.ContrastAdjuster.windowActivated(ContrastAdjuster.java:1149)
at java.awt.AWTEventMulticaster.windowActivated(AWTEventMulticaster.java:372)
at java.awt.Window.processWindowEvent(Window.java:1877)
at java.awt.Window.processEvent(Window.java:1823)
at java.awt.Component.dispatchEventImpl(Component.java:4652)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1850)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:910)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:409)
at java.awt.Component.dispatchEventImpl(Component.java:4524)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:617)
at java.awt.EventQueue$2.run(EventQueue.java:615)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
at java.awt.SentEvent.dispatch(SentEvent.java:55)
at java.awt.DefaultKeyboardFocusManager$DefaultKeyboardFocusManagerSentEvent.dispatch(DefaultKeyboardFocusManager.java:183)
at java.awt.DefaultKeyboardFocusManager.sendMessage(DefaultKeyboardFocusManager.java:210)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:286)
at java.awt.Component.dispatchEventImpl(Component.java:4524)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:617)
at java.awt.EventQueue$2.run(EventQueue.java:615)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
at java.awt.SequencedEvent.dispatch(SequencedEvent.java:101)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:642)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:617)
at java.awt.EventQueue$2.run(EventQueue.java:615)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
The text was updated successfully, but these errors were encountered: