Changeset 6731


Ignore:
Timestamp:
07/26/10 13:59:19 (9 years ago)
Author:
curtis
Message:

Stop using BufferedImageReader, for faster plane extraction.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats/utils/bfopen.m

    r6725 r6731  
    4343r = loci.formats.ChannelFiller(); 
    4444r = loci.formats.ChannelSeparator(r); 
    45 r = loci.formats.gui.BufferedImageReader(r); 
    4645 
    4746% uncomment the following line to enable grouping of similarly 
     
    5958    h = r.getSizeY(); 
    6059    shape = [w h]; 
     60    pixelType = r.getPixelType(); 
     61    bpp = loci.formats.FormatTools.getBytesPerPixel(pixelType); 
     62    fp = loci.formats.FormatTools.isFloatingPoint(pixelType); 
     63    little = r.isLittleEndian(); 
    6164    numImages = r.getImageCount(); 
    6265    imageList = cell(numImages, 2); 
     
    6467    for i = 1:numImages 
    6568        fprintf('.'); 
    66         img = r.openImage(i - 1); 
     69        plane = r.openBytes(i - 1); 
    6770 
    6871        % retrieve color map data 
     
    8689        colorMaps{s, i} = newMap; 
    8790 
    88         % convert Java BufferedImage to MATLAB image 
    89         pix = img.getData.getPixels(0, 0, w, h, []); 
    90  
    91         % TODO: determine how best to retrieve pixel data 
    92         % Retrieving pixels through the data buffer is faster for large 
    93         % images, but does not handle signed/unsigned type casting. 
    94         %pix = img.getData.getDataBuffer().getData(); 
     91        % convert byte array to MATLAB image 
     92        pix = loci.common.DataTools.makeDataArray(plane, bpp, fp, little); 
    9593        arr = reshape(pix, shape)'; 
    9694        % build an informative title for our figure 
Note: See TracChangeset for help on using the changeset viewer.