Ignore:
Timestamp:
05/24/10 20:56:37 (10 years ago)
Author:
melissa
Message:

Updated Deltavision and Flex readers to use ome.xml.r201004.enums.handlers.* instead of directly creating enumerations.

Location:
branches/4.2/components/bio-formats/src/loci/formats/in
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2/components/bio-formats/src/loci/formats/in/DeltavisionReader.java

    r6315 r6370  
    3838import loci.formats.meta.MetadataStore; 
    3939 
    40 import ome.xml.r201004.enums.Binning; 
    41 import ome.xml.r201004.enums.Correction; 
    42 import ome.xml.r201004.enums.DetectorType; 
    43 import ome.xml.r201004.enums.EnumerationException; 
    44 import ome.xml.r201004.enums.Immersion; 
    4540import ome.xml.r201004.primitives.PositiveInteger; 
    4641 
     
    758753 
    759754  /** Extract metadata from associated log file, if it exists. */ 
    760   private boolean parseLogFile(MetadataStore store) throws IOException { 
     755  private boolean parseLogFile(MetadataStore store) 
     756    throws FormatException, IOException 
     757  { 
    761758    if (logFile == null || !new Location(logFile).exists()) { 
    762759      logFile = null; 
     
    820817            } 
    821818            if (tokens.length >= 2) { 
    822               try { 
    823                 store.setObjectiveCorrection( 
    824                   Correction.fromString(tokens[1]), 0, 0); 
    825               } 
    826               catch (EnumerationException e) { } 
     819              store.setObjectiveCorrection(getCorrection(tokens[1]), 0, 0); 
    827820            } 
    828821            // TODO:  Token #2 is the microscope model name. 
     
    837830          store.setObjectiveID(objectiveID, 0, 0); 
    838831          store.setImageObjectiveSettingsID(objectiveID, 0); 
    839           store.setObjectiveCorrection(Correction.OTHER, 0, 0); 
    840           store.setObjectiveImmersion(Immersion.OTHER, 0, 0); 
     832          store.setObjectiveCorrection(getCorrection("Other"), 0, 0); 
     833          store.setObjectiveImmersion(getImmersion("Other"), 0, 0); 
    841834        } 
    842835        // Image properties 
     
    859852        } 
    860853        else if (key.equals("Binning")) { 
    861           store.setDetectorType(DetectorType.OTHER, 0, 0); 
     854          store.setDetectorType(getDetectorType("Other"), 0, 0); 
    862855          String detectorID = MetadataTools.createLSID("Detector", 0, 0); 
    863856          store.setDetectorID(detectorID, 0, 0); 
    864857          for (int c=0; c<getSizeC(); c++) { 
    865             try { 
    866               store.setDetectorSettingsBinning(Binning.fromString(value), 0, c); 
    867             } 
    868             catch (EnumerationException e) { } 
     858            store.setDetectorSettingsBinning(getBinning(value), 0, c); 
    869859            // link DetectorSettings to an actual Detector 
    870860            store.setDetectorSettingsID(detectorID, 0, c); 
  • branches/4.2/components/bio-formats/src/loci/formats/in/FlexReader.java

    r6352 r6370  
    4747import loci.formats.tiff.TiffParser; 
    4848 
    49  
    50 import ome.xml.r201004.enums.Binning; 
    51 import ome.xml.r201004.enums.Correction; 
    52 import ome.xml.r201004.enums.DetectorType; 
    53 import ome.xml.r201004.enums.EnumerationException; 
    54 import ome.xml.r201004.enums.Immersion; 
    55 import ome.xml.r201004.enums.LaserMedium; 
    56 import ome.xml.r201004.enums.LaserType; 
    57 import ome.xml.r201004.enums.NamingConvention; 
    5849import ome.xml.r201004.primitives.NonNegativeInteger; 
    5950import ome.xml.r201004.primitives.PositiveInteger; 
     
    434425  } 
    435426 
    436   private void populateMetadataStore(MetadataStore store) { 
     427  private void populateMetadataStore(MetadataStore store) throws FormatException 
     428  { 
    437429    LOGGER.info("Populating MetadataStore"); 
    438430    MetadataTools.populatePixels(store, this, true); 
     
    463455      if (wellRows == 0 && wellColumns == 0) { 
    464456        well = pos[1]; 
    465         store.setWellRow( 
    466           new NonNegativeInteger(wellNumber[pos[1]][0]), pos[2], pos[1]); 
    467         store.setWellColumn( 
    468           new NonNegativeInteger(wellNumber[pos[1]][1]), pos[2], pos[1]); 
     457        NonNegativeInteger row = new NonNegativeInteger(wellNumber[pos[1]][0]); 
     458        NonNegativeInteger col = new NonNegativeInteger(wellNumber[pos[1]][1]); 
     459        store.setWellRow(row, pos[2], pos[1]); 
     460        store.setWellColumn(col, pos[2], pos[1]); 
    469461      } 
    470462      store.setWellSampleIndex(new NonNegativeInteger(i), pos[2], well, pos[0]); 
     
    479471      if (plateBarcode != null) plateName = plateBarcode + " " + plateName; 
    480472      store.setPlateName(plateName, 0); 
    481       store.setPlateRowNamingConvention(NamingConvention.LETTER, 0); 
    482       store.setPlateColumnNamingConvention(NamingConvention.NUMBER, 0); 
     473      store.setPlateRowNamingConvention(getNamingConvention("Letter"), 0); 
     474      store.setPlateColumnNamingConvention(getNamingConvention("Number"), 0); 
    483475 
    484476      for (int i=0; i<getSeriesCount(); i++) { 
     
    503495            } 
    504496            if (index < binnings.size()) { 
    505               try { 
    506                 store.setDetectorSettingsBinning( 
    507                   Binning.fromString(binnings.get(index)), i, c); 
    508               } 
    509               catch (EnumerationException e) { } 
     497              store.setDetectorSettingsBinning( 
     498                getBinning(binnings.get(index)), i, c); 
    510499            } 
    511500            if (lightSources != null && c < lightSources.size()) { 
     
    11701159        store.setLaserWavelength( 
    11711160          new PositiveInteger(new Integer(value)), 0, nextLaser); 
    1172         store.setLaserType(LaserType.OTHER, 0, nextLaser); 
    1173         store.setLaserLaserMedium(LaserMedium.OTHER, 0, nextLaser); 
     1161        try { 
     1162          store.setLaserType(getLaserType("Other"), 0, nextLaser); 
     1163          store.setLaserLaserMedium(getLaserMedium("Other"), 0, nextLaser); 
     1164        } 
     1165        catch (FormatException e) { 
     1166          LOGGER.warn("", e); 
     1167        } 
    11741168      } 
    11751169      else if (qName.equals("Magnification")) { 
     
    11811175      } 
    11821176      else if (qName.equals("Immersion")) { 
    1183         Immersion immersion = Immersion.OTHER; 
    1184         if (value.equals("1.33")) immersion = Immersion.WATER; 
    1185         else if (value.equals("1.00")) immersion = Immersion.AIR; 
     1177        String immersion = "Other"; 
     1178        if (value.equals("1.33")) immersion = "Water"; 
     1179        else if (value.equals("1.00")) immersion = "Air"; 
    11861180        else LOGGER.warn("Unknown immersion medium: {}", value); 
    1187         store.setObjectiveImmersion(immersion, 0, nextObjective); 
     1181        try { 
     1182          store.setObjectiveImmersion( 
     1183            getImmersion(immersion), 0, nextObjective); 
     1184        } 
     1185        catch (FormatException e) { 
     1186          LOGGER.warn("", e); 
     1187        } 
    11881188      } 
    11891189      else if (qName.equals("OffsetX") || qName.equals("OffsetY")) { 
     
    13021302        store.setDetectorID(detectorID, 0, nextCamera); 
    13031303        try { 
    1304           store.setDetectorType(DetectorType.fromString( 
     1304          store.setDetectorType(getDetectorType( 
    13051305            attributes.getValue("CameraType")), 0, nextCamera); 
    13061306        } 
    1307         catch (EnumerationException e) { } 
     1307        catch (FormatException e) { 
     1308          LOGGER.warn("", e); 
     1309        } 
    13081310        cameraIDs.add(attributes.getValue("ID")); 
    13091311        nextCamera++; 
     
    13161318          MetadataTools.createLSID("Objective", 0, nextObjective); 
    13171319        store.setObjectiveID(objectiveID, 0, nextObjective); 
    1318         store.setObjectiveCorrection(Correction.OTHER, 0, nextObjective); 
     1320        try { 
     1321          store.setObjectiveCorrection( 
     1322            getCorrection("Other"), 0, nextObjective); 
     1323        } 
     1324        catch (FormatException e) { 
     1325          LOGGER.warn("", e); 
     1326        } 
    13191327        objectiveIDs.add(attributes.getValue("ID")); 
    13201328      } 
  • branches/4.2/components/bio-formats/src/loci/formats/in/LiFlimReader.java

    r6336 r6370  
    373373    core[0].indexed = false; 
    374374    core[0].dimensionOrder = "XYCZT"; 
    375     core[0].pixelType = getPixelType(datatype); 
     375    core[0].pixelType = getPixelTypeFromString(datatype); 
    376376    core[0].littleEndian = true; 
    377377    core[0].interleaved = true; 
     
    388388      core[1].indexed = false; 
    389389      core[1].dimensionOrder = "XYCZT"; 
    390       core[1].pixelType = getPixelType(backgroundDatatype); 
     390      core[1].pixelType = getPixelTypeFromString(backgroundDatatype); 
    391391      core[1].littleEndian = true; 
    392392      core[1].interleaved = true; 
     
    458458  } 
    459459 
    460   private int getPixelType(String type) throws FormatException { 
     460  private int getPixelTypeFromString(String type) throws FormatException { 
    461461    // check data type 
    462462    if (DATATYPE_UINT8.equals(type)) return FormatTools.UINT8; 
Note: See TracChangeset for help on using the changeset viewer.