Changeset 6791


Ignore:
Timestamp:
08/13/10 09:18:58 (9 years ago)
Author:
melissa
Message:

More OME-XML validation fixes, see #520.

Location:
trunk/components
Files:
8 edited

Legend:

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

    r6719 r6791  
    119119      store.setPixelsSizeC(new PositiveInteger(r.getSizeC()), i); 
    120120      store.setPixelsSizeT(new PositiveInteger(r.getSizeT()), i); 
    121       store.setPixelsBinDataBigEndian(new Boolean(!r.isLittleEndian()), i, 0); 
    122  
     121 
     122      int tiffDataCount = 0; 
     123      OMEXMLService service = null; 
    123124      try { 
    124         OMEXMLService service = 
    125           new ServiceFactory().getInstance(OMEXMLService.class); 
     125        service = new ServiceFactory().getInstance(OMEXMLService.class); 
    126126        if (service.isOMEXMLRoot(store.getRoot())) { 
     127          OME root = (OME) store.getRoot(); 
     128          tiffDataCount = root.getImage(i).getPixels().sizeOfTiffDataList(); 
     129        } 
     130      } 
     131      catch (DependencyException exc) { 
     132        LOGGER.debug("Failed to set BinData.Length", exc); 
     133      } 
     134 
     135      if (tiffDataCount == 0) { 
     136        store.setPixelsBinDataBigEndian(new Boolean(!r.isLittleEndian()), i, 0); 
     137 
     138        if (service != null && service.isOMEXMLRoot(store.getRoot())) { 
    127139          OME root = (OME) store.getRoot(); 
    128140          BinData bin = root.getImage(i).getPixels().getBinData(0); 
     
    130142          store.setRoot(root); 
    131143        } 
    132       } 
    133       catch (DependencyException exc) { 
    134         LOGGER.debug("Failed to set BinData.Length", exc); 
    135144      } 
    136145 
  • trunk/components/bio-formats/src/loci/formats/in/BDReader.java

    r6746 r6791  
    280280      Integer col = Integer.parseInt(name.substring(1)); 
    281281 
     282      store.setWellID(MetadataTools.createLSID("Well", 0, i), 0, i); 
    282283      store.setWellColumn(new NonNegativeInteger(col - 1), 0, i); 
    283284      store.setWellRow(new NonNegativeInteger(row.charAt(0) - 'A'), 0, i); 
    284285 
     286      String wellSampleID = MetadataTools.createLSID("WellSample", 0, i, 0); 
     287      store.setWellSampleID(wellSampleID, 0, i, 0); 
    285288      store.setWellSampleIndex(new NonNegativeInteger(i), 0, i, 0); 
    286289 
     
    347350      } 
    348351 
     352      store.setPlateID(MetadataTools.createLSID("Plate", 0), 0); 
    349353      store.setPlateRowNamingConvention(getNamingConvention("Letter"), 0); 
    350354      store.setPlateColumnNamingConvention(getNamingConvention("Number"), 0); 
     
    524528 
    525529      if (cols[2].trim().length() > 0) { 
     530        String rectangleID = MetadataTools.createLSID("Shape", i - firstRow, 0); 
     531        store.setRectangleID(rectangleID, i - firstRow, 0); 
    526532        store.setRectangleX(new Double(cols[2]), i - firstRow, 0); 
    527533        store.setRectangleY(new Double(cols[3]), i - firstRow, 0); 
  • trunk/components/bio-formats/src/loci/formats/in/BaseTiffReader.java

    r6708 r6791  
    412412        store.setExperimenterLastName(lastName, 0); 
    413413        store.setExperimenterEmail(email, 0); 
     414        store.setExperimenterDisplayName(artist, 0); 
     415        store.setExperimenterID(MetadataTools.createLSID("Experimenter", 0), 0); 
    414416      } 
    415417 
  • trunk/components/bio-formats/src/loci/formats/in/InCellReader.java

    r6726 r6791  
    436436      int sampleIndex = (field - 1) * totalTimepoints + timepoint; 
    437437 
     438      String wellSampleID = 
     439        MetadataTools.createLSID("WellSample", 0, well, sampleIndex); 
     440      store.setWellSampleID(wellSampleID, 0 ,well, sampleIndex); 
    438441      store.setWellSampleIndex(new NonNegativeInteger(i), 0, well, sampleIndex); 
    439442      store.setWellSampleImageRef(imageID, 0, well, sampleIndex); 
     
    504507        Character.isDigit(colName.charAt(0)) ? "Number" : "Letter"; 
    505508 
     509      store.setPlateID(MetadataTools.createLSID("Plate", 0), 0); 
    506510      store.setPlateRowNamingConvention(getNamingConvention(rowNaming), 0); 
    507511      store.setPlateColumnNamingConvention(getNamingConvention(colNaming), 0); 
     
    873877          for (int c=0; c<wellCols; c++) { 
    874878            int well = r * wellCols + c; 
     879            String wellID = MetadataTools.createLSID("Well", nextPlate, well); 
     880            store.setWellID(wellID, nextPlate, well); 
    875881            store.setWellRow(new NonNegativeInteger(r), nextPlate, well); 
    876882            store.setWellColumn(new NonNegativeInteger(c), nextPlate, well); 
  • trunk/components/bio-formats/src/loci/formats/in/LEOReader.java

    r6655 r6791  
    3030import loci.formats.FormatException; 
    3131import loci.formats.FormatTools; 
     32import loci.formats.MetadataTools; 
    3233import loci.formats.meta.MetadataStore; 
    3334import loci.formats.tiff.IFD; 
     
    121122      store.setPixelsPhysicalSizeX(xSize, 0); 
    122123      store.setPixelsPhysicalSizeY(xSize, 0); 
     124 
     125      String instrument = MetadataTools.createLSID("Instrument", 0); 
     126      store.setInstrumentID(instrument, 0); 
     127      store.setImageInstrumentRef(instrument, 0); 
     128 
     129      store.setObjectiveID(MetadataTools.createLSID("Objective", 0, 0), 0, 0); 
    123130      store.setObjectiveWorkingDistance(workingDistance, 0, 0); 
    124131      store.setObjectiveImmersion(getImmersion("Other"), 0, 0); 
  • trunk/components/bio-formats/src/loci/formats/in/MIASReader.java

    r6655 r6791  
    678678      char wellRow = (char) ('A' + row); 
    679679 
     680      store.setWellID(MetadataTools.createLSID("Well", 0, well), 0, well); 
    680681      store.setWellRow(new NonNegativeInteger(row), 0, well); 
    681682      store.setWellColumn(new NonNegativeInteger(wellCol - 1), 0, well); 
    682683 
    683684      String imageID = MetadataTools.createLSID("Image", well); 
     685      String wellSampleID = MetadataTools.createLSID("WellSample", 0, well, 0); 
     686      store.setWellSampleID(wellSampleID, 0, well, 0); 
    684687      store.setWellSampleIndex(new NonNegativeInteger(well), 0, well, 0); 
    685688 
     
    694697 
    695698    if (level != MetadataLevel.MINIMUM) { 
    696       store.setExperimentID("Experiment:" + experiment.getName(), 0); 
     699      String experimentID = MetadataTools.createLSID("Experiment", 0); 
     700      store.setExperimentID(experimentID, 0); 
    697701      store.setExperimentType(getExperimentType("Other"), 0); 
     702      store.setExperimentDescription(experiment.getName(), 0); 
    698703 
    699704      // populate SPW metadata 
     705      store.setPlateID(MetadataTools.createLSID("Plate", 0), 0); 
    700706      store.setPlateColumnNamingConvention(getNamingConvention("Number"), 0); 
    701707      store.setPlateRowNamingConvention(getNamingConvention("Letter"), 0); 
     
    709715      for (int well=0; well<nWells; well++) { 
    710716        // populate Image/Pixels metadata 
    711         store.setImageExperimentRef("Experiment:" + experiment.getName(), well); 
     717        store.setImageExperimentRef(experimentID, well); 
    712718 
    713719        String instrumentID = MetadataTools.createLSID("Instrument", 0); 
     
    849855    store.setImageROIRef(roiID, series, roi); 
    850856 
     857    store.setEllipseID(MetadataTools.createLSID("Shape", roi, 0), roi, 0); 
    851858    store.setEllipseTheT(new NonNegativeInteger(tv), roi, 0); 
    852859    store.setEllipseTheZ(new NonNegativeInteger(zv), roi, 0); 
     
    916923        } 
    917924        else if (key.equals("Objective_ID")) { 
     925          store.setObjectiveID( 
     926            MetadataTools.createLSID("Objective", 0, 0), 0, 0); 
    918927          store.setObjectiveModel(value, 0, 0); 
    919928        } 
     
    970979    for (int i=0; i<3; i++) { 
    971980      String roiId = MetadataTools.createLSID("ROI", series, roi + nOverlays); 
    972       String maskId = MetadataTools.createLSID("Mask", series, roi + nOverlays, 0); 
     981      String maskId = 
     982        MetadataTools.createLSID("Mask", series, roi + nOverlays, 0); 
    973983      overlayFiles.put(maskId, overlayTiff); 
    974984      overlayPlanes.put(maskId, new Integer(i)); 
     
    977987      if (validMask) { 
    978988        store.setROIID(roiId, roi + nOverlays); 
     989 
     990        String maskID = MetadataTools.createLSID("Shape", roi + nOverlays, 0); 
     991        store.setMaskID(maskID, roi + nOverlays, 0); 
    979992        store.setMaskX(new Double(0), roi + nOverlays, 0); 
    980993        store.setMaskY(new Double(0), roi + nOverlays, 0); 
  • trunk/components/bio-formats/src/loci/formats/in/OMETiffReader.java

    r6706 r6791  
    4545import loci.formats.FormatTools; 
    4646import loci.formats.IFormatReader; 
     47import loci.formats.MetadataTools; 
    4748import loci.formats.MissingLibraryException; 
    4849import loci.formats.ome.OMEXMLMetadata; 
     
    608609    core = series.toArray(new CoreMetadata[series.size()]); 
    609610    info = planeInfo.toArray(new OMETiffPlane[0][0]); 
     611 
     612    MetadataTools.populatePixels(metadataStore, this); 
    610613  } 
    611614 
  • trunk/components/test-suite/src/loci/tests/testng/FormatReaderTest.java

    r6786 r6791  
    462462        String date = retrieve.getImageAcquiredDate(i); 
    463463        if (date != null) { 
     464          date = date.trim(); 
    464465          long acquiredDate = DateTools.getTime(date, DateTools.ISO8601_FORMAT); 
    465466          long saneDate = 
     
    944945      reader = new BufferedImageReader(new FileStitcher()); 
    945946      reader.setNormalized(true); 
    946       reader.setOriginalMetadataPopulated(true); 
    947947      reader.setMetadataFiltered(true); 
    948948      MetadataStore store = null; 
Note: See TracChangeset for help on using the changeset viewer.