Changeset 2737


Ignore:
Timestamp:
05/03/07 14:55:23 (13 years ago)
Author:
melissa
Message:

Preliminary support for .nd companion files.

File:
1 edited

Legend:

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

    r2687 r2737  
    2525package loci.formats.in; 
    2626 
    27 import java.io.IOException; 
     27import java.io.*; 
    2828import java.text.DecimalFormat; 
    2929import java.util.Hashtable; 
    3030import java.util.StringTokenizer; 
    31 import loci.formats.DataTools; 
    32 import loci.formats.FormatException; 
    33 import loci.formats.TiffIFDEntry; 
    34 import loci.formats.TiffRational; 
    35 import loci.formats.TiffTools; 
     31import loci.formats.*; 
    3632 
    3733/** 
     
    282278      if (debug) exc.printStackTrace(); 
    283279    } 
     280  
     281    Location abs = new Location(currentId).getAbsoluteFile(); 
     282    String absPath = abs.getPath().substring(abs.getPath().lastIndexOf(File.separator));  
     283    Location ndfile = new Location(abs.getParent(),  
     284      absPath.substring(0, absPath.indexOf("_")) + ".nd"); 
     285    if (!ndfile.exists()) { 
     286      /* debug */ System.out.println(ndfile.getAbsolutePath() + " DOES NOT EXIST"); 
     287      ndfile = new Location(ndfile.getAbsolutePath().replaceAll(".nd", ".ND")); 
     288    } 
     289 
     290    RandomAccessStream ndStream =  
     291      new RandomAccessStream(ndfile.getAbsolutePath()); 
     292    String line = ndStream.readLine().trim(); 
     293 
     294    while (!line.equals("\"EndFile\"")) { 
     295      String key = line.substring(1, line.indexOf(",") - 1).trim(); 
     296      String value = line.substring(line.indexOf(",") + 1).trim(); 
     297      
     298      addMeta(key, value); 
     299       
     300      line = ndStream.readLine().trim();  
     301    } 
     302 
    284303  } 
    285304 
Note: See TracChangeset for help on using the changeset viewer.