Changeset 2535


Ignore:
Timestamp:
04/03/07 08:14:56 (13 years ago)
Author:
melissa
Message:

Moved channel min/max logic to ReaderWrapper subclass (MinMaxCalculator).

Location:
trunk/loci/formats
Files:
45 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/FileStitcher.java

    r2523 r2535  
    302302  } 
    303303 
    304   /* @see IFormatReader#getChannelGlobalMinimum(String, int) */ 
    305   public Double getChannelGlobalMinimum(String id, int theC) 
    306     throws FormatException, IOException 
    307   { 
    308     int[] include = getIncludeList(id, theC); 
    309     Double min = new Double(Double.POSITIVE_INFINITY); 
    310     for (int i=0; i<readers.length; i++) { 
    311       if (include[i] >= 0) { 
    312         Double d = readers[i].getChannelGlobalMinimum(files[i], include[i]); 
    313         if (d.compareTo(min) < 0) min = d; 
    314       } 
    315     } 
    316     return min; 
    317   } 
    318  
    319   /* @see IFormatReader#getChannelGlobalMaximum(String, int) */ 
    320   public Double getChannelGlobalMaximum(String id, int theC) 
    321     throws FormatException, IOException 
    322   { 
    323     int[] include = getIncludeList(id, theC); 
    324     Double max = new Double(Double.NEGATIVE_INFINITY); 
    325     for (int i=0; i<readers.length; i++) { 
    326       if (include[i] >= 0) { 
    327         Double d = readers[i].getChannelGlobalMaximum(files[i], include[i]); 
    328         if (d.compareTo(max) > 0) max = d; 
    329       } 
    330     } 
    331     return max; 
    332   } 
    333  
    334   /* @see IFormatReader#getChannelKnownMinimum(String, int) */ 
    335   public Double getChannelKnownMinimum(String id, int theC) 
    336     throws FormatException, IOException 
    337   { 
    338     int[] include = getIncludeList(id, theC); 
    339     Double min = new Double(Double.MAX_VALUE); 
    340     for (int i=0; i<readers.length; i++) { 
    341       if (include[i] >= 0) { 
    342         Double d = readers[i].getChannelKnownMinimum(files[i], include[i]); 
    343         if (d.compareTo(min) < 0) min = d; 
    344       } 
    345     } 
    346     return min; 
    347   } 
    348  
    349   /* @see IFormatReader#getChannelKnownMaximum(String, int) */ 
    350   public Double getChannelKnownMaximum(String id, int theC) 
    351     throws FormatException, IOException 
    352   { 
    353     int[] include = getIncludeList(id, theC); 
    354     Double max = new Double(Double.MIN_VALUE); 
    355     for (int i=0; i<readers.length; i++) { 
    356       if (include[i] >= 0) { 
    357         Double d = readers[i].getChannelKnownMaximum(files[i], include[i]); 
    358         if (d.compareTo(max) > 0) max = d; 
    359       } 
    360     } 
    361     return max; 
    362   } 
    363  
    364   /* @see IFormatReader#getPlaneMinimum(String, int) */ 
    365   public Double[] getPlaneMinimum(String id, int no) 
    366     throws FormatException, IOException 
    367   { 
    368     int[] q = computeIndices(id, no); 
    369     int fno = q[0], ino = q[1]; 
    370     return readers[fno].getPlaneMinimum(files[fno], ino); 
    371   } 
    372  
    373   /* @see IFormatReader#getPlaneMaximum(String, int) */ 
    374   public Double[] getPlaneMaximum(String id, int no) 
    375     throws FormatException, IOException 
    376   { 
    377     int[] q = computeIndices(id, no); 
    378     int fno = q[0], ino = q[1]; 
    379     return readers[fno].getPlaneMaximum(files[fno], ino); 
    380   } 
    381  
    382   /* @see IFormatReader#isMinMaxPopulated(String) */ 
    383   public boolean isMinMaxPopulated(String id) 
    384     throws FormatException, IOException 
    385   { 
    386     for (int i=0; i<readers.length; i++) { 
    387       if (!readers[i].isMinMaxPopulated(files[i])) return false; 
    388     } 
    389     return true; 
    390   } 
    391  
    392304  /* @see IFormatReader#getThumbSizeX(String) */ 
    393305  public int getThumbSizeX(String id) throws FormatException, IOException { 
     
    423335    if (!id.equals(currentId)) initFile(id); 
    424336    return ag[getSeries(id)].isCertain(); 
    425   } 
    426  
    427   /* @see IFormatReader#setChannelStatCalculationStatus(boolean) */ 
    428   public void setChannelStatCalculationStatus(boolean on) { 
    429     if (readers == null) reader.setChannelStatCalculationStatus(on); 
    430     else { 
    431       for (int i=0; i<readers.length; i++) { 
    432         readers[i].setChannelStatCalculationStatus(on); 
    433       } 
    434     } 
    435   } 
    436  
    437   /* @see IFormatReader#getChannelStatCalculationStatus */ 
    438   public boolean getChannelStatCalculationStatus() { 
    439     return reader.getChannelStatCalculationStatus(); 
    440337  } 
    441338 
     
    847744 
    848745    // sync reader configurations with original reader 
    849     boolean channelStatCalculationStatus = 
    850       reader.getChannelStatCalculationStatus(); 
    851746    boolean colorTableIgnored = reader.isColorTableIgnored(); 
    852747    boolean normalized = reader.isNormalized(); 
     
    854749    StatusListener[] statusListeners = reader.getStatusListeners(); 
    855750    for (int i=1; i<readers.length; i++) { 
    856       readers[i].setChannelStatCalculationStatus(channelStatCalculationStatus); 
    857751      readers[i].setColorTableIgnored(colorTableIgnored); 
    858752      readers[i].setNormalized(normalized); 
  • trunk/loci/formats/FormatReader.java

    r2523 r2535  
    2626 
    2727import java.awt.image.BufferedImage; 
    28 import java.awt.image.WritableRaster; 
    2928import java.io.IOException; 
    3029import java.util.*; 
     
    6463  protected String[] currentOrder; 
    6564  protected boolean[] orderCertain; 
    66  
    67   /** Min values for each channel. */ 
    68   protected double[][] chanMin; 
    69  
    70   /** Max values for each channel. */ 
    71   protected double[][] chanMax; 
    72  
    73   /** Min values for each plane. */ 
    74   protected double[][] planeMin; 
    75  
    76   /** Max values for each plane. */ 
    77   protected double[][] planeMax; 
    78  
    79   /** Number of planes for which min/max computations have been completed. */ 
    80   protected int[] minMaxDone; 
    81  
    82   /** Whether or not we're doing channel stat calculation (no by default). */ 
    83   protected boolean enableChannelStats; 
    8465 
    8566  /** Whether or not to ignore color tables, if present. */ 
     
    138119    orderCertain = new boolean[1]; 
    139120    Arrays.fill(orderCertain, true); 
    140  
    141     chanMin = chanMax = null; 
    142     planeMin = planeMax = null; 
    143     minMaxDone = null; 
    144121 
    145122    // reinitialize the MetadataStore 
     
    163140  } 
    164141 
    165   /** 
    166    * Updates min/max values based on the given BufferedImage. 
    167    * Should be called by each format reader's openImage method. 
    168    */ 
    169   protected void updateMinMax(BufferedImage b, int ndx) 
    170     throws FormatException, IOException 
    171   { 
    172     if (b == null || !enableChannelStats) return; 
    173     initMinMax(); 
    174  
    175     // check whether min/max values have already been computed for this plane 
    176     if (planeMin[series][ndx] == planeMin[series][ndx]) return; 
    177  
    178     int[] coords = getZCTCoords(currentId, ndx); 
    179     int numRGB = getRGBChannelCount(currentId); 
    180     int cBase = coords[1] * numRGB; 
    181     int pBase = ndx * numRGB; 
    182     for (int c=0; c<numRGB; c++) { 
    183       planeMin[series][pBase + c] = Double.POSITIVE_INFINITY; 
    184       planeMax[series][pBase + c] = Double.NEGATIVE_INFINITY; 
    185     } 
    186  
    187     WritableRaster pixels = b.getRaster(); 
    188     for (int x=0; x<b.getWidth(); x++) { 
    189       for (int y=0; y<b.getHeight(); y++) { 
    190         for (int c=0; c<numRGB; c++) { 
    191           double v = pixels.getSampleDouble(x, y, c); 
    192           if (v > chanMax[series][cBase + c]) chanMax[series][cBase + c] = v; 
    193           if (v < chanMin[series][cBase + c]) chanMin[series][cBase + c] = v; 
    194           if (v > planeMax[series][pBase + c]) planeMax[series][pBase + c] = v; 
    195           if (v < planeMin[series][pBase + c]) planeMin[series][pBase + c] = v; 
    196         } 
    197       } 
    198     } 
    199  
    200     minMaxDone[series]++; 
    201   } 
    202  
    203   /** 
    204    * Updates min/max values based on given byte array. 
    205    * Should be called by each format reader's openBytes method. 
    206    */ 
    207   protected void updateMinMax(byte[] b, int ndx) 
    208     throws FormatException, IOException 
    209   { 
    210     if (b == null || !enableChannelStats) return; 
    211     initMinMax(); 
    212  
    213     // check whether min/max values have already been computed for this plane 
    214     if (planeMin[series][ndx] == planeMin[series][ndx]) return; 
    215  
    216     boolean little = isLittleEndian(currentId); 
    217     int bytes = FormatTools.getBytesPerPixel(getPixelType(currentId)); 
    218     int pixels = getSizeX(currentId) * getSizeY(currentId); 
    219     boolean interleaved = isInterleaved(currentId); 
    220  
    221     int[] coords = getZCTCoords(currentId, ndx); 
    222     int numRGB = getRGBChannelCount(currentId); 
    223     int cBase = coords[1] * numRGB; 
    224     int pBase = ndx * numRGB; 
    225     for (int c=0; c<numRGB; c++) { 
    226       planeMin[series][pBase + c] = Double.POSITIVE_INFINITY; 
    227       planeMax[series][pBase + c] = Double.NEGATIVE_INFINITY; 
    228     } 
    229  
    230     byte[] value = new byte[bytes]; 
    231     for (int i=0; i<pixels; i++) { 
    232       for (int c=0; c<numRGB; c++) { 
    233         int idx = bytes * (interleaved ? i * numRGB + c : c * pixels + i); 
    234         System.arraycopy(b, idx, value, 0, bytes); 
    235         long bits = DataTools.bytesToLong(value, little); 
    236         double v = Double.longBitsToDouble(bits); 
    237         if (v > chanMax[series][cBase + c]) chanMax[series][cBase + c] = v; 
    238         if (v < chanMin[series][cBase + c]) chanMin[series][cBase + c] = v; 
    239         if (v > planeMax[series][pBase + c]) planeMax[series][pBase + c] = v; 
    240         if (v < planeMin[series][pBase + c]) planeMin[series][pBase + c] = v; 
    241       } 
    242     } 
    243  
    244     minMaxDone[series]++; 
    245   } 
    246  
    247142  /** Returns true if the given file name is in the used files list. */ 
    248143  protected boolean isUsedFile(String id, String file) 
     
    388283  } 
    389284 
    390   /* @see IFormatReader#getChannelGlobalMinimum(String, int) */ 
    391   public Double getChannelGlobalMinimum(String id, int theC) 
    392     throws FormatException, IOException 
    393   { 
    394     if (!id.equals(currentId)) initFile(id); 
    395     if (theC < 0 || theC >= getSizeC(id)) { 
    396       throw new FormatException("Invalid channel index: " + theC); 
    397     } 
    398     // check that all planes have been read 
    399     if (minMaxDone[series] < getImageCount(id)) return null; 
    400     return new Double(chanMin[series][theC]); 
    401   } 
    402  
    403   /* @see IFormatReader#getChannelGlobalMaximum(String, int) */ 
    404   public Double getChannelGlobalMaximum(String id, int theC) 
    405     throws FormatException, IOException 
    406   { 
    407     if (!id.equals(currentId)) initFile(id); 
    408     if (theC < 0 || theC >= getSizeC(id)) { 
    409       throw new FormatException("Invalid channel index: " + theC); 
    410     } 
    411     // check that all planes have been read 
    412     if (minMaxDone[series] < getImageCount(id)) return null; 
    413     return new Double(chanMax[series][theC]); 
    414   } 
    415  
    416   /* @see IFormatReader#getChannelKnownMinimum(String, int) */ 
    417   public Double getChannelKnownMinimum(String id, int theC) 
    418     throws FormatException, IOException 
    419   { 
    420     if (!id.equals(currentId)) initFile(id); 
    421     return chanMin == null ? null : new Double(chanMin[series][theC]); 
    422   } 
    423  
    424   /* @see IFormatReader#getChannelKnownMaximum(String, int) */ 
    425   public Double getChannelKnownMaximum(String id, int theC) 
    426     throws FormatException, IOException 
    427   { 
    428     if (!id.equals(currentId)) initFile(id); 
    429     return chanMax == null ? null : new Double(chanMax[series][theC]); 
    430   } 
    431  
    432   /* @see IFormatReader#getPlaneMinimum(String, int) */ 
    433   public Double[] getPlaneMinimum(String id, int no) 
    434     throws FormatException, IOException 
    435   { 
    436     if (!id.equals(currentId)) initFile(id); 
    437     if (planeMin == null) return null; 
    438  
    439     int numRGB = getRGBChannelCount(id); 
    440     int pBase = no * numRGB; 
    441     if (planeMin[series][pBase] != planeMin[series][pBase]) return null; 
    442  
    443     Double[] min = new Double[numRGB]; 
    444     for (int c=0; c<numRGB; c++) { 
    445       min[c] = new Double(planeMin[series][pBase + c]); 
    446     } 
    447     return min; 
    448   } 
    449  
    450   /* @see IFormatReader#getPlaneMaximum(String, int) */ 
    451   public Double[] getPlaneMaximum(String id, int no) 
    452     throws FormatException, IOException 
    453   { 
    454     if (!id.equals(currentId)) initFile(id); 
    455     if (planeMax == null) return null; 
    456  
    457     int numRGB = getRGBChannelCount(id); 
    458     int pBase = no * numRGB; 
    459     if (planeMax[series][pBase] != planeMax[series][pBase]) return null; 
    460  
    461     Double[] max = new Double[numRGB]; 
    462     for (int c=0; c<numRGB; c++) { 
    463       max[c] = new Double(planeMax[series][pBase + c]); 
    464     } 
    465     return max; 
    466   } 
    467  
    468   /* @see IFormatReader#isMinMaxPopulated(String) */ 
    469   public boolean isMinMaxPopulated(String id) 
    470     throws FormatException, IOException 
    471   { 
    472     if (!id.equals(currentId)) initFile(id); 
    473     return minMaxDone[series] == getImageCount(id); 
    474   } 
    475  
    476285  /* @see IFormatReader#getThumbSizeX(String) */ 
    477286  public int getThumbSizeX(String id) throws FormatException, IOException { 
     
    504313    if (!id.equals(currentId)) initFile(id); 
    505314    return orderCertain[series]; 
    506   } 
    507  
    508   /* @see IFormatReader#setChannelStatCalculationStatus(boolean) */ 
    509   public void setChannelStatCalculationStatus(boolean on) { 
    510     if (currentId != null) { 
    511       String s = "setChannelStatCalculation called with open file."; 
    512       if (debug && debugLevel >= 2) trace(s); 
    513       else System.err.println("Warning: " + s); 
    514     } 
    515     enableChannelStats = on; 
    516   } 
    517  
    518   /* @see IFormatReader#getChannelStatCalculationStatus() */ 
    519   public boolean getChannelStatCalculationStatus() { 
    520     return enableChannelStats; 
    521315  } 
    522316 
     
    768562  } 
    769563 
    770   // -- Helper methods -- 
    771  
    772   /** Ensures internal min/max variables are initialized properly. */ 
    773   private void initMinMax() throws FormatException, IOException { 
    774     int seriesCount = getSeriesCount(currentId); 
    775     if (chanMin == null) { 
    776       chanMin = new double[seriesCount][]; 
    777       for (int i=0; i<seriesCount; i++) { 
    778         chanMin[i] = new double[sizeC[i]]; 
    779         Arrays.fill(chanMin[i], Double.POSITIVE_INFINITY); 
    780       } 
    781     } 
    782     if (chanMax == null) { 
    783       chanMax = new double[seriesCount][]; 
    784       for (int i=0; i<seriesCount; i++) { 
    785         chanMax[i] = new double[sizeC[i]]; 
    786         Arrays.fill(chanMax[i], Double.NEGATIVE_INFINITY); 
    787       } 
    788     } 
    789     if (planeMin == null) { 
    790       planeMin = new double[seriesCount][]; 
    791       int oldSeries = series; 
    792       for (int i=0; i<seriesCount; i++) { 
    793         setSeries(currentId, i); 
    794         int numRGB = getRGBChannelCount(currentId); 
    795         planeMin[i] = new double[getImageCount(currentId) * numRGB]; 
    796         Arrays.fill(planeMin[i], Double.NaN); 
    797       } 
    798       setSeries(currentId, oldSeries); 
    799     } 
    800     if (planeMax == null) { 
    801       planeMax = new double[seriesCount][]; 
    802       int oldSeries = series; 
    803       for (int i=0; i<seriesCount; i++) { 
    804         setSeries(currentId, i); 
    805         int numRGB = getRGBChannelCount(currentId); 
    806         planeMax[i] = new double[getImageCount(currentId) * numRGB]; 
    807         Arrays.fill(planeMax[i], Double.NaN); 
    808       } 
    809       setSeries(currentId, oldSeries); 
    810     } 
    811     if (minMaxDone == null) minMaxDone = new int[seriesCount]; 
    812   } 
    813  
    814564} 
  • trunk/loci/formats/IFormatReader.java

    r2523 r2535  
    8888   */ 
    8989  String[] getChannelDimTypes(String id) throws FormatException, IOException; 
    90  
    91   /** 
    92    * Retrieves a specified channel's global minimum. 
    93    * Returns null if some of the image planes have not been read with channel 
    94    * stat calculation enabled. 
    95    * @param id the filename of the base image. 
    96    * @param theC the channel whose minimum is required. 
    97    * @return the global minimum of the channel; which is defined as the minimum 
    98    * for the channel across all image planes/sections in the image. Will be 
    99    * <code>null</code> if there is no channel minimum stored directly in the 
    100    * file and channel stat calculation is disabled. 
    101    * @throws FormatException if there was a problem parsing the metadata of the 
    102    * file. 
    103    * @throws IOException if there was a problem reading the file. 
    104    * @see #setChannelStatCalculationStatus(boolean) 
    105    */ 
    106   Double getChannelGlobalMinimum(String id, int theC) 
    107     throws FormatException, IOException; 
    108  
    109   /** 
    110    * Retrieves a specified channel's global maximum. 
    111    * Returns null if some of the image planes have not been read with channel 
    112    * stat calculation enabled. 
    113    * @param id the filename of the base image. 
    114    * @param theC the channel whose maximum is required. 
    115    * @return the global maximum of the channel; which is defined as the maximum 
    116    * for the channel across all image planes/sections in the image. Will be 
    117    * <code>null</code> if there is no channel maximum stored directly in the 
    118    * file and channel stat calculation is disabled. 
    119    * @throws FormatException if there was a problem parsing the metadata of the 
    120    * file. 
    121    * @throws IOException if there was a problem reading the file. 
    122    * @see #setChannelStatCalculationStatus(boolean) 
    123    */ 
    124   Double getChannelGlobalMaximum(String id, int theC) 
    125     throws FormatException, IOException; 
    126  
    127   /** 
    128    * Retrieves the specified channel's minimum based on the images that have 
    129    * been read. Returns null if no image planes have been read yet. 
    130    */ 
    131   Double getChannelKnownMinimum(String id, int theC) 
    132     throws FormatException, IOException; 
    133  
    134   /** 
    135    * Retrieves the specified channel's maximum based on the images that have 
    136    * been read. Returns null if no image planes have been read yet. 
    137    */ 
    138   Double getChannelKnownMaximum(String id, int theC) 
    139     throws FormatException, IOException; 
    140  
    141   /** 
    142    * Retrieves the maximum pixel value for the specified plane. If each image 
    143    * plane contains more than one channel (i.e., 
    144    * {@link #getRGBChannelCount(String)}), returns the maximum value for each 
    145    * embedded channel. Returns null if the plane has not already been read. 
    146    */ 
    147   Double[] getPlaneMinimum(String id, int no) 
    148     throws FormatException, IOException; 
    149  
    150   /** 
    151    * Retrieves the maximum pixel value for the specified plane. If each image 
    152    * plane contains more than one channel (i.e., 
    153    * {@link #getRGBChannelCount(String)}), returns the maximum value for each 
    154    * embedded channel. Returns null if the plane has not already been read. 
    155    */ 
    156   Double[] getPlaneMaximum(String id, int no) 
    157     throws FormatException, IOException; 
    158  
    159   /** 
    160    * Returns true if the values returned by getChannelGlobalMinimum/Maximum 
    161    * can be trusted.  
    162    */ 
    163   boolean isMinMaxPopulated(String id) throws FormatException, IOException; 
    16490 
    16591  /** Get the size of the X dimension for the thumbnail. */ 
     
    194120 
    195121  /** 
    196    * Readers can implement potentially performance hindering statistics 
    197    * calculation as part of metadata parsing. This method allows the user of 
    198    * the reader to turn such calculations on or off. 
    199    * @param on <code>true</code> if statistics calculation should be turned on. 
    200    * @see #getChannelStatCalculationStatus() 
    201    */ 
    202   void setChannelStatCalculationStatus(boolean on); 
    203  
    204   /** 
    205    * Retrieves the status of channel statistics calculation. 
    206    * @return the status. 
    207    * @see #setChannelStatCalculationStatus(boolean) 
    208    */ 
    209   boolean getChannelStatCalculationStatus(); 
    210  
    211   /** 
    212122   * Gets whether or not the channels are interleaved. This method exists 
    213123   * because X and Y must appear first in the dimension order. For 
  • trunk/loci/formats/ImageReader.java

    r2523 r2535  
    261261  } 
    262262 
    263   /* @see IFormatReader#getChannelGlobalMinimum(String, int) */ 
    264   public Double getChannelGlobalMinimum(String id, int theC) 
    265     throws FormatException, IOException 
    266   { 
    267     return getReader(id).getChannelGlobalMinimum(id, theC); 
    268   } 
    269  
    270   /* @see IFormatReader#getChannelGlobalMaximum(String, int) */ 
    271   public Double getChannelGlobalMaximum(String id, int theC) 
    272     throws FormatException, IOException 
    273   { 
    274     return getReader(id).getChannelGlobalMaximum(id, theC); 
    275   } 
    276  
    277   /* @see IFormatReader#getChannelKnownMinimum(String, int) */ 
    278   public Double getChannelKnownMinimum(String id, int theC) 
    279     throws FormatException, IOException 
    280   { 
    281     return getReader(id).getChannelKnownMinimum(id, theC); 
    282   } 
    283  
    284   /* @see IFormatReader#getChannelKnownMaximum(String, int) */ 
    285   public Double getChannelKnownMaximum(String id, int theC) 
    286     throws FormatException, IOException 
    287   { 
    288     return getReader(id).getChannelKnownMaximum(id, theC); 
    289   } 
    290  
    291   /* @see IFormatReader#getPlaneMinimum(String, int) */ 
    292   public Double[] getPlaneMinimum(String id, int no) 
    293     throws FormatException, IOException 
    294   { 
    295     return getReader(id).getPlaneMinimum(id, no); 
    296   } 
    297  
    298   /* @see IFormatReader#getPlaneMaximum(String, int) */ 
    299   public Double[] getPlaneMaximum(String id, int no) 
    300     throws FormatException, IOException 
    301   { 
    302     return getReader(id).getPlaneMaximum(id, no); 
    303   } 
    304  
    305   /* @see IFormatReader#isMinMaxPopulated(String) */ 
    306   public boolean isMinMaxPopulated(String id) 
    307     throws FormatException, IOException 
    308   { 
    309     return getReader(id).isMinMaxPopulated(id); 
    310   } 
    311  
    312263  /* @see IFormatReader#getThumbSizeX(String) */ 
    313264  public int getThumbSizeX(String id) throws FormatException, IOException { 
     
    335286  public boolean isOrderCertain(String id) throws FormatException, IOException { 
    336287    return getReader(id).isOrderCertain(id); 
    337   } 
    338  
    339   /* @see IFormatReader#setChannelStatCalculationStatus(boolean) */ 
    340   public void setChannelStatCalculationStatus(boolean on) { 
    341     for (int i=0; i<readers.length; i++) { 
    342       readers[i].setChannelStatCalculationStatus(on); 
    343     } 
    344   } 
    345  
    346   /* @see IFormatReader#getChannelStatCalculationStatus() */ 
    347   public boolean getChannelStatCalculationStatus() { 
    348     // NB: all readers should have the same channel calculation status 
    349     return readers[0].getChannelStatCalculationStatus(); 
    350288  } 
    351289 
  • trunk/loci/formats/ReaderWrapper.java

    r2523 r2535  
    118118  } 
    119119 
    120   public Double getChannelGlobalMinimum(String id, int theC) 
    121     throws FormatException, IOException 
    122   { 
    123     return reader.getChannelGlobalMinimum(id, theC); 
    124   } 
    125  
    126   public Double getChannelGlobalMaximum(String id, int theC) 
    127     throws FormatException, IOException 
    128   { 
    129     return reader.getChannelGlobalMaximum(id, theC); 
    130   } 
    131  
    132   public Double getChannelKnownMinimum(String id, int theC) 
    133     throws FormatException, IOException 
    134   { 
    135     return reader.getChannelKnownMinimum(id, theC); 
    136   } 
    137  
    138   public Double getChannelKnownMaximum(String id, int theC) 
    139     throws FormatException, IOException 
    140   { 
    141     return reader.getChannelKnownMaximum(id, theC); 
    142   } 
    143  
    144   public Double[] getPlaneMinimum(String id, int no) 
    145     throws FormatException, IOException 
    146   { 
    147     return reader.getPlaneMinimum(id, no); 
    148   } 
    149  
    150   public Double[] getPlaneMaximum(String id, int no) 
    151     throws FormatException, IOException 
    152   { 
    153     return reader.getPlaneMaximum(id, no); 
    154   } 
    155  
    156   public boolean isMinMaxPopulated(String id) 
    157     throws FormatException, IOException 
    158   { 
    159     return reader.isMinMaxPopulated(id); 
    160   } 
    161  
    162120  public int getThumbSizeX(String id) throws FormatException, IOException { 
    163121    return reader.getThumbSizeX(id); 
     
    182140  } 
    183141 
    184   public void setChannelStatCalculationStatus(boolean on) { 
    185     reader.setChannelStatCalculationStatus(on); 
    186   } 
    187  
    188   public boolean getChannelStatCalculationStatus() { 
    189     return reader.getChannelStatCalculationStatus(); 
    190   } 
    191  
    192142  public boolean isInterleaved(String id) throws FormatException, IOException { 
    193143    return reader.isInterleaved(id); 
  • trunk/loci/formats/in/AVIReader.java

    r2523 r2535  
    163163      } 
    164164    } 
    165     updateMinMax(buf, no); 
    166165    return buf; 
    167166  } 
     
    171170    throws FormatException, IOException 
    172171  { 
    173     BufferedImage b = ImageTools.makeImage(openBytes(id, no), 
     172    return ImageTools.makeImage(openBytes(id, no), 
    174173      dwWidth, bmpHeight, sizeC[0], true); 
    175     updateMinMax(b, no); 
    176     return b; 
    177174  } 
    178175 
  • trunk/loci/formats/in/AliconaReader.java

    r2523 r2535  
    125125    } 
    126126 
    127     updateMinMax(buf, no); 
    128127    return buf; 
    129128  } 
     
    135134    BufferedImage b = ImageTools.makeImage(openBytes(id, no), width, height, 1, 
    136135      false, numBytes, true); 
    137     updateMinMax(b, no); 
    138136    return b; 
    139137  } 
  • trunk/loci/formats/in/BMPReader.java

    r2523 r2535  
    169169      } 
    170170    } 
    171     updateMinMax(buf, no); 
    172171    return buf; 
    173172  } 
     
    189188    BufferedImage b = ImageTools.makeImage(openBytes(id, no), width, height, 
    190189      !isRGB(id) ? 1 : 3, false); 
    191     updateMinMax(b, no); 
    192190    return b; 
    193191  } 
  • trunk/loci/formats/in/BaseTiffReader.java

    r2523 r2535  
    718718 
    719719    TiffTools.getSamples(ifds[no], in, ignoreColorTable, buf); 
    720     updateMinMax(buf, no); 
    721720    return swapIfRequired(buf); 
    722721  } 
     
    784783 
    785784    BufferedImage b = TiffTools.getImage(ifds[no], in, ignoreColorTable); 
    786     updateMinMax(b, no); 
    787785    return b; 
    788786  } 
  • trunk/loci/formats/in/BioRadReader.java

    r2523 r2535  
    111111  { 
    112112    return false; 
    113   } 
    114  
    115   /* @see loci.formats.IFormatReader#getChannelGlobalMinimum(String, int) */ 
    116   public Double getChannelGlobalMinimum(String id, int theC) 
    117     throws FormatException, IOException 
    118   { 
    119     if (!id.equals(currentId)) initFile(id); 
    120     return new Double(((Integer) getMeta("ramp1_min")).intValue()); 
    121   } 
    122  
    123   /* @see loci.formats.IFormatReader#getChannelGlobalMaximum(String, int) */ 
    124   public Double getChannelGlobalMaximum(String id, int theC) 
    125     throws FormatException, IOException 
    126   { 
    127     if (!id.equals(currentId)) initFile(id); 
    128     return new Double(((Integer) getMeta("ramp1_max")).intValue()); 
    129   } 
    130  
    131   /* @see loci.formats.IFormatReader#isMinMaxPopulated(String) */ 
    132   public boolean isMinMaxPopulated(String id) 
    133     throws FormatException, IOException 
    134   { 
    135     if (!id.equals(currentId)) initFile(id); 
    136     return getMeta("ramp1_min") != null && getMeta("ramp1_max") != null; 
    137113  } 
    138114 
     
    160136    in.seek(offset + 76); 
    161137    in.read(buf); 
    162     updateMinMax(buf, no); 
    163138    return buf; 
    164139  } 
     
    170145    BufferedImage b = ImageTools.makeImage(openBytes(id, no), nx, ny, 1, false, 
    171146      byteFormat ? 1 : 2, LITTLE_ENDIAN); 
    172     updateMinMax(b, no); 
    173147    return b; 
    174148  } 
  • trunk/loci/formats/in/DeltavisionReader.java

    r2523 r2535  
    145145  } 
    146146 
    147   /* @see loci.formats.IFormatReader#getChannelGlobalMinimum(int) */ 
    148   public Double getChannelGlobalMinimum(String id, int theC) 
    149     throws FormatException, IOException 
    150   { 
    151     if (!id.equals(currentId)) initFile(id); 
    152     Float v = (Float) getMeta("Wavelength " + (theC + 1) + " min. intensity"); 
    153     return new Double(v.floatValue()); 
    154   } 
    155  
    156   /* @see loci.formats.IFormatReader#getChannelGlobalMaximum(int) */ 
    157   public Double getChannelGlobalMaximum(String id, int theC) 
    158     throws FormatException, IOException 
    159   { 
    160     if (!id.equals(currentId)) initFile(id); 
    161     Float v = (Float) getMeta("Wavelength " + (theC + 1) + " max. intensity"); 
    162     return new Double(v.floatValue()); 
    163   } 
    164  
    165   /* @see loci.formats.IFormatReader#isMinMaxPopulated(String) */ 
    166   public boolean isMinMaxPopulated(String id) 
    167     throws FormatException, IOException 
    168   { 
    169     return true; 
    170   } 
    171  
    172147  /* @see loci.formats.IFormatReader#isRGB(String) */ 
    173148  public boolean isRGB(String id) throws FormatException, IOException { 
     
    213188    in.seek(offset); 
    214189    in.read(buf); 
    215     updateMinMax(buf, no); 
    216190    return buf; 
    217191  } 
     
    223197    BufferedImage b = ImageTools.makeImage(openBytes(id, no), width, height, 1, 
    224198      false, bytesPerPixel, little); 
    225     updateMinMax(b, no); 
    226199    return b; 
    227200  } 
  • trunk/loci/formats/in/DicomReader.java

    r2523 r2535  
    164164    in.seek(offsets + (width * height * (bitsPerPixel / 8) * no)); 
    165165    in.read(buf); 
    166     updateMinMax(buf, no); 
    167166    return buf; 
    168167  } 
     
    174173    BufferedImage b = ImageTools.makeImage(openBytes(id, no), width, height, 
    175174      1, false, bitsPerPixel / 8, little); 
    176     updateMinMax(b, no); 
    177175    return b; 
    178176  } 
  • trunk/loci/formats/in/EPSReader.java

    r2523 r2535  
    148148    } 
    149149    ras.close(); 
    150     updateMinMax(buf, no); 
    151150    return buf; 
    152151  } 
     
    158157    BufferedImage b = ImageTools.makeImage(openBytes(id, no), width, height, 
    159158      !isRGB(id) ? 1 : 3, true); 
    160     updateMinMax(b, no); 
    161159    return b; 
    162160  } 
  • trunk/loci/formats/in/FluoviewReader.java

    r2455 r2535  
    9898  } 
    9999 
    100   /* @see loci.formats.IFormatReader#getChannelGlobalMinimum(String, int) */ 
    101   public Double getChannelGlobalMinimum(String id, int theC) 
    102     throws FormatException, IOException 
    103   { 
    104     if (!id.equals(currentId)) initFile(id); 
    105     String s = (String) getMeta("Map min"); 
    106     if (s == null) return null; 
    107     return new Double(s); 
    108   } 
    109  
    110   /* @see loci.formats.IFormatReader#getChannelGlobalMaximum(String, int) */ 
    111   public Double getChannelGlobalMaximum(String id, int theC) 
    112     throws FormatException, IOException 
    113   { 
    114     if (!id.equals(currentId)) initFile(id); 
    115     String s = (String) getMeta("Map max"); 
    116     if (s == null) return null; 
    117     return new Double(s); 
    118   } 
    119  
    120   /* @see loci.formats.IFormatReader#isMinMaxPopulated(String) */ 
    121   public boolean isMinMaxPopulated(String id) 
    122     throws FormatException, IOException 
    123   { 
    124     if (!id.equals(currentId)) initFile(id); 
    125     return getMeta("Min value") != null && getMeta("Max value") != null; 
    126   } 
    127  
    128100  // -- IFormatHandler API methods -- 
    129101 
  • trunk/loci/formats/in/GIFReader.java

    r2523 r2535  
    201201      } 
    202202    } 
    203     updateMinMax(buf, no); 
    204203    return buf; 
    205204  } 
     
    212211    BufferedImage b = ImageTools.makeImage(bytes, width, height, 
    213212      bytes.length / (width * height), false, 1, true); 
    214     updateMinMax(b, no); 
    215213    return b; 
    216214  } 
  • trunk/loci/formats/in/GatanReader.java

    r2523 r2535  
    100100  { 
    101101    return false; 
    102   } 
    103  
    104   /* @see loci.formats.IFormatReader#getChannelGlobalMinimum(String, int) */ 
    105   public Double getChannelGlobalMinimum(String id, int theC) 
    106     throws FormatException, IOException 
    107   { 
    108     if (!id.equals(currentId)) initFile(id); 
    109     // yes, we really do want to get the value for "EstimatedMax" 
    110     // for some reason, all of our files have max and min reversed 
    111     return new Double(((Integer) getMeta("EstimatedMax")).intValue()); 
    112   } 
    113  
    114   /* @see loci.formats.IFormatReader#getChannelGlobalMaximum(String, int) */ 
    115   public Double getChannelGlobalMaximum(String id, int theC) 
    116     throws FormatException, IOException 
    117   { 
    118     if (!id.equals(currentId)) initFile(id); 
    119     return new Double(((Integer) getMeta("EstimatedMin")).intValue()); 
    120   } 
    121  
    122   /* @see loci.formats.IFormatReader#isMinMaxPopulated(String) */ 
    123   public boolean isMinMaxPopulated(String id) 
    124     throws FormatException, IOException 
    125   { 
    126     return true; 
    127102  } 
    128103 
     
    164139    BufferedImage b = ImageTools.makeImage(openBytes(id, no), dims[0], dims[1], 
    165140      1, false, dims[2], littleEndian); 
    166     updateMinMax(b, no); 
    167141    return b; 
    168142  } 
  • trunk/loci/formats/in/ICSReader.java

    r2523 r2535  
    190190      } 
    191191    } 
    192     updateMinMax(buf, no); 
    193192    return buf; 
    194193  } 
     
    218217 
    219218      BufferedImage b = ImageTools.makeImage(f, width, height, channels, true); 
    220       updateMinMax(b, no); 
    221219      return b; 
    222220    } 
     
    224222    BufferedImage b = ImageTools.makeImage(plane, width, height, channels, true, 
    225223      bytes, littleEndian); 
    226     updateMinMax(b, no); 
    227224    return b; 
    228225  } 
  • trunk/loci/formats/in/IPLabReader.java

    r2523 r2535  
    112112  } 
    113113 
    114   /* @see loci.formats.IFormatReader#getChannelGlobalMinimum(String, int) */ 
    115   public Double getChannelGlobalMinimum(String id, int theC) 
    116     throws FormatException, IOException 
    117   { 
    118     if (!id.equals(currentId)) initFile(id); 
    119     return (Double) getMeta("NormalizationMin" + theC); 
    120   } 
    121  
    122   /* @see loci.formats.IFormatReader#getChannelGlobalMaximum(String, int) */ 
    123   public Double getChannelGlobalMaximum(String id, int theC) 
    124     throws FormatException, IOException 
    125   { 
    126     if (!id.equals(currentId)) initFile(id); 
    127     return (Double) getMeta("NormalizationMax" + theC); 
    128   } 
    129  
    130   /* @see loci.formats.IFormatReader#isMinMaxPopulated(String) */ 
    131   public boolean isMinMaxPopulated(String id) 
    132     throws FormatException, IOException 
    133   { 
    134     return true; 
    135   } 
    136  
    137114  /** Obtains the specified image from the given IPLab file as a byte array. */ 
    138115  public byte[] openBytes(String id, int no) 
     
    159136 
    160137    in.read(buf); 
    161     updateMinMax(buf, no); 
    162138    return buf; 
    163139  } 
     
    169145    BufferedImage b = ImageTools.makeImage(openBytes(id, no), width, height, 
    170146      !isRGB(id) ? 1 : c, false, bps, littleEndian); 
    171     updateMinMax(b, no); 
    172147    return b; 
    173148  } 
  • trunk/loci/formats/in/IPWReader.java

    r2519 r2535  
    155155      TiffTools.getSamples(ifds[0], stream, ignoreColorTable, buf); 
    156156      stream.close(); 
    157       updateMinMax(buf, no); 
    158157      return buf; 
    159158    } 
     
    177176    BufferedImage bi = ImageTools.makeImage(b, sizeX[0], sizeY[0], 
    178177      bytes == 3 ? 3 : 1, false, bytes == 3 ? 1 : bytes, little); 
    179     updateMinMax(bi, no); 
    180178    return bi; 
    181179  } 
  • trunk/loci/formats/in/ImageIOReader.java

    r2523 r2535  
    9797      } 
    9898    } 
    99     updateMinMax(b, no); 
    10099    return b; 
    101100  } 
     
    115114    ras.close(); 
    116115    dis.close(); 
    117     updateMinMax(b, no); 
    118116    return b; 
    119117  } 
  • trunk/loci/formats/in/ImageJReader.java

    r2523 r2535  
    113113  { 
    114114    byte[] b = ImageTools.getBytes(openImage(id, no), false, no); 
    115     updateMinMax(b, no); 
    116115    return b; 
    117116  } 
     
    153152 
    154153      BufferedImage b = ImageTools.makeBuffered(img); 
    155       updateMinMax(b, no); 
    156154      return b; 
    157155    } 
  • trunk/loci/formats/in/ImarisReader.java

    r2530 r2535  
    238238      row--; 
    239239    } 
    240     updateMinMax(buf, no); 
    241240    return buf; 
    242241  } 
     
    248247    BufferedImage b = ImageTools.makeImage(openBytes(id, no), dims[0], 
    249248      dims[1], 1, false); 
    250     updateMinMax(b, no); 
    251249    return b; 
    252250  } 
  • trunk/loci/formats/in/LIFReader.java

    r2529 r2535  
    124124  } 
    125125 
    126   /* @see loci.formats.IFormatReader#getChannelGlobalMinimum(String, int) */ 
    127   public Double getChannelGlobalMinimum(String id, int theC) 
    128     throws FormatException, IOException 
    129   { 
    130     if (!id.equals(currentId)) initFile(id); 
    131     return new Double(((Integer) channelMins.get(series)).intValue()); 
    132   } 
    133  
    134   /* @see loci.formats.IFormatReader#getChannelGlobalMaximum(String, int) */ 
    135   public Double getChannelGlobalMaximum(String id, int theC) 
    136     throws FormatException, IOException 
    137   { 
    138     if (!id.equals(currentId)) initFile(id); 
    139     return new Double(((Integer) channelMaxs.get(series)).intValue()); 
    140   } 
    141  
    142   /* @see loci.formats.IFormatReader#isMinMaxPopulated(String) */ 
    143   public boolean isMinMaxPopulated(String id) 
    144     throws FormatException, IOException 
    145   { 
    146     return true; 
    147   } 
    148  
    149126  /** Obtains the specified image from the given LIF file as a byte array. */ 
    150127  public byte[] openBytes(String id, int no) 
     
    180157    
    181158    in.read(buf); 
    182     updateMinMax(buf, no); 
    183159    return buf; 
    184160  } 
     
    191167      sizeY[series], isRGB(id) ? sizeC[series] : 1, false, bpp / 8, 
    192168      littleEndian, validBits[series]); 
    193     updateMinMax(b, no); 
    194169    return b; 
    195170  } 
  • trunk/loci/formats/in/LegacyPictReader.java

    r2523 r2535  
    8080  { 
    8181    byte[] b = ImageTools.getBytes(openImage(id, no), false, 3); 
    82     updateMinMax(b, no); 
    8382    return b; 
    8483  } 
     
    107106    fin.close(); 
    108107    BufferedImage b = ImageTools.makeBuffered(qtTools.pictToImage(bytes)); 
    109     updateMinMax(b, no); 
    110108    return b; 
    111109  } 
  • trunk/loci/formats/in/LegacyQTReader.java

    r2523 r2535  
    102102  { 
    103103    byte[] b = ImageTools.getBytes(openImage(id, no), false, 3); 
    104     updateMinMax(b, no); 
    105104    return b; 
    106105  } 
     
    133132 
    134133    BufferedImage b = ImageTools.makeBuffered(image); 
    135     updateMinMax(b, no); 
    136134    return b; 
    137135  } 
  • trunk/loci/formats/in/LegacyZVIReader.java

    r2523 r2535  
    135135    ZVIBlock zviBlock = (ZVIBlock) blockList.elementAt(no); 
    136136    zviBlock.readBytes(in, buf); 
    137     updateMinMax(buf, no); 
    138137    return buf; 
    139138  } 
     
    160159 
    161160    BufferedImage b = zviBlock.readImage(in); 
    162     updateMinMax(b, no); 
    163161    return b; 
    164162  } 
  • trunk/loci/formats/in/LeicaReader.java

    r2529 r2535  
    125125  } 
    126126 
    127   /* @see loci.formats.IFormatReader#getChannelGlobalMinimum(String, int) */ 
    128   public Double getChannelGlobalMinimum(String id, int theC) 
    129     throws FormatException, IOException 
    130   { 
    131     if (!id.equals(currentId)) initFile(id); 
    132     String min = (String) getMeta("Minimum voxel intensity"); 
    133     return min == null ? null : new Double(min); 
    134   } 
    135  
    136   /* @see loci.formats.IFormatReader#getChannelGlobalMaximum(Straxg, axt) */ 
    137   public Double getChannelGlobalMaximum(String id, int theC) 
    138     throws FormatException, IOException 
    139   { 
    140     if (!id.equals(currentId)) initFile(id); 
    141     String max = (String) getMeta("Maximum voxel intensity"); 
    142     return max == null ? null : new Double(max); 
    143   } 
    144  
    145   /* @see loci.formats.IFormatReader#isMinMaxPopulated(String) */ 
    146   public boolean isMinMaxPopulated(String id) 
    147     throws FormatException, IOException 
    148   { 
    149     return true; 
    150   } 
    151  
    152127  /** Determines the number of images in the given Leica file. */ 
    153128  public int getImageCount(String id) throws FormatException, IOException { 
     
    202177    byte[] b = tiff[series][no].openBytes((String) files[series].get(no), 0); 
    203178    tiff[series][no].close(); 
    204     updateMinMax(b, no); 
    205179    return b; 
    206180  } 
     
    215189    tiff[series][no].openBytes((String) files[series].get(no), 0, buf); 
    216190    tiff[series][no].close(); 
    217     updateMinMax(buf, no); 
    218191    return buf; 
    219192  } 
     
    237210    b = ImageTools.makeBuffered(b, cm); 
    238211    tiff[series][no].close(); 
    239     updateMinMax(b, no); 
    240212    return b; 
    241213  } 
     
    11631135      for (int j=0; j<sizeC[0]; j++) { 
    11641136        store.setLogicalChannel(j, null, null, null, null, null, null, ii); 
     1137        // TODO : get channel min/max from metadata  
     1138        /*  
    11651139        try { 
    11661140          store.setChannelGlobalMinMax(j, getChannelGlobalMinimum(currentId, j), 
     
    11731147          if (debug) exc.printStackTrace(); 
    11741148        } 
     1149        */  
    11751150      } 
    11761151 
  • trunk/loci/formats/in/MNGReader.java

    r2523 r2535  
    101101  { 
    102102    byte[] b = ImageTools.getBytes(openImage(id, no), true, getSizeC(id)); 
    103     updateMinMax(b, no); 
    104103    return b; 
    105104  } 
     
    130129 
    131130    BufferedImage bi = ImageIO.read(new ByteArrayInputStream(b)); 
    132     updateMinMax(bi, no); 
    133131    return bi; 
    134132  } 
  • trunk/loci/formats/in/MRCReader.java

    r2523 r2535  
    6464 
    6565  // -- IFormatReader API methods -- 
    66  
    67   /* @see loci.formats.IFormatReader#getChannelGlobalMinimum(String, int) */ 
    68   public Double getChannelGlobalMinimum(String id, int theC) 
    69     throws FormatException, IOException 
    70   { 
    71     if (!id.equals(currentId)) initFile(id); 
    72     return new Double((String) getMeta("Minimum pixel value")); 
    73   } 
    74  
    75   /* @see loci.formats.IFormatReader#getChannelGlobalMaximum(String, int) */ 
    76   public Double getChannelGlobalMaximum(String id, int theC) 
    77     throws FormatException, IOException 
    78   { 
    79     if (!id.equals(currentId)) initFile(id); 
    80     return new Double((String) getMeta("Maximum pixel value")); 
    81   } 
    82  
    83   /* @see loci.formats.IFormatReader#isMinMaxPopulated(String) */ 
    84   public boolean isMinMaxPopulated(String id) 
    85     throws FormatException, IOException 
    86   { 
    87     return true; 
    88   } 
    8966 
    9067  /** Checks if the given block is a valid header for an MRC file. */ 
     
    137114    in.seek(1024 + extHeaderSize + (no * sizeX[0] * sizeY[0] * bpp)); 
    138115    in.read(buf); 
    139     updateMinMax(buf, no); 
    140116    return buf; 
    141117  } 
     
    147123    BufferedImage b = ImageTools.makeImage(openBytes(id, no), sizeX[0], 
    148124      sizeY[0], 1, true, bpp, little); 
    149     updateMinMax(b, no); 
    150125    return b; 
    151126  } 
     
    383358    for (int i=0; i<sizeC[0]; i++) { 
    384359      store.setLogicalChannel(i, null, null, null, null, null, null, null); 
    385       store.setChannelGlobalMinMax(i, getChannelGlobalMinimum(id, i), 
    386         getChannelGlobalMaximum(id, i), null); 
     360      // TODO : get channel min/max from metadata  
     361      //store.setChannelGlobalMinMax(i, getChannelGlobalMinimum(id, i), 
     362      //  getChannelGlobalMaximum(id, i), null); 
    387363    } 
    388364  } 
  • trunk/loci/formats/in/MetamorphReader.java

    r2455 r2535  
    103103      return false; // we went through the IFD; the ID wasn't found. 
    104104    } 
    105   } 
    106  
    107   /* @see loci.formats.IFormatReader#getChannelGlobalMinimum(String, int) */ 
    108   public Double getChannelGlobalMinimum(String id, int theC) 
    109     throws FormatException, IOException 
    110   { 
    111     if (!id.equals(currentId)) initFile(id); 
    112     return (Double) getMeta("grayMin"); 
    113   } 
    114  
    115   /* @see loci.formats.IFormatReader#getChannelGlobalMaximum(String, int) */ 
    116   public Double getChannelGlobalMaximum(String id, int theC) 
    117     throws FormatException, IOException 
    118   { 
    119     if (!id.equals(currentId)) initFile(id); 
    120     return (Double) getMeta("grayMax"); 
    121   } 
    122  
    123   /* @see loci.formats.IFormatReader#isMinMaxPopulated(String) */ 
    124   public boolean isMinMaxPopulated(String id) 
    125     throws FormatException, IOException 
    126   { 
    127     return true; 
    128105  } 
    129106 
  • trunk/loci/formats/in/MicromanagerReader.java

    r2523 r2535  
    105105    } 
    106106    return tiffReader.openImage((String) tiffs.get(no), 0); 
    107   } 
    108  
    109   /* @see loci.formats.IFormatReader#getChannelGlobalMinimum(String, int) */ 
    110   public Double getChannelGlobalMinimum(String id, int theC) 
    111     throws FormatException, IOException 
    112   { 
    113     if (!id.equals(currentId)) initFile(id); 
    114     String min = (String) getMeta("ChContrastMin"); 
    115     if (min == null) return null; 
    116     if (sizeC[0] == 1) return new Double(min); 
    117     StringTokenizer st = new StringTokenizer(min, ","); 
    118     int pos = 0; 
    119     while (pos < theC) { 
    120       st.nextToken(); 
    121       pos++; 
    122     } 
    123     min = st.nextToken(); 
    124     min.replaceAll("[", "").replaceAll("]", "").trim(); 
    125     return new Double(min); 
    126   } 
    127  
    128   /* @see loci.formats.IFormatReader#getChannelGlobalMaximum(String, int) */ 
    129   public Double getChannelGlobalMaximum(String id, int theC) 
    130     throws FormatException, IOException 
    131   { 
    132     if (!id.equals(currentId)) initFile(id); 
    133     String max = (String) getMeta("ChContrastMax"); 
    134     if (max == null) return null; 
    135     if (sizeC[0] == 1) return max == null ? null : new Double(max); 
    136     StringTokenizer st = new StringTokenizer(max, ","); 
    137     int pos = 0; 
    138     while (pos < theC) { 
    139       st.nextToken(); 
    140       pos++; 
    141     } 
    142     max = st.nextToken(); 
    143     max.replaceAll("[", "").replaceAll("]", "").trim(); 
    144     return new Double(max); 
    145   } 
    146  
    147   /* @see loci.formats.IFormatReader#isMinMaxPopulated(String) */ 
    148   public boolean isMinMaxPopulated(String id) 
    149     throws FormatException, IOException 
    150   { 
    151     return getChannelGlobalMinimum(id, 0) != null && 
    152       getChannelGlobalMaximum(id, 0) != null; 
    153107  } 
    154108 
     
    263217    for (int i=0; i<sizeC[0]; i++) { 
    264218      store.setLogicalChannel(i, null, null, null, null, null, null, null); 
    265       store.setChannelGlobalMinMax(i, getChannelGlobalMinimum(id, i), 
    266         getChannelGlobalMaximum(id, i), null); 
     219      // TODO : retrieve min/max from the metadata  
     220      //store.setChannelGlobalMinMax(i, getChannelGlobalMinimum(id, i), 
     221      //  getChannelGlobalMaximum(id, i), null); 
    267222    } 
    268223  } 
  • trunk/loci/formats/in/ND2Reader.java

    r2523 r2535  
    187187      System.arraycopy(pixels[i], 0, b, i*pixels[0].length, pixels[i].length); 
    188188    } 
    189     updateMinMax(b, no); 
    190189    return b; 
    191190  } 
     
    254253    } 
    255254 
    256     updateMinMax(img, no); 
    257255    return img; 
    258256  } 
  • trunk/loci/formats/in/OIBReader.java

    r2529 r2535  
    163163    if (!id.equals(currentId)) initFile(id); 
    164164    return width.size(); 
    165   } 
    166  
    167   /* @see loci.formats.IFormatReader#getChannelGlobalMinimum(String, int) */ 
    168   public Double getChannelGlobalMinimum(String id, int theC) 
    169     throws FormatException, IOException 
    170   { 
    171     if (!id.equals(currentId)) initFile(id); 
    172     String s = (String) getMeta("[Image Parameters] - DataMin"); 
    173     try { return new Double(s); } 
    174     catch (NumberFormatException exc) { return null; } 
    175   } 
    176  
    177   /* @see loci.formats.IFormatReader#getChannelGlobalMaximum(String, int) */ 
    178   public Double getChannelGlobalMaximum(String id, int theC) 
    179     throws FormatException, IOException 
    180   { 
    181     if (!id.equals(currentId)) initFile(id); 
    182     String s = (String) getMeta("[Image Parameters] - DataMax"); 
    183     try { return new Double(s); } 
    184     catch (NumberFormatException exc) { return null; } 
    185   } 
    186  
    187   /* @see loci.formats.IFormatReader#isMinMaxPopulated(String) */ 
    188   public boolean isMinMaxPopulated(String id) 
    189     throws FormatException, IOException 
    190   { 
    191     return true; 
    192165  } 
    193166 
     
    233206      TiffTools.getSamples(ifds[0], stream, ignoreColorTable, buf); 
    234207      stream.close(); 
    235       updateMinMax(buf, no); 
    236208      return buf; 
    237209    } 
     
    257229      getRGBChannelCount(id), false, bytes, !littleEndian[series], 
    258230      validBits[series]); 
    259     updateMinMax(bi, no); 
    260231    return bi; 
    261232  } 
  • trunk/loci/formats/in/OIFReader.java

    r2523 r2535  
    119119  } 
    120120 
    121   /* @see loci.formats.IFormatReader#getChannelGlobalMinimum(String, int) */ 
    122   public Double getChannelGlobalMinimum(String id, int theC) 
    123     throws FormatException, IOException 
    124   { 
    125     if (!id.equals(currentId)) initFile(id); 
    126     return new Double((String) getMeta("[Image Parameters] - DataMin")); 
    127   } 
    128  
    129   /* @see loci.formats.IFormatReader#getChannelGlobalMaximum(String, int) */ 
    130   public Double getChannelGlobalMaximum(String id, int theC) 
    131     throws FormatException, IOException 
    132   { 
    133     if (!id.equals(currentId)) initFile(id); 
    134     return new Double((String) getMeta("[Image Parameters] - DataMax")); 
    135   } 
    136  
    137   /* @see loci.formats.IFormatReader#isMinMaxPopulated(String) */ 
    138   public boolean isMinMaxPopulated(String id) 
    139     throws FormatException, IOException 
    140   { 
    141     return true; 
    142   } 
    143  
    144121  /** Obtains the specified image from the given OIF file as a byte array. */ 
    145122  public byte[] openBytes(String id, int no) 
     
    151128    byte[] b = tiffReader[no].openBytes((String) tiffs.get(no), 0); 
    152129    tiffReader[no].close(); 
    153     updateMinMax(b, no); 
    154130    return b; 
    155131  } 
     
    167143    tiffReader[no].openBytes((String) tiffs.get(no), 0, buf); 
    168144    tiffReader[no].close(); 
    169     updateMinMax(buf, no); 
    170145    return buf; 
    171146  } 
     
    188163    b = ImageTools.makeBuffered(b, cm); 
    189164    tiffReader[no].close(); 
    190     updateMinMax(b, no); 
    191165    return b; 
    192166  } 
  • trunk/loci/formats/in/OMEXMLReader.java

    r2529 r2535  
    213213      } 
    214214    } 
    215     updateMinMax(pixels, no); 
    216215    return pixels; 
    217216  } 
     
    223222    BufferedImage b = ImageTools.makeImage(openBytes(id, no), width[series], 
    224223      height[series], 1, false, bpp[series], littleEndian[series]); 
    225     updateMinMax(b, no); 
    226224    return b; 
    227225  } 
  • trunk/loci/formats/in/OpenlabRawReader.java

    r2523 r2535  
    130130      } 
    131131    } 
    132     updateMinMax(buf, no); 
    133132    return buf; 
    134133  } 
     
    140139    BufferedImage b = ImageTools.makeImage(openBytes(id, no), width, height, 
    141140      !isRGB(id) ? 1 : channels, false, bytesPerPixel, false); 
    142     updateMinMax(b, no); 
    143141    return b; 
    144142  } 
  • trunk/loci/formats/in/OpenlabReader.java

    r2529 r2535  
    356356      System.arraycopy(tmp, 0, b, 0, b.length); 
    357357    } 
    358     updateMinMax(b, no); 
    359358    return b; 
    360359  } 
     
    375374      bytesPerPixel == 3 ? 3 : 1, false, 
    376375      bytesPerPixel == 3 ? 1 : bytesPerPixel, false); 
    377     updateMinMax(bi, no); 
    378376    return bi; 
    379377  } 
  • trunk/loci/formats/in/PerkinElmerReader.java

    r2523 r2535  
    124124    ras.read(b); 
    125125    ras.close(); 
    126     updateMinMax(b, no); 
    127126    return b; 
    128127  } 
     
    147146    BufferedImage bi = ImageTools.makeImage(b, sizeX[0], sizeY[0], 1, 
    148147      false, bpp, true); 
    149     updateMinMax(bi, no); 
    150148    return bi; 
    151149  } 
  • trunk/loci/formats/in/PictReader.java

    r2523 r2535  
    159159    throws FormatException, IOException 
    160160  { 
    161     byte[] b = ImageTools.getBytes(openImage(id, no), false, no % 3); 
    162     updateMinMax(b, no); 
    163     return b; 
     161    return ImageTools.getBytes(openImage(id, no), false, no % 3); 
    164162  } 
    165163 
     
    173171    } 
    174172 
    175     BufferedImage b = open(bytes); 
    176     updateMinMax(b, no); 
    177     return b; 
     173    return open(bytes); 
    178174  } 
    179175 
  • trunk/loci/formats/in/PrairieReader.java

    r2523 r2535  
    177177    } 
    178178    byte[] b = tiff.openBytes(files[no], 0); 
    179     updateMinMax(b, no); 
    180179    return b; 
    181180  } 
     
    189188    } 
    190189    tiff.openBytes(files[no], 0, buf); 
    191     updateMinMax(buf, no); 
    192190    return buf; 
    193191  } 
     
    202200    } 
    203201    BufferedImage b = tiff.openImage(files[no], 0); 
    204     updateMinMax(b, no); 
    205202    return b; 
    206203  } 
  • trunk/loci/formats/in/QTReader.java

    r2523 r2535  
    356356    if (code.equals("jpeg") || code.equals("mjpb")) { 
    357357      byte[] s = ImageTools.getBytes(openImage(id, no), false, no); 
    358       updateMinMax(s, no); 
    359358      return s; 
    360359    } 
     
    464463        bytes[i] = (byte) (255 - bytes[i]); 
    465464      } 
    466       updateMinMax(bytes, no); 
    467465      return bytes; 
    468466    } 
     
    480478        System.arraycopy(data[i], 0, rtn, i * data[0].length, data[i].length); 
    481479      } 
    482       updateMinMax(rtn, no); 
    483480      return rtn; 
    484481    } 
    485482    else { 
    486       updateMinMax(bytes, no); 
    487483      return bytes; 
    488484    } 
     
    553549        flip ? width : height, isRGB(id) ? 3 : 1, false, bpp, little); 
    554550    } 
    555     updateMinMax(b, no); 
    556551    return b; 
    557552  } 
  • trunk/loci/formats/in/SDTReader.java

    r2523 r2535  
    192192      } 
    193193    } 
    194     updateMinMax(buf, no); 
    195194    return buf; 
    196195  } 
     
    202201    BufferedImage b = ImageTools.makeImage(openBytes(id, no), 
    203202      sizeX[series], sizeY[series], getRGBChannelCount(id), false, 2, true); 
    204     updateMinMax(b, no); 
    205203    return b; 
    206204  } 
  • trunk/loci/formats/in/SlidebookReader.java

    r2523 r2535  
    121121    in.seek(offset + (no * width * height * 2)); 
    122122    in.read(buf); 
    123     updateMinMax(buf, no); 
    124123    return buf; 
    125124  } 
     
    131130    BufferedImage b = ImageTools.makeImage(openBytes(id, no), width, height, 
    132131      1, true, bpp, true); 
    133     updateMinMax(b, no); 
    134132    return b; 
    135133  } 
  • trunk/loci/formats/in/ZeissLSMReader.java

    r2519 r2535  
    129129    ifds = TiffTools.getIFDs(in); 
    130130    BufferedImage b = TiffTools.getImage(ifds[2*no], in); 
    131     updateMinMax(b, no); 
    132131    return b; 
    133132  } 
     
    164163    ifds = TiffTools.getIFDs(in); 
    165164    TiffTools.getSamples(ifds[2*no], in, ignoreColorTable, buf); 
    166     updateMinMax(buf, no); 
    167165    return swapIfRequired(buf); 
    168166  } 
  • trunk/loci/formats/in/ZeissZVIReader.java

    r2523 r2535  
    280280      } 
    281281 
    282       updateMinMax(buf, no); 
    283282      return buf; 
    284283    } 
     
    295294    BufferedImage b = ImageTools.makeImage(openBytes(id, no), width, height, 
    296295      isRGB(id) ? 3 : 1, true, bpp == 3 ? 1 : bpp, true, validBits); 
    297     updateMinMax(b, no); 
    298296    return b; 
    299297  } 
Note: See TracChangeset for help on using the changeset viewer.