Changeset 6796


Ignore:
Timestamp:
08/16/10 10:10:53 (9 years ago)
Author:
melissa
Message:

Remainder of OME-XML validation fixes. Closes #520.

Location:
trunk/components
Files:
11 edited

Legend:

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

    r6655 r6796  
    437437      for (int col=0; col<wellColumns; col++) { 
    438438        int well = row * wellColumns + col; 
     439        store.setWellID(MetadataTools.createLSID("Well", 0, well), 0, well); 
    439440        store.setWellRow(new NonNegativeInteger(row), 0, well); 
    440441        store.setWellColumn(new NonNegativeInteger(col), 0, well); 
     
    460461        store.setWellColumn(col, pos[2], pos[1]); 
    461462      } 
     463      String wellSample = 
     464        MetadataTools.createLSID("WellSample", pos[2], well, pos[0]); 
     465      store.setWellSampleID(wellSample, pos[2], well, pos[0]); 
    462466      store.setWellSampleIndex(new NonNegativeInteger(i), pos[2], well, pos[0]); 
    463467      store.setWellSampleImageRef(imageID, pos[2], well, pos[0]); 
     
    470474      if (plateName == null) plateName = currentFile.getParentFile().getName(); 
    471475      if (plateBarcode != null) plateName = plateBarcode + " " + plateName; 
     476      store.setPlateID(MetadataTools.createLSID("Plate", 0), 0); 
    472477      store.setPlateName(plateName, 0); 
    473478      store.setPlateRowNamingConvention(getNamingConvention("Letter"), 0); 
  • trunk/components/bio-formats/src/loci/formats/in/GatanDM2Reader.java

    r6655 r6796  
    189189      if (label.equals("Acquisition Date")) { 
    190190        date = value.toString(); 
     191        if (date != null && date.indexOf("/") != -1) { 
     192          // if the year is stored as a single digit, then it will be parsed 
     193          // literally, e.g. '7' -> '0007', when we want '7' -> '2007' 
     194          String year = date.substring(date.lastIndexOf("/") + 1); 
     195          if (year.length() < 2) { 
     196            year = "0" + year; 
     197          } 
     198          date = date.substring(0, date.lastIndexOf("/") + 1) + year; 
     199        } 
    191200      } 
    192201      else if (label.equals("Acquisition Time")) { 
     
    208217          store.setExperimenterLastName(experimenterName[1], 0); 
    209218        } 
     219        store.setExperimenterDisplayName(value.toString(), 0); 
    210220        String expID = MetadataTools.createLSID("Experimenter", 0); 
    211221        store.setExperimenterID(expID, 0); 
  • trunk/components/bio-formats/src/loci/formats/in/GatanReader.java

    r6655 r6796  
    128128      gamma = mag = voltage = 0; 
    129129      info = null; 
     130      adjustEndianness = true; 
    130131    } 
    131132  } 
  • trunk/components/bio-formats/src/loci/formats/in/LEOReader.java

    r6791 r6796  
    6262    super("LEO", "sxm"); 
    6363    domains = new String[] {FormatTools.EM_DOMAIN}; 
     64    suffixSufficient = false; 
    6465  } 
    6566 
  • trunk/components/bio-formats/src/loci/formats/in/LIFReader.java

    r6534 r6796  
    3131import loci.common.DataTools; 
    3232import loci.common.RandomAccessInputStream; 
     33import loci.common.services.DependencyException; 
     34import loci.common.services.ServiceFactory; 
    3335import loci.common.xml.XMLTools; 
    3436import loci.formats.CoreMetadata; 
     
    3941import loci.formats.MetadataTools; 
    4042import loci.formats.meta.MetadataStore; 
     43import loci.formats.services.OMEXMLService; 
     44 
     45import ome.xml.model.Channel; 
     46import ome.xml.model.OME; 
     47import ome.xml.model.Pixels; 
    4148 
    4249/** 
     
    378385 
    379386    MetadataTools.populatePixels(store, this, true, false); 
     387 
     388    // remove any Channels that do not have an ID 
     389 
     390    OMEXMLService service = null; 
     391    try { 
     392      service = new ServiceFactory().getInstance(OMEXMLService.class); 
     393      if (service.isOMEXMLRoot(store.getRoot())) { 
     394        OME root = (OME) store.getRoot(); 
     395        for (int i=0; i<getSeriesCount(); i++) { 
     396          Pixels img = root.getImage(i).getPixels(); 
     397          for (int c=0; c<img.sizeOfChannelList(); c++) { 
     398            Channel channel = img.getChannel(c); 
     399            if (channel.getID() == null) img.removeChannel(channel); 
     400          } 
     401        } 
     402      } 
     403    } 
     404    catch (DependencyException e) { 
     405      LOGGER.trace("Failed to remove channels", e); 
     406    } 
    380407  } 
    381408 
  • trunk/components/bio-formats/src/loci/formats/in/LeicaHandler.java

    r6687 r6796  
    945945      // the center point of the image 
    946946 
    947       if (text != null) store.setTextValue(text, roi, 0); 
     947      store.setROIID(MetadataTools.createLSID("ROI", roi), roi); 
     948      store.setTextID(MetadataTools.createLSID("Shape", roi, 0), roi, 0); 
     949      if (text == null) text = ""; 
     950      store.setTextValue(text, roi, 0); 
    948951      if (fontSize != null) { 
    949952        store.setTextFontSize( 
     
    957960      double cornerY = y.get(0).doubleValue(); 
    958961 
     962      store.setTextX(cornerX, roi, 0); 
     963      store.setTextY(cornerY, roi, 0); 
     964 
    959965      int centerX = (core.get(series).sizeX / 2) - 1; 
    960966      int centerY = (core.get(series).sizeY / 2) - 1; 
     
    970976      // TODO : rotation/scaling not populated 
    971977 
     978      String shapeID = MetadataTools.createLSID("Shape", roi, 1); 
    972979      switch (type) { 
    973980        case POLYGON: 
     
    979986            if (i < x.size() - 1) points.append(" "); 
    980987          } 
     988          store.setPolylineID(shapeID, roi, 1); 
    981989          store.setPolylinePoints(points.toString(), roi, 1); 
    982990          store.setPolylineClosed(Boolean.TRUE, roi, 1); 
     
    985993        case TEXT: 
    986994        case RECTANGLE: 
     995          store.setRectangleID(shapeID, roi, 1); 
    987996          store.setRectangleX(roiX - Math.abs(cornerX), roi, 1); 
    988997          store.setRectangleY(roiY - Math.abs(cornerY), roi, 1); 
     
    9961005        case ARROW: 
    9971006        case LINE: 
     1007          store.setLineID(shapeID, roi, 1); 
    9981008          store.setLineX1(roiX + x.get(0), roi, 1); 
    9991009          store.setLineY1(roiY + y.get(0), roi, 1); 
  • trunk/components/bio-formats/src/loci/formats/in/MetamorphReader.java

    r6780 r6796  
    658658            lastIFD = tp.getIFD(lastOffsets[p % lastOffsets.length]); 
    659659            stream.close(); 
    660             comment = lastIFD.getComment().trim(); 
     660            comment = lastIFD.getComment(); 
     661            if (comment != null) comment = comment.trim(); 
    661662            handler = new MetamorphHandler(getSeriesMetadata()); 
    662663            if (comment != null && comment.startsWith("<MetaData>")) { 
  • trunk/components/bio-formats/src/loci/formats/in/OxfordInstrumentsReader.java

    r6655 r6796  
    189189 
    190190    float scanTime = in.readInt() / 100f; 
    191     dateTime.append(String.valueOf((int) scanTime)); 
     191    dateTime.append(String.format("%02d", (int) scanTime)); 
    192192    addGlobalMeta("Scan time (s)", scanTime); 
    193193    return dateTime.toString(); 
  • trunk/components/bio-formats/src/loci/formats/in/TCSReader.java

    r6655 r6796  
    416416      core[0].sizeT = (ifds.size() * tiffReaders.length) / c; 
    417417      core[0].imageCount = getSizeT() * c; 
     418      if (getSizeT() == 0) { 
     419        core[0].sizeT = 1; 
     420        core[0].imageCount = ifds.size() * tiffReaders.length; 
     421      } 
     422    } 
     423 
     424    if (getImageCount() == ifds.size() * getSizeZ() * getSizeT() && 
     425      ifds.size() > 1) 
     426    { 
     427      if (getSizeZ() == 1) { 
     428        core[0].sizeZ = ifds.size(); 
     429      } 
     430      else if (getSizeT() == 1) { 
     431        core[0].sizeT = ifds.size(); 
     432      } 
     433      else core[0].sizeZ *= ifds.size(); 
    418434    } 
    419435 
     
    471487 
    472488    Location current = new Location(currentId).getAbsoluteFile(); 
    473     if (checkSuffix(currentId, TiffReader.TIFF_SUFFIXES)) { 
     489    if (!checkSuffix(currentId, XML_SUFFIX)) { 
    474490      tiffs.add(current.getAbsolutePath()); 
    475491    } 
  • trunk/components/bio-formats/src/loci/formats/tiff/TiffParser.java

    r6729 r6796  
    3131import loci.common.RandomAccessInputStream; 
    3232import loci.common.Region; 
     33import loci.common.enumeration.EnumException; 
    3334import loci.formats.FormatException; 
    3435import loci.formats.codec.BitBuffer; 
     
    327328      in.seek(offset + baseOffset + bytesPerEntry * i); 
    328329 
    329       TiffIFDEntry entry = readTiffIFDEntry(); 
     330      TiffIFDEntry entry = null; 
     331      try { 
     332        entry = readTiffIFDEntry(); 
     333      } 
     334      catch (EnumException e) { 
     335        LOGGER.debug("", e); 
     336      } 
     337      if (entry == null) break; 
    330338      int count = entry.getValueCount(); 
    331339      int tag = entry.getTag(); 
  • trunk/components/test-suite/src/loci/tests/testng/FormatReaderTest.java

    r6791 r6796  
    459459        } 
    460460 
    461         // if CreationDate is before 1995, it's probably invalid 
     461        // if CreationDate is before 1990, it's probably invalid 
    462462        String date = retrieve.getImageAcquiredDate(i); 
    463463        if (date != null) { 
     
    465465          long acquiredDate = DateTools.getTime(date, DateTools.ISO8601_FORMAT); 
    466466          long saneDate = 
    467             DateTools.getTime("1995-01-01T00:00:00", DateTools.ISO8601_FORMAT); 
     467            DateTools.getTime("1990-01-01T00:00:00", DateTools.ISO8601_FORMAT); 
    468468          long fileDate = new Location( 
    469469            reader.getCurrentFile()).getAbsoluteFile().lastModified(); 
Note: See TracChangeset for help on using the changeset viewer.