Login  Register

Re: "Set Threshold" records incorrect values - 16bit images - Ubuntu

Posted by Ghislain Bugnicourt on Aug 27, 2008; 8:32pm
URL: http://imagej.273.s1.nabble.com/Set-Threshold-records-incorrect-values-16bit-images-Ubuntu-tp3695217p3695225.html

Thanks, Wayne, for the modified plugin. I upload it again, so that everybody can follow. David, in particular.
Threshold_Adjuster.java

First, sometimes I get exactly the same numbers as you, Wayne, and the result is correct.
Sometimes, the result is correct AND I don't get the same numbers. For instance, here, scaleDown is used twice :
  doSet1: 97.0   768.0
  doSet2: 97.0   768.0
  scaleDown1: 97.0  85.0  768.0
  scaleDown2: 4.5  85.0  768.0
  scaleDown1: 768.0  85.0  768.0
  scaleDown2: 255.0  85.0  768.0
  scaleUpAndSet1: 4.5  255.0
  scaleUpAndSet2: 97.0  768.0  85.0  768.0
  scaleDown1: 97.0  84.0  768.0
  scaleDown2: 4.8  84.0  768.0
  scaleDown1: 768.0  84.0  768.0
  scaleDown2: 255.0  84.0  768.0
  doSet3: 4.8   255.0   84.0   768.0
  scaleUpAndSet1: 4.8  255.0
  scaleUpAndSet2: 97.0  768.0  84.0  768.0
  doSet4: 97.0   768.0
  doSet5: 97.0   768.0
----- I also saw the same with 87 instead of 85

But when it is incorrect, I obtain incredible things.
Here are two examples :
  doSet1: 97.0   768.0
  doSet2: 97.0   768.0
  scaleDown1: 97.0  84.0  768.0
  scaleDown2: 4.8  84.0  768.0
  scaleDown1: 768.0  84.0  768.0
  scaleDown2: 255.0  84.0  768.0
  doSet3: 4.8   255.0   84.0   768.0
  scaleUpAndSet1: 4.8  255.0
  scaleUpAndSet2: 97.0  768.0  84.0  768.0
  doSet4: 97.0   768.0
  doSet5: 97.0   768.0
-----This time, I get 5/255

  doSet1: 97.0   768.0
  scaleDown1: 97.0  84.0  768.0
  doSet2: 97.0   768.0
  scaleDown1: 97.0  84.0  768.0
  scaleDown2: 4.8  84.0  768.0
  scaleDown1: 768.0  84.0  768.0
  scaleDown2: 255.0  84.0  768.0
  doSet3: 4.8   255.0   84.0   768.0
  scaleUpAndSet1: 4.8  255.0
  scaleUpAndSet2: 97.0  768.0  84.0  768.0
  doSet4: 97.0   768.0
  scaleDown2: 4.8  84.0  768.0
  scaleDown1: 255.0  84.0  768.0
  scaleDown2: 63.8  84.0  768.0
  scaleUpAndSet1: 4.8  63.8
  scaleUpAndSet2: 97.0  255.0  84.0  768.0
  doSet5: 97.0   255.0
----And this time, 97/255. Look at the order of the lines : scaleDown1 comes too early... I think I didn't mix the lines, since we can't do that in the 'log window' and I just copied the text (error in 'paste' ? No...).

Well, if anybody can understand something... I don't.

In France, it is 10:30 pm, so I leave work. Don't expect answers before a few hours...
I want to thank you a lot for your help.

Wayne wrote
Dear Ghislain,

The output you are getting indicates that the bug may be in the
scaleDown() and/or scaleUpAndSet() methods so I added debugging code to
these two methods in the attached version of the plugin. I also added a
5th debug line to the doSet() method, after the call to
updateScrollbars(). Here is the output I get:
    doSet1: 97.0   768.0
    doSet2: 97.0   768.0
    scaleDown1: 97.0  84.0  768.0
    scaleDown2: 4.8  84.0  768.0
    scaleDown1: 768.0  84.0  768.0
    scaleDown2: 255.0  84.0  768.0
    doSet3: 4.8   255.0   84.0   768.0
    scaleUpAndSet1: 4.8  255.0
    scaleUpAndSet2: 97.0  768.0  84.0  768.0
    doSet4: 97.0   768.0
    doSet5: 97.0   768.0

-wayne