Changeset 2703


Ignore:
Timestamp:
04/30/07 09:26:47 (13 years ago)
Author:
melissa
Message:

Fixed to handle files with different image counts.

File:
1 edited

Legend:

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

    r2701 r2703  
    342342  public BufferedImage openImage(int no) throws FormatException, IOException { 
    343343    FormatTools.assertId(currentId, true, 2); 
    344     int[] q = computeIndices(no); 
    345     int fno = q[0], ino = q[1]; 
    346     if (ino < readers[fno].getImageCount()) { 
    347       return readers[fno].openImage(ino); 
    348     } 
     344    try {  
     345      int[] q = computeIndices(no); 
     346      int fno = q[0], ino = q[1]; 
     347      if (ino < readers[fno].getImageCount()) { 
     348        return readers[fno].openImage(ino); 
     349      } 
     350    } 
     351    catch (FormatException e) { 
     352      if (FormatHandler.debug) e.printStackTrace();  
     353    } 
     354 
    349355    // return a blank image to cover for the fact that 
    350356    // this file does not contain enough image planes 
     
    354360        sizeC[sno], getPixelType()); 
    355361    } 
     362     
    356363    return blankImage[sno]; 
    357364  } 
     
    360367  public byte[] openBytes(int no) throws FormatException, IOException { 
    361368    FormatTools.assertId(currentId, true, 2); 
    362     int[] q = computeIndices(no); 
    363     int fno = q[0], ino = q[1]; 
    364     if (ino < readers[fno].getImageCount()) { 
    365       return readers[fno].openBytes(ino); 
    366     } 
     369    try {  
     370      int[] q = computeIndices(no); 
     371      int fno = q[0], ino = q[1]; 
     372      if (ino < readers[fno].getImageCount()) { 
     373        return readers[fno].openBytes(ino); 
     374      } 
     375    } 
     376    catch (FormatException e) { 
     377      if (FormatHandler.debug) e.printStackTrace(); 
     378    } 
     379 
    367380    // return a blank image to cover for the fact that 
    368381    // this file does not contain enough image planes 
     
    381394  { 
    382395    FormatTools.assertId(currentId, true, 2); 
    383     int[] q = computeIndices(no); 
    384     int fno = q[0], ino = q[1]; 
    385     return readers[fno].openBytes(ino, buf); 
     396    try {  
     397      int[] q = computeIndices(no); 
     398      int fno = q[0], ino = q[1]; 
     399      return readers[fno].openBytes(ino, buf); 
     400    } 
     401    catch (FormatException e) { 
     402      if (FormatHandler.debug) e.printStackTrace(); 
     403    } 
     404    return buf; 
    386405  } 
    387406 
     
    391410  { 
    392411    FormatTools.assertId(currentId, true, 2); 
    393     int[] q = computeIndices(no); 
    394     int fno = q[0], ino = q[1]; 
    395     if (ino < readers[fno].getImageCount()) { 
    396       return readers[fno].openThumbImage(ino); 
    397     } 
     412    try {  
     413      int[] q = computeIndices(no); 
     414      int fno = q[0], ino = q[1]; 
     415      if (ino < readers[fno].getImageCount()) { 
     416        return readers[fno].openThumbImage(ino); 
     417      } 
     418    } 
     419    catch (FormatException e) { 
     420      if (FormatHandler.debug) e.printStackTrace(); 
     421    } 
     422 
    398423    // return a blank image to cover for the fact that 
    399424    // this file does not contain enough image planes 
     
    409434  public byte[] openThumbBytes(int no) throws FormatException, IOException { 
    410435    FormatTools.assertId(currentId, true, 2); 
    411     int[] q = computeIndices(no); 
    412     int fno = q[0], ino = q[1]; 
    413     if (ino < readers[fno].getImageCount()) { 
    414       return readers[fno].openThumbBytes(ino); 
     436    try {  
     437      int[] q = computeIndices(no); 
     438      int fno = q[0], ino = q[1]; 
     439      if (ino < readers[fno].getImageCount()) { 
     440        return readers[fno].openThumbBytes(ino); 
     441      } 
     442    } 
     443    catch (FormatException e) { 
     444      if (FormatHandler.debug) e.printStackTrace(); 
    415445    } 
    416446    // return a blank image to cover for the fact that 
Note: See TracChangeset for help on using the changeset viewer.