Changeset 3968


Ignore:
Timestamp:
04/23/08 08:01:00 (12 years ago)
Author:
melissa
Message:

Fixed ArrayIndexOutOfBounds.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/in/FV1000Reader.java

    r3936 r3968  
    467467      } 
    468468      previewNames = v; 
    469       String previewName = (String) previewNames.get(0); 
    470       core = new CoreMetadata(2); 
    471       Hashtable[] ifds = TiffTools.getIFDs(getFile(previewName)); 
    472       core.imageCount[1] = ifds.length * previewNames.size(); 
    473       core.sizeX[1] = (int) TiffTools.getImageWidth(ifds[0]); 
    474       core.sizeY[1] = (int) TiffTools.getImageLength(ifds[0]); 
    475       core.sizeZ[1] = 1; 
    476       core.sizeT[1] = 1; 
    477       core.sizeC[1] = core.imageCount[1]; 
    478       core.rgb[1] = false; 
    479       int bits = TiffTools.getBitsPerSample(ifds[0])[0]; 
    480       while ((bits % 8) != 0) bits++; 
    481       switch (bits) { 
    482         case 8: 
    483           core.pixelType[1] = FormatTools.UINT8; 
    484           break; 
    485         case 16: 
    486           core.pixelType[1] = FormatTools.UINT16; 
    487           break; 
    488         case 32: 
    489           core.pixelType[1] = FormatTools.UINT32; 
    490       } 
    491       core.currentOrder[1] = "XYCZT"; 
    492       core.indexed[1] = false; 
     469      if (previewNames.size() > 0) { 
     470        String previewName = (String) previewNames.get(0); 
     471        core = new CoreMetadata(2); 
     472        Hashtable[] ifds = TiffTools.getIFDs(getFile(previewName)); 
     473        core.imageCount[1] = ifds.length * previewNames.size(); 
     474        core.sizeX[1] = (int) TiffTools.getImageWidth(ifds[0]); 
     475        core.sizeY[1] = (int) TiffTools.getImageLength(ifds[0]); 
     476        core.sizeZ[1] = 1; 
     477        core.sizeT[1] = 1; 
     478        core.sizeC[1] = core.imageCount[1]; 
     479        core.rgb[1] = false; 
     480        int bits = TiffTools.getBitsPerSample(ifds[0])[0]; 
     481        while ((bits % 8) != 0) bits++; 
     482        switch (bits) { 
     483          case 8: 
     484            core.pixelType[1] = FormatTools.UINT8; 
     485            break; 
     486          case 16: 
     487            core.pixelType[1] = FormatTools.UINT16; 
     488            break; 
     489          case 32: 
     490            core.pixelType[1] = FormatTools.UINT32; 
     491        } 
     492        core.currentOrder[1] = "XYCZT"; 
     493        core.indexed[1] = false; 
     494      } 
    493495    } 
    494496 
Note: See TracChangeset for help on using the changeset viewer.