Changeset 6443


Ignore:
Timestamp:
06/02/10 12:36:38 (9 years ago)
Author:
curtis
Message:

Fix TextReader.openBytes to work properly.

File:
1 edited

Legend:

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

    r6407 r6443  
    7373   */ 
    7474  private float[][] data; 
    75    
     75 
    7676  /** Current row number. */ 
    7777  private int row; 
     
    117117    throws FormatException, IOException 
    118118  { 
    119     FormatTools.assertId(currentId, true, 1); 
    120     return DataTools.floatsToBytes(data[no], LITTLE_ENDIAN); 
     119    FormatTools.checkPlaneParameters(this, no, buf.length, x, y, w, h); 
     120 
     121    // copy floating point data into byte buffer 
     122    final float[] plane = data[no]; 
     123    int q = 0; 
     124    for (int j=0; j<h; j++) { 
     125      final int yy = y + j; 
     126      for (int i=x; i<w; i++) { 
     127        final int xx = x + i; 
     128        final int index = yy * sizeX + xx; 
     129        final int bits = Float.floatToIntBits(plane[index]); 
     130        DataTools.unpackBytes(bits, buf, q, 4, LITTLE_ENDIAN); 
     131        q += 4; 
     132      } 
     133    } 
     134 
     135    return buf; 
    121136  } 
    122137 
     
    156171  protected void initFile(String id) throws FormatException, IOException { 
    157172    super.initFile(id); 
    158      
     173 
    159174    // read file into memory 
    160175    LOGGER.info("Reading file"); 
Note: See TracChangeset for help on using the changeset viewer.