Changeset 3251


Ignore:
Timestamp:
10/10/07 10:52:02 (12 years ago)
Author:
melissa
Message:

Added default saveBytes implementations. To use saveBytes, a MetadataRetrieve object must be specified.

File:
1 edited

Legend:

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

    r3164 r3251  
    2626 
    2727import java.awt.Image; 
    28 import java.awt.image.ColorModel; 
     28import java.awt.image.*; 
    2929import java.io.IOException; 
    3030 
     
    8080    throws FormatException, IOException 
    8181  { 
    82     throw new FormatException("Not implemented yet."); 
     82    saveBytes(bytes, 0, last, last); 
    8383  } 
    8484 
     
    8787    boolean last) throws FormatException, IOException 
    8888  { 
    89     throw new FormatException("Not implemented yet."); 
     89    FormatTools.assertId(currentId, true, 1); 
     90    MetadataRetrieve r = getMetadataRetrieve(); 
     91    if (r == null) throw new FormatException("MetadataRetrieve cannot be null"); 
     92    Integer ss = new Integer(series); 
     93    int width = r.getSizeX(ss).intValue(); 
     94    int height = r.getSizeY(ss).intValue(); 
     95    int channels = r.getSizeC(ss).intValue(); 
     96    int type = FormatTools.pixelTypeFromString(r.getPixelType(ss)); 
     97    boolean littleEndian = !r.getBigEndian(ss).booleanValue(); 
     98 
     99    BufferedImage img = ImageTools.makeImage(bytes, width, height, channels, 
     100      true, FormatTools.getBytesPerPixel(type), littleEndian); 
     101    saveImage(img, series, lastInSeries, last); 
    90102  } 
    91103 
Note: See TracChangeset for help on using the changeset viewer.