Changeset 6320


Ignore:
Timestamp:
05/14/10 12:55:20 (10 years ago)
Author:
curtis
Message:

Use Double.isNaN for clarity instead of equality test (same performance now).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats/src/loci/formats/MinMaxCalculator.java

    r6141 r6320  
    9898   * Retrieves a specified channel's global minimum. 
    9999   * Returns null if some of the image planes have not been read. 
     100   * 
     101   * @throws IOException Not actually thrown. 
    100102   */ 
    101103  public Double getChannelGlobalMinimum(int theC) 
     
    119121   * Retrieves a specified channel's global maximum. 
    120122   * Returns null if some of the image planes have not been read. 
     123   * @throws IOException Not actually thrown. 
    121124   */ 
    122125  public Double getChannelGlobalMaximum(int theC) 
     
    140143   * Retrieves the specified channel's minimum based on the images that have 
    141144   * been read.  Returns null if no image planes have been read yet. 
     145   * 
     146   * @throws FormatException Not actually thrown. 
     147   * @throws IOException Not actually thrown. 
    142148   */ 
    143149  public Double getChannelKnownMinimum(int theC) 
     
    151157   * Retrieves the specified channel's maximum based on the images that 
    152158   * have been read.  Returns null if no image planes have been read yet. 
     159   * 
     160   * @throws FormatException Not actually thrown. 
     161   * @throws IOException Not actually thrown. 
    153162   */ 
    154163  public Double getChannelKnownMaximum(int theC) 
     
    164173   * {@link #getRGBChannelCount()} > 1), returns the maximum value for each 
    165174   * embedded channel. Returns null if the plane has not already been read. 
     175   * 
     176   * @throws FormatException Not actually thrown. 
     177   * @throws IOException Not actually thrown. 
    166178   */ 
    167179  public Double[] getPlaneMinimum(int no) throws FormatException, IOException { 
     
    172184    int pBase = no * numRGB; 
    173185    int series = getSeries(); 
    174     if (planeMin[series][pBase] != planeMin[series][pBase]) { 
    175       return null; 
    176     } 
     186    if (Double.isNaN(planeMin[series][pBase])) return null; 
    177187 
    178188    Double[] min = new Double[numRGB]; 
     
    188198   * {@link #getRGBChannelCount()} > 1), returns the maximum value for each 
    189199   * embedded channel. Returns null if the plane has not already been read. 
     200   * 
     201   * @throws FormatException Not actually thrown. 
     202   * @throws IOException Not actually thrown. 
    190203   */ 
    191204  public Double[] getPlaneMaximum(int no) throws FormatException, IOException { 
     
    196209    int pBase = no * numRGB; 
    197210    int series = getSeries(); 
    198     if (planeMax[series][pBase] != planeMax[series][pBase]) { 
    199       return null; 
    200     } 
     211    if (Double.isNaN(planeMax[series][pBase])) return null; 
    201212 
    202213    Double[] max = new Double[numRGB]; 
     
    210221   * Returns true if the values returned by 
    211222   * getChannelGlobalMinimum/Maximum can be trusted. 
     223   * 
     224   * @throws FormatException Not actually thrown. 
     225   * @throws IOException Not actually thrown. 
    212226   */ 
    213227  public boolean isMinMaxPopulated() throws FormatException, IOException { 
     
    273287    int series = getSeries(); 
    274288    // check whether min/max values have already been computed for this plane 
    275     if (planeMin[series][ndx * numRGB] == planeMin[series][ndx * numRGB]) { 
    276       return; 
    277     } 
     289    if (!Double.isNaN(planeMin[series][ndx * numRGB])) return; 
    278290 
    279291    boolean little = isLittleEndian(); 
     
    302314          if (bits >= threshold) bits -= 2*threshold; 
    303315        } 
    304         double v = (double) bits; 
     316        double v = bits; 
    305317        if (pixelType == FormatTools.FLOAT) { 
    306318          v = Float.intBitsToFloat((int) bits); 
     
    337349  } 
    338350 
    339   /** Ensures internal min/max variables are initialized properly. */ 
     351  /** 
     352   * Ensures internal min/max variables are initialized properly.  
     353   * 
     354   * @throws FormatException Not actually thrown. 
     355   * @throws IOException Not actually thrown. 
     356   */ 
    340357  protected void initMinMax() throws FormatException, IOException { 
    341358    int seriesCount = getSeriesCount(); 
Note: See TracChangeset for help on using the changeset viewer.