Changeset 6993


Ignore:
Timestamp:
09/28/10 10:42:22 (9 years ago)
Author:
melissa
Message:

Merged minor API additions to 4.2: r6747 and r6798.

Location:
branches/4.2
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2

  • branches/4.2/components/bio-formats/src/loci/formats/FileStitcher.java

    r6301 r6993  
    825825  } 
    826826 
     827  /* @see IFormatReader#getSeriesMetadataValue(String) */ 
     828  public Object getSeriesMetadataValue(String field) { 
     829    FormatTools.assertId(currentId, true, 2); 
     830    return reader.getSeriesMetadataValue(field); 
     831  } 
     832 
    827833  /* @see IFormatReader#getGlobalMetadata() */ 
    828834  public Hashtable<String, Object> getGlobalMetadata() { 
  • branches/4.2/components/bio-formats/src/loci/formats/FormatReader.java

    r6910 r6993  
    952952  } 
    953953 
     954  /* @see IFormatReader#getSeriesMetadataValue(String) */ 
     955  public Object getSeriesMetadataValue(String field) { 
     956    FormatTools.assertId(currentId, true, 1); 
     957    return getSeriesMeta(field); 
     958  } 
     959 
    954960  /* @see IFormatReader#getGlobalMetadata() */ 
    955961  public Hashtable<String, Object> getGlobalMetadata() { 
  • branches/4.2/components/bio-formats/src/loci/formats/FormatWriter.java

    r6753 r6993  
    144144  } 
    145145 
     146  /* @see IFormatWriter#getSeries() */ 
     147  public int getSeries() { 
     148    return series; 
     149  } 
     150 
    146151  /* @see IFormatWriter#setInterleaved(boolean) */ 
    147152  public void setInterleaved(boolean interleaved) { 
  • branches/4.2/components/bio-formats/src/loci/formats/IFormatReader.java

    r6584 r6993  
    398398 
    399399  /** 
     400   * Obtains the specified metadata field's value for the current series 
     401   * in the current file. 
     402   * @param field the name associated with the metadata field 
     403   * @return the value, or null if the field doesn't exist 
     404   */ 
     405  Object getSeriesMetadataValue(String field); 
     406 
     407  /** 
    400408   * Obtains the hashtable containing the metadata field/value pairs from 
    401409   * the current file. 
  • branches/4.2/components/bio-formats/src/loci/formats/IFormatWriter.java

    r6328 r6993  
    9696  void setSeries(int series) throws FormatException; 
    9797 
     98  /** Returns the current series. */ 
     99  int getSeries(); 
     100 
    98101  /** Sets whether or not the channels in an image are interleaved. */ 
    99102  void setInterleaved(boolean interleaved); 
  • branches/4.2/components/bio-formats/src/loci/formats/ImageReader.java

    r6301 r6993  
    457457  } 
    458458 
     459  /* @see IFormatReader#getSeriesMetadataValue(String) */ 
     460  public Object getSeriesMetadataValue(String field) { 
     461    return getReader().getSeriesMetadataValue(field); 
     462  } 
     463 
    459464  /* @see IFormatReader#getGlobalMetadata() */ 
    460465  public Hashtable<String, Object> getGlobalMetadata() { 
  • branches/4.2/components/bio-formats/src/loci/formats/ImageWriter.java

    r6294 r6993  
    217217  } 
    218218 
     219  /* @see IFormatWriter#getSeries() */ 
     220  public int getSeries() { 
     221    return getWriter().getSeries(); 
     222  } 
     223 
    219224  /* @see IFormatWriter#setInterleaved(boolean) */ 
    220225  public void setInterleaved(boolean interleaved) { 
  • branches/4.2/components/bio-formats/src/loci/formats/ReaderWrapper.java

    r6477 r6993  
    397397  public Object getMetadataValue(String field) { 
    398398    return reader.getMetadataValue(field); 
     399  } 
     400 
     401  public Object getSeriesMetadataValue(String field) { 
     402    return reader.getSeriesMetadataValue(field); 
    399403  } 
    400404 
  • branches/4.2/components/bio-formats/src/loci/formats/WriterWrapper.java

    r6294 r6993  
    171171  } 
    172172 
     173  public int getSeries() { 
     174    return writer.getSeries(); 
     175  } 
     176 
    173177  public void setInterleaved(boolean interleaved) { 
    174178    writer.setInterleaved(interleaved); 
  • branches/4.2/components/bio-formats/src/loci/formats/gui/BufferedImageWriter.java

    r6294 r6993  
    4242public class BufferedImageWriter extends WriterWrapper { 
    4343 
     44  // -- Fields -- 
     45 
     46  /** 
     47   * Number of planes written.  Only required by deprecated saveImage method. 
     48   */ 
     49  private int numWritten = 0; 
     50 
    4451  // -- Utility methods -- 
    4552 
     
    6370 
    6471  /** 
    65    * @deprecated 
    6672   * Saves the given BufferedImage to the current file. 
    67    * Note that this method will append the image plane to the file; it will not 
    68    * overwrite previously saved image planes. 
    69    * If this image plane is the last one in the file, the last flag must be set. 
     73   * 
     74   * @param no the image index within the current file, starting from 0. 
     75   * @param image the BufferedImage to save. 
    7076   */ 
    71   public void saveImage(BufferedImage image, boolean last) 
     77  public void saveImage(int no, BufferedImage image) 
    7278    throws FormatException, IOException 
    7379  { 
    74     saveImage(image, 0, last, last); 
     80    saveImage(no, image, 0, 0, image.getWidth(), image.getHeight()); 
    7581  } 
    7682 
    7783  /** 
    78    * @deprecated 
    79    * Saves the given BufferedImage to the given series in the current file. 
    80    * Note that this method will append the image plane to the file; it will not 
    81    * overwrite previously saved image planes. 
    82    * If this image plane is the last one in the series, the lastInSeries flag 
    83    * must be set. 
    84    * If this image plane is the last one in the file, the last flag must be set. 
     84   * Saves the given BufferedImage to the current file.  The BufferedImage 
     85   * may represent a subsection of the full image to be saved. 
     86   * 
     87   * @param no the image index within the current file, starting from 0. 
     88   * @param image the BufferedImage to save. 
     89   * @param x the X coordinate of the upper-left corner of the image. 
     90   * @param y the Y coordinate of the upper-left corner of the image. 
     91   * @param w the width (in pixels) of the image. 
     92   * @param h the height (in pixels) of the image. 
    8593   */ 
    86   public void saveImage(BufferedImage image, int series, 
    87     boolean lastInSeries, boolean last) throws FormatException, IOException 
     94  public void saveImage(int no, BufferedImage image, int x, int y, int w, int h) 
     95    throws FormatException, IOException 
    8896  { 
    8997    Class dataType = getNativeDataType(); 
    9098    if (BufferedImage.class.isAssignableFrom(dataType)) { 
    9199      // native data type is compatible with BufferedImage 
    92       savePlane(image, series, lastInSeries, last); 
     100      savePlane(no, image, x, y, w, h); 
    93101    } 
    94102    else { 
     
    100108      MetadataRetrieve r = getMetadataRetrieve(); 
    101109      if (r != null) { 
    102         Boolean bigEndian = r.getPixelsBinDataBigEndian(series, 0); 
     110        Boolean bigEndian = r.getPixelsBinDataBigEndian(getSeries(), 0); 
    103111        if (bigEndian != null) littleEndian = !bigEndian.booleanValue(); 
    104112      } 
     
    122130      pixelBytes = null; 
    123131 
    124       saveBytes(buf, series, lastInSeries, last); 
     132      saveBytes(no, buf, x, y, w, h); 
    125133    } 
    126134  } 
    127135 
     136  // -- IFormatHandler API methods -- 
     137 
     138  /* @see loci.formats.IFormatHandler#close() */ 
     139  public void close() throws IOException { 
     140    super.close(); 
     141    numWritten = 0; 
     142  } 
     143 
     144  // -- deprecated BufferedImageWriter methods -- 
     145 
     146  /** 
     147   * @deprecated Please use saveImage(int, BufferedImage) instead. 
     148   * Saves the given BufferedImage to the current file. 
     149   * Note that this method will append the image plane to the file; it will not 
     150   * overwrite previously saved image planes. 
     151   * If this image plane is the last one in the file, the last flag must be set. 
     152   */ 
     153  public void saveImage(BufferedImage image, boolean last) 
     154    throws FormatException, IOException 
     155  { 
     156    saveImage(image, 0, last, last); 
     157  } 
     158 
     159  /** 
     160   * @deprecated Please use saveImage(int, BufferedImage) instead. 
     161   * Saves the given BufferedImage to the given series in the current file. 
     162   * Note that this method will append the image plane to the file; it will not 
     163   * overwrite previously saved image planes. 
     164   * If this image plane is the last one in the series, the lastInSeries flag 
     165   * must be set. 
     166   * If this image plane is the last one in the file, the last flag must be set. 
     167   */ 
     168  public void saveImage(BufferedImage image, int series, 
     169    boolean lastInSeries, boolean last) throws FormatException, IOException 
     170  { 
     171    setSeries(series); 
     172    saveImage(numWritten++, image); 
     173  } 
     174 
    128175} 
  • branches/4.2/components/bio-formats/src/loci/formats/in

  • branches/4.2/components/bio-formats/src/loci/formats/tiff

  • branches/4.2/components/loci-plugins

  • branches/4.2/components/loci-plugins/src/loci/plugins

  • branches/4.2/components/loci-plugins/src/loci/plugins/in/Calibrator.java

  • branches/4.2/components/loci-plugins/src/loci/plugins/macro/LociFunctions.java

    r6669 r6993  
    282282  public void getMetadataValue(String field, String[] value) { 
    283283    Object o = r.getMetadataValue(field); 
     284    value[0] = o == null ? null : o.toString(); 
     285  } 
     286 
     287  public void getSeriesMetadataValue(String field, String[] value) { 
     288    Object o = r.getSeriesMetadataValue(field); 
    284289    value[0] = o == null ? null : o.toString(); 
    285290  } 
  • branches/4.2/components/ome-xml

Note: See TracChangeset for help on using the changeset viewer.