Changeset 3308


Ignore:
Timestamp:
10/25/07 07:47:39 (12 years ago)
Author:
melissa
Message:

Implemented openBytes(int).

File:
1 edited

Legend:

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

    r3253 r3308  
    129129  } 
    130130 
    131   /* @see IFormatReader#openBytes(int) */ 
    132   public byte[] openBytes(int no) throws FormatException, IOException { 
     131  /* @see IFormatReader#openBytes(int, byte[]) */ 
     132  public byte[] openBytes(int no, byte[] buf) 
     133    throws FormatException, IOException 
     134  { 
    133135    FormatTools.assertId(getCurrentFile(), true, 2); 
    134136    FormatTools.checkPlaneNumber(this, no); 
     
    146148      } 
    147149 
    148       return ImageTools.splitChannels(lastImage, c, 
     150      byte[] t = ImageTools.splitChannels(lastImage, c, 
    149151        FormatTools.getBytesPerPixel(getPixelType()), 
    150152        false, !isInterleaved())[channel]; 
     153      System.arraycopy(t, 0, buf, 0, t.length); 
     154      return buf; 
    151155    } 
    152     else return reader.openBytes(no); 
     156    else return reader.openBytes(no, buf); 
     157  } 
     158 
     159  /* @see IFormatReader#openBytes(int) */ 
     160  public byte[] openBytes(int no) throws FormatException, IOException { 
     161    FormatTools.assertId(getCurrentFile(), true, 2); 
     162    FormatTools.checkPlaneNumber(this, no); 
     163    byte[] buf = new byte[getSizeX() * getSizeY() * getRGBChannelCount() * 
     164      FormatTools.getBytesPerPixel(getPixelType())]; 
     165    return openBytes(no, buf); 
    153166  } 
    154167 
Note: See TracChangeset for help on using the changeset viewer.