Changeset 1788


Ignore:
Timestamp:
11/13/06 17:14:36 (13 years ago)
Author:
curtis
Message:

Use ID map to find file patterns within file stitcher when appropriate.

File:
1 edited

Legend:

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

    r1786 r1788  
    454454    currentId = id; 
    455455    if (!patternIds) { 
    456       // id is a file path; find the containing pattern 
    457       id = FilePattern.findPattern(new File(id)); 
     456      // find the containing pattern 
     457      Hashtable map = getIdMap(); 
     458      if (map.containsKey(id)) { 
     459        // search ID map for pattern, rather than files on disk 
     460        String[] idList = new String[map.size()]; 
     461        Enumeration en = map.keys(); 
     462        for (int i=0; i<idList.length; i++) { 
     463          idList[i] = (String) en.nextElement(); 
     464        } 
     465        id = FilePattern.findPattern(id, null, idList); 
     466      } 
     467      else { 
     468        // id is an unmapped file path; look to similar files on disk 
     469        id = FilePattern.findPattern(new File(id)); // id == getMapped(id) 
     470      } 
    458471    } 
    459472    fp = new FilePattern(id); 
     
    472485    } 
    473486    for (int i=0; i<files.length; i++) { 
    474       if (!new File(files[i]).exists()) { 
     487      if (!new File(getMappedId(files[i])).exists()) { 
    475488        throw new FormatException("File #" + i + 
    476489          " (" + files[i] + ") does not exist."); 
     
    697710  } 
    698711 
     712  // -- Main method -- 
     713 
     714  public static void main(String[] args) throws FormatException, IOException { 
     715    if (!new FileStitcher().testRead(args)) System.exit(1); 
     716  } 
     717 
     718 
    699719} 
Note: See TracChangeset for help on using the changeset viewer.