Changeset 7370


Ignore:
Timestamp:
12/08/10 20:30:22 (9 years ago)
Author:
melissa
Message:

Some polishing in ScreenReader.

Wells are now sorted correctly and SPW metadata is populated in the same way that other HCS readers populate it.

File:
1 edited

Legend:

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

    r7333 r7370  
    2727import java.io.IOException; 
    2828import java.util.Arrays; 
     29import java.util.Comparator; 
    2930import java.util.Vector; 
    3031 
     
    174175    String[][] files = new String[plates.length][]; 
    175176    plateMaps = new boolean[plates.length][][]; 
     177 
     178    Comparator<String> c = new Comparator<String>() { 
     179      public int compare(String s1, String s2) { 
     180        int row1 = (int) (getRow(s1).charAt(0) - 'A'); 
     181        int row2 = (int) (getRow(s2).charAt(0) - 'A'); 
     182 
     183        if (row1 != row2) { 
     184          return row1 - row2; 
     185        } 
     186 
     187        int col1 = Integer.parseInt(getColumn(s1)) - 1; 
     188        int col2 = Integer.parseInt(getColumn(s2)) - 1; 
     189        return col1 - col2; 
     190      } 
     191    }; 
    176192 
    177193    // build the list of well files for each plate 
     
    197213      } 
    198214      files[plate] = tmpWells.toArray(new String[tmpWells.size()]); 
    199       Arrays.sort(files[plate]); 
     215 
     216      Arrays.sort(files[plate], c); 
    200217      readers[plate] = new ImageReader[files[plate].length]; 
    201218      coreLength += files[plate].length; 
     
    238255      store.setPlateID(plateID, plate); 
    239256      store.setScreenPlateRef(plateID, 0, plate); 
    240       store.setPlateScreenRef(screenID, plate, 0); 
    241257 
    242258      store.setPlateName(new Location(plates[plate]).getName(), plate); 
     
    247263      store.setPlateColumnNamingConvention(NamingConvention.NUMBER, plate); 
    248264 
    249       for (int well=0; well<files[plate].length; well++) { 
    250         int seriesIndex = getSeriesIndex(plate, well); 
    251  
    252         int[] rowAndColumn = getRowAndColumn(plate, well); 
    253         String wellID = MetadataTools.createLSID("Well", plate, well); 
    254         store.setWellID(wellID, plate, well); 
    255         store.setWellColumn( 
    256           new NonNegativeInteger(rowAndColumn[1]), plate, well); 
    257         store.setWellRow(new NonNegativeInteger(rowAndColumn[0]), plate, well); 
    258  
    259         String imageID = MetadataTools.createLSID("Image", seriesIndex); 
    260         String wellSampleID = 
    261           MetadataTools.createLSID("WellSample", plate, well, 0); 
    262         store.setWellSampleID(wellSampleID, plate, well, 0); 
    263         store.setWellSampleImageRef(imageID, plate, well, 0); 
    264         store.setWellSampleIndex( 
    265           new NonNegativeInteger(seriesIndex), plate, well, 0); 
     265      int realWell = 0; 
     266      for (int row=0; row<plateMaps[plate].length; row++) { 
     267        for (int col=0; col<plateMaps[plate][row].length; col++) { 
     268          int well = row * plateMaps[plate][row].length + col; 
     269          String wellID = MetadataTools.createLSID("Well", plate, well); 
     270          store.setWellID(wellID, plate, well); 
     271          store.setWellColumn(new NonNegativeInteger(row), plate, well); 
     272          store.setWellRow(new NonNegativeInteger(col), plate, well); 
     273 
     274          if (plateMaps[plate][row][col]) { 
     275            int seriesIndex = getSeriesIndex(plate, realWell); 
     276            String imageID = MetadataTools.createLSID("Image", seriesIndex); 
     277            store.setImageID(imageID, seriesIndex); 
     278            store.setImageName("Well " + ((char) (row + 'A')) + (col + 1), 
     279              seriesIndex); 
     280            String wellSampleID = 
     281              MetadataTools.createLSID("WellSample", plate, well, 0); 
     282            store.setWellSampleID(wellSampleID, plate, well, 0); 
     283            store.setWellSampleImageRef(imageID, plate, well, 0); 
     284            store.setWellSampleIndex( 
     285              new NonNegativeInteger(seriesIndex), plate, well, 0); 
     286            realWell++; 
     287          } 
     288        } 
    266289      } 
    267290    } 
Note: See TracChangeset for help on using the changeset viewer.