Changeset 6501


Ignore:
Timestamp:
06/08/10 11:06:04 (10 years ago)
Author:
melissa
Message:

Tweaked isThisType to only pick up valid TIFF files that are in the same directory as a metadata.txt file.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2/components/bio-formats/src/loci/formats/in/MicromanagerReader.java

    r6376 r6501  
    112112      Location parent = new Location(name).getAbsoluteFile().getParentFile(); 
    113113      Location metaFile = new Location(parent, METADATA); 
    114       return metaFile.exists() && metaFile.length() > 0; 
     114      RandomAccessInputStream s = new RandomAccessInputStream(name); 
     115      boolean validTIFF = isThisType(s); 
     116      s.close(); 
     117      return metaFile.exists() && metaFile.length() > 0 && validTIFF; 
    115118    } 
    116119    catch (NullPointerException e) { } 
     120    catch (IOException e) { } 
    117121    return false; 
    118122  } 
     
    125129  /* @see loci.formats.IFormatReader#isThisType(RandomAccessInputStream) */ 
    126130  public boolean isThisType(RandomAccessInputStream stream) throws IOException { 
     131    if (tiffReader == null) tiffReader = new MinimalTiffReader(); 
    127132    return tiffReader.isThisType(stream); 
    128133  } 
  • trunk/components/bio-formats/src/loci/formats/in/MicromanagerReader.java

    r6377 r6501  
    112112      Location parent = new Location(name).getAbsoluteFile().getParentFile(); 
    113113      Location metaFile = new Location(parent, METADATA); 
    114       return metaFile.exists() && metaFile.length() > 0; 
     114      RandomAccessInputStream s = new RandomAccessInputStream(name); 
     115      boolean validTIFF = isThisType(s); 
     116      s.close(); 
     117      return metaFile.exists() && metaFile.length() > 0 && validTIFF; 
    115118    } 
    116119    catch (NullPointerException e) { } 
     120    catch (IOException e) { } 
    117121    return false; 
    118122  } 
     
    124128 
    125129  /* @see loci.formats.IFormatReader#isThisType(RandomAccessInputStream) */ 
    126   public boolean isThisType(RandomAccessInputStream stream) throws IOException { 
     130  public boolean isThisType(RandomAccessInputStream stream) throws IOException 
     131  { 
     132    if (tiffReader == null) tiffReader = new MinimalTiffReader(); 
    127133    return tiffReader.isThisType(stream); 
    128134  } 
Note: See TracChangeset for help on using the changeset viewer.