Changeset 5099


Ignore:
Timestamp:
05/11/09 10:48:31 (11 years ago)
Author:
melissa
Message:

Fixed tile row/column calculation and ArrayIndexOutOfBoundsException in lookup table retrieval.

File:
1 edited

Legend:

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

    r5093 r5099  
    141141    } 
    142142    byte[][] lut = new byte[3][256]; 
    143     int color = channelColors[getZCTCoords(lastPlane)[1]]; 
     143    int channel = getZCTCoords(lastPlane)[1]; 
     144    if (channel >= channelColors.length) return null; 
     145    int color = channelColors[channel]; 
    144146 
    145147    float red = (color & 0xff) / 255f; 
     
    165167    } 
    166168    short[][] lut = new short[3][65536]; 
    167     int color = channelColors[getZCTCoords(lastPlane)[1]]; 
     169    int channel = getZCTCoords(lastPlane)[1]; 
     170    if (channel >= channelColors.length) return null; 
     171    int color = channelColors[channel]; 
    168172 
    169173    float red = (color & 0xff) / 255f; 
     
    503507    int totalTiles = offsets.length / getImageCount(); 
    504508 
    505     tileRows = (realHeight / getSizeY()) + 1; 
    506     tileColumns = (realWidth / getSizeX()) + 1; 
     509    tileRows = realHeight / getSizeY(); 
     510    tileColumns = realWidth / getSizeX(); 
     511 
     512    if (getSizeY() * tileRows != realHeight) tileRows++; 
     513    if (getSizeX() * tileColumns != realWidth) tileColumns++; 
    507514 
    508515    while (totalTiles < tileRows * tileColumns && tileRows > 1) { 
    509516      tileRows--; 
    510517    } 
    511     tileColumns = totalTiles / tileRows; 
     518    if (tileRows > 0) tileColumns = totalTiles / tileRows; 
    512519 
    513520    if (totalTiles <= 1) { 
Note: See TracChangeset for help on using the changeset viewer.