Changeset 1398


Ignore:
Timestamp:
08/31/06 13:15:26 (14 years ago)
Author:
melissa
Message:
  • fixed a bug in Zeiss LSM reader
  • added thumbnail support to OIF reader
Location:
trunk/loci/formats/in
Files:
2 edited

Legend:

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

    r1389 r1398  
    5252  protected TiffReader tiffReader; 
    5353 
     54  /** Helper reader to open the thumbnail. */ 
     55  protected BMPReader thumbReader; 
    5456 
    5557  // -- Constructor -- 
     
    175177 
    176178    return tiffReader.openImage((String) tiffs.get(no), 0); 
     179  } 
     180 
     181  /** Obtains a thumbnail for the specified image from the given file. */ 
     182  public BufferedImage openThumbImage(String id, int no) 
     183    throws FormatException, IOException 
     184  { 
     185    if (!id.equals(currentId) && !DataTools.samePrefix(id, currentId)) { 
     186      initFile(id); 
     187    } 
     188 
     189    if (no < 0 || no >= getImageCount(id)) { 
     190      throw new FormatException("Invalid image number: " + no); 
     191    } 
     192 
     193    String thumbId = id.substring(0, id.indexOf("_") + 1) + "Thumb.bmp"; 
     194    return thumbReader.openImage(thumbId, 0); 
     195  } 
     196 
     197  /** Get the size of the X dimension for the thumbnail. */ 
     198  public int getThumbSizeX(String id) throws FormatException, IOException { 
     199    return openThumbImage(id, 0).getWidth(); 
     200  } 
     201 
     202  /** Get the size of the Y dimension for the thumbnail. */ 
     203  public int getThumbSizeY(String id) throws FormatException, IOException { 
     204    return openThumbImage(id, 0).getHeight(); 
    177205  } 
    178206 
     
    242270    } 
    243271 
     272    thumbReader = new BMPReader(); 
    244273    numImages = filenames.size(); 
    245274    tiffs = new Vector(numImages); 
  • trunk/loci/formats/in/ZeissLSMReader.java

    r1397 r1398  
    135135  { 
    136136    if (!id.equals(currentId)) initFile(id); 
     137    if (no < 0 || no >= getImageCount(id)) { 
     138      throw new FormatException("Invalid image number: " + no); 
     139    } 
     140     
    137141    ifds = TiffTools.getIFDs(in); 
    138142    return TiffTools.getImage(ifds[2*no + 1], in); 
Note: See TracChangeset for help on using the changeset viewer.