Changeset 3342


Ignore:
Timestamp:
11/05/07 11:25:10 (12 years ago)
Author:
melissa
Message:

Giving lse.xml file to BioRadReader will now open entire dataset.

File:
1 edited

Legend:

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

    r3338 r3342  
    7575 
    7676  /** Constructs a new BioRadReader. */ 
    77   public BioRadReader() { super("Bio-Rad PIC", "pic"); } 
     77  public BioRadReader() { super("Bio-Rad PIC", new String[] {"pic", "xml"}); } 
    7878 
    7979  // -- IFormatReader API methods -- 
     
    117117  // -- IFormatHandler API methods -- 
    118118 
     119  /* @see loci.formats.IFormatHandler#isThisType(String, boolean) */ 
     120  public boolean isThisType(String name, boolean open) { 
     121    String lname = name.toLowerCase(); 
     122    if (lname.endsWith(".pic") || lname.endsWith("lse.xml")) return true; 
     123    return false; 
     124  } 
     125 
    119126  /* @see loci.formats.IFormatHandler#close() */ 
    120127  public void close() throws IOException { 
     
    130137  protected void initFile(String id) throws FormatException, IOException { 
    131138    if (debug) debug("BioRadReader.initFile(" + id + ")"); 
     139 
     140    if (id.toLowerCase().endsWith(".xml")) { 
     141      Location l = new Location(id).getAbsoluteFile().getParentFile(); 
     142      String[] list = l.list(); 
     143      for (int i=0; i<list.length; i++) { 
     144        if (list[i].toLowerCase().endsWith(".pic")) { 
     145          id = new Location(l.getAbsolutePath(), list[i]).getAbsolutePath(); 
     146        } 
     147      } 
     148      if (id.toLowerCase().endsWith(".xml")) { 
     149        throw new FormatException("No .pic files found - invalid dataset."); 
     150      } 
     151    } 
     152 
    132153    super.initFile(id); 
    133154    in = new RandomAccessStream(id); 
Note: See TracChangeset for help on using the changeset viewer.