Changeset 2385


Ignore:
Timestamp:
03/06/07 08:39:33 (13 years ago)
Author:
melissa
Message:

Copied blank image logic to openThumbImage and openThumbBytes.

File:
1 edited

Legend:

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

    r2382 r2385  
    7373  /** Blank image bytes, for use when image counts vary between files. */ 
    7474  private byte[][] blankBytes; 
     75 
     76  /** Blank buffered thumbnail, for use when image counts vary between files. */ 
     77  private BufferedImage[] blankThumb; 
     78 
     79  /** Blank thumbnail bytes, for use when image counts vary between files. */ 
     80  private byte[][] blankThumbBytes; 
    7581 
    7682  /** Image dimensions. */ 
     
    455461      int bytes = FormatReader.getBytesPerPixel(getPixelType(currentId)); 
    456462      blankBytes[sno] = new byte[width[sno] * height[sno] * 
    457         bytes * (isRGB(id) ? sizeC[sno] : 1)]; 
     463        bytes * getRGBChannelCount(id)]; 
    458464    } 
    459465    return blankBytes[sno]; 
     
    475481    int[] q = computeIndices(id, no); 
    476482    int fno = q[0], ino = q[1]; 
    477     return readers[fno].openThumbImage(files[fno], ino); 
     483    if (ino < readers[fno].getImageCount(files[fno])) { 
     484      return readers[fno].openThumbImage(files[fno], ino); 
     485    } 
     486    // return a blank image to cover for the fact that 
     487    // this file does not contain enough image planes 
     488    int sno = getSeries(id); 
     489    if (blankThumb[sno] == null) { 
     490      blankThumb[sno] = ImageTools.blankImage(getThumbSizeX(id),  
     491        getThumbSizeY(id), sizeC[sno], FormatReader.UINT8); 
     492    } 
     493    return blankThumb[sno];  
    478494  } 
    479495 
     
    484500    int[] q = computeIndices(id, no); 
    485501    int fno = q[0], ino = q[1]; 
    486     return readers[fno].openThumbBytes(files[fno], ino); 
     502    if (ino < readers[fno].getImageCount(files[fno])) { 
     503      return readers[fno].openThumbBytes(files[fno], ino); 
     504    } 
     505    // return a blank image to cover for the fact that  
     506    // this file does not contain enough image planes 
     507    int sno = getSeries(id); 
     508    if (blankThumbBytes[sno] == null) { 
     509      blankThumbBytes[sno] = new byte[getThumbSizeX(id) * getThumbSizeY(id) * 
     510        getRGBChannelCount(id)]; 
     511    } 
     512    return blankThumbBytes[sno]; 
    487513  } 
    488514 
     
    766792    blankImage = new BufferedImage[seriesCount]; 
    767793    blankBytes = new byte[seriesCount][]; 
     794    blankThumb = new BufferedImage[seriesCount]; 
     795    blankThumbBytes = new byte[seriesCount][]; 
    768796    width = new int[seriesCount]; 
    769797    height = new int[seriesCount]; 
Note: See TracChangeset for help on using the changeset viewer.