Changeset 3180


Ignore:
Timestamp:
09/19/07 13:33:45 (12 years ago)
Author:
melissa
Message:

Added indexed color -> RGB option to ImageInfo; modified ImageTools.makeBuffered to be a little faster.

Location:
trunk/loci/formats
Files:
2 edited

Legend:

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

    r3178 r3180  
    19111911  public static BufferedImage makeBuffered(Image image) { 
    19121912    if (image instanceof BufferedImage) return (BufferedImage) image; 
     1913 
    19131914    // TODO: better way to handle color model (don't just assume RGB) 
    19141915    loadImage(image); 
    1915     int w = image.getWidth(OBS), h = image.getHeight(OBS); 
    1916     int[] pixels = new int[w * h]; 
    1917     PixelGrabber pg = new PixelGrabber(image, 0, 0, w, h, pixels, 0, w); 
    1918     try { pg.grabPixels(); } 
    1919     catch (InterruptedException exc) { LogTools.trace(exc); } 
    1920     BufferedImage result = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); 
    1921     result.setRGB(0, 0, w, h, pixels, 0, w); 
    1922     return result; 
    1923     //return makeBuffered(image, makeColorModel(3, DataBuffer.TYPE_INT)); 
     1916    BufferedImage img = new BufferedImage(image.getWidth(OBS), 
     1917      image.getHeight(OBS), BufferedImage.TYPE_INT_RGB); 
     1918    Graphics g = img.getGraphics(); 
     1919    g.drawImage(image, 0, 0, OBS); 
     1920    g.dispose(); 
     1921    return img; 
    19241922  } 
    19251923 
  • trunk/loci/formats/tools/ImageInfo.java

    r3143 r3180  
    6262    boolean stitch = false; 
    6363    boolean separate = false; 
     64    boolean expand = false; 
    6465    boolean omexml = false; 
    6566    boolean normalize = false; 
     
    8081          else if (args[i].equals("-stitch")) stitch = true; 
    8182          else if (args[i].equals("-separate")) separate = true; 
     83          else if (args[i].equals("-expand")) expand = true; 
    8284          else if (args[i].equals("-omexml")) omexml = true; 
    8385          else if (args[i].equals("-normalize")) normalize = true; 
     
    136138        "   -stitch: stitch files with similar names", 
    137139        " -separate: split RGB image into separate channels", 
     140        "   -expand: expand indexed color to RGB", 
    138141        "   -omexml: populate OME-XML metadata", 
    139142        "-normalize: normalize floating point images*", 
     
    179182    if (separate) reader = new ChannelSeparator(reader); 
    180183    if (merge) reader = new ChannelMerger(reader); 
     184    if (expand) reader = new ChannelFiller(reader); 
    181185    MinMaxCalculator minMaxCalc = null; 
    182186    if (minmax) reader = minMaxCalc = new MinMaxCalculator(reader); 
Note: See TracChangeset for help on using the changeset viewer.