Changeset 6043


Ignore:
Timestamp:
03/18/10 16:47:12 (10 years ago)
Author:
melissa
Message:
  • Better plate name detection.
  • Well labelling fixes from Bram Gerritsen.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats/src/loci/formats/in/BDReader.java

    r6031 r6043  
    2828import java.util.*; 
    2929 
    30 import loci.common.DataTools; 
    3130import loci.common.Location; 
    3231import loci.common.RandomAccessInputStream; 
    3332import loci.common.IniList; 
    3433import loci.common.IniParser; 
    35 import loci.common.xml.XMLTools; 
     34import loci.common.IniTable; 
    3635import loci.formats.CoreMetadata; 
    3736import loci.formats.FormatException; 
     
    6362  private Vector<String> channelNames = new Vector<String>(); 
    6463  private Vector<String> wellLabels = new Vector<String>(); 
    65   private String plateName; 
     64  private String plateName, plateDescription; 
    6665  private String[] tiffs; 
    6766  private MinimalTiffReader reader; 
     
    134133      tiffs = null; 
    135134      plateName = null; 
     135      plateDescription = null; 
    136136      channelNames.clear(); 
    137137      metadataFiles.clear(); 
     
    173173        plate = (new IniParser()).parseINI( 
    174174          new BufferedReader(new FileReader(filename))); 
    175         break; 
     175      } 
     176      else if (filename.endsWith("RoiSummary.txt")) { 
     177        RandomAccessInputStream s = new RandomAccessInputStream(filename); 
     178        String line = s.readLine().trim(); 
     179        while (!line.endsWith(".adf\"")) { 
     180          line = s.readLine().trim(); 
     181        } 
     182        plateName = line.substring(line.indexOf(":")).trim(); 
     183        plateName = plateName.replace('/', File.separatorChar); 
     184        plateName = plateName.replace('\\', File.separatorChar); 
     185        for (int i=0; i<3; i++) { 
     186          plateName = 
     187            plateName.substring(0, plateName.lastIndexOf(File.separator)); 
     188        } 
     189        plateName = 
     190          plateName.substring(plateName.lastIndexOf(File.separator) + 1); 
     191 
     192        s.close(); 
    176193      } 
    177194    } 
    178195    if (plate == null) throw new IOException("No Plate File"); 
    179196 
    180     plateName = plate.getTable("PlateType").get("Brand"); 
     197    IniTable plateType = plate.getTable("PlateType"); 
     198 
     199    if (plateName == null) { 
     200      plateName = plateType.get("Brand"); 
     201    } 
     202    plateDescription = 
     203      plateType.get("Brand") + " " + plateType.get("Description"); 
    181204 
    182205    Location dir = new Location(id).getAbsoluteFile().getParentFile(); 
     
    244267    for (String well : wellLabels) { 
    245268      String row = well.substring(0, 1).trim(); 
    246       String column = well.substring(1, 3).trim(); 
     269      String column = well.substring(1).trim(); 
    247270 
    248271      if (!uniqueRows.contains(row) && row.length() > 0) uniqueRows.add(row); 
     
    305328    store.setPlateColumnNamingConvention("01", 0); 
    306329    store.setPlateName(plateName, 0); 
     330    store.setPlateDescription(plateDescription, 0); 
    307331 
    308332    for (int i=0; i<getSeriesCount(); i++) { 
     
    311335      String name = wellLabels.get(i); 
    312336      String row = name.substring(0, 1); 
    313       Integer col = Integer.parseInt(name.substring(1, 3)); 
     337      Integer col = Integer.parseInt(name.substring(1)); 
    314338 
    315339      store.setWellColumn(col, 0, i); 
Note: See TracChangeset for help on using the changeset viewer.