Changeset 6784


Ignore:
Timestamp:
08/10/10 14:06:35 (9 years ago)
Author:
melissa
Message:

More OME-XML validation fixes. See #520.

Location:
trunk/components/bio-formats/src/loci/formats
Files:
6 edited

Legend:

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

    r6655 r6784  
    238238    key = key.trim(); 
    239239 
    240     boolean string = value instanceof String; 
     240    boolean string = value instanceof String || value instanceof Character; 
    241241    boolean simple = string || 
    242242      value instanceof Number || 
    243       value instanceof Boolean || 
    244       value instanceof Character; 
     243      value instanceof Boolean; 
    245244 
    246245    // string value, if passed in value is a string 
    247     String val = string ? (String) value : null; 
    248  
    249     if (filterMetadata) { 
     246    String val = string ? String.valueOf(value) : null; 
     247 
     248    if (filterMetadata || 
     249      (saveOriginalMetadata && (getMetadataStore() instanceof OMEXMLMetadata))) 
     250    { 
    250251      // filter out complex data types 
    251252      if (!simple) return; 
  • trunk/components/bio-formats/src/loci/formats/in/BioRadReader.java

    r6681 r6784  
    640640              } 
    641641              else if (key.equals("LENS_MAGNIFICATION")) { 
    642                 store.setObjectiveNominalMagnification( 
    643                   new PositiveInteger((int) Float.parseFloat(value)), 0, 0); 
     642                int magnification = (int) Float.parseFloat(value); 
     643                if (magnification > 0) { 
     644                  store.setObjectiveNominalMagnification( 
     645                    new PositiveInteger(magnification), 0, 0); 
     646                } 
    644647              } 
    645648              else if (key.startsWith("SETTING")) { 
     
    893896                  addGlobalMeta("Time Course - experiment type", values[2]); 
    894897                  addGlobalMeta("Time Course - kd factor", values[3]); 
     898                  String experimentID = 
     899                    MetadataTools.createLSID("Experiment", 0); 
     900                  store.setExperimentID(experimentID, 0); 
    895901                  store.setExperimentType(getExperimentType(values[2]), 0); 
    896902                  break; 
  • trunk/components/bio-formats/src/loci/formats/in/CellWorxReader.java

    r6735 r6784  
    8080    } 
    8181 
     82    boolean foundHTD = false; 
     83    boolean foundPNL = false; 
     84 
    8285    Location parent = new Location(name).getAbsoluteFile().getParentFile(); 
    8386    String[] list = parent.list(true); 
    8487    for (String file : list) { 
    85       if (checkSuffix(file, "htd")) return true; 
    86     } 
    87     return false; 
     88      if (checkSuffix(file, "htd")) foundHTD = true; 
     89      if (checkSuffix(file, "pnl")) foundPNL = true; 
     90    } 
     91    return foundHTD && foundPNL; 
    8892  } 
    8993 
  • trunk/components/bio-formats/src/loci/formats/in/ICSReader.java

    r6710 r6784  
    222222    int[] prevCoordinates = getZCTCoords(prevImage); 
    223223 
    224     in.seek(offset + no * (long) len); 
     224    if (!gzip) in.seek(offset + no * (long) len); 
    225225 
    226226    int sizeC = lifetime ? 1 : getSizeC(); 
     
    721721    offset = in.getFilePointer(); 
    722722 
     723    int bytes = bitsPerPixel / 8; 
     724 
    723725    if (gzip) { 
    724726      data = new byte[(int) (in.length() - in.getFilePointer())]; 
     
    726728      in.read(data); 
    727729      byte[] buf = new byte[8192]; 
    728       ByteArrayHandle v = new ByteArrayHandle(); 
     730      int nBytes = getImageCount() * getSizeX() * getSizeY() * bytes; 
     731      ByteArrayHandle v = new ByteArrayHandle(nBytes); 
    729732      try { 
    730733        GZIPInputStream r = new GZIPInputStream(new ByteArrayInputStream(data)); 
     
    736739        r.close(); 
    737740        data = v.getBytes(); 
     741        v.close(); 
    738742      } 
    739743      catch (IOException dfe) { 
    740744        throw new FormatException("Error uncompressing gzip'ed data", dfe); 
    741745      } 
     746      buf = null; 
    742747    } 
    743748 
     
    745750 
    746751    boolean fp = rFormat.equals("real"); 
    747     int bytes = bitsPerPixel / 8; 
    748752    core[0].pixelType = FormatTools.pixelTypeFromBytes(bytes, signed, fp); 
    749753 
     
    821825      Integer[] lasers = wavelengths.keySet().toArray(new Integer[0]); 
    822826      for (int i=0; i<lasers.length; i++) { 
     827        store.setLaserID(MetadataTools.createLSID("LightSource", 0, i), 0, i); 
    823828        store.setLaserWavelength( 
    824829          new PositiveInteger(wavelengths.get(lasers[i])), 0, i); 
     
    859864      // populate Experimenter data 
    860865 
    861       if (lastName != null) store.setExperimenterLastName(lastName, 0); 
     866      if (lastName != null) { 
     867        String experimenterID = MetadataTools.createLSID("Experimenter", 0); 
     868        store.setExperimenterID(experimenterID, 0); 
     869        store.setExperimenterLastName(lastName, 0); 
     870        store.setExperimenterDisplayName(lastName, 0); 
     871      } 
    862872 
    863873      // populate StagePosition data 
  • trunk/components/bio-formats/src/loci/formats/in/IPLabReader.java

    r6655 r6784  
    289289        int numRoiPts = in.readInt(); 
    290290 
     291        store.setRectangleID(MetadataTools.createLSID("Shape", 0, 0), 0, 0); 
    291292        store.setRectangleX(new Double(roiLeft), 0, 0); 
    292293        store.setRectangleY(new Double(roiTop), 0, 0); 
  • trunk/components/bio-formats/src/loci/formats/in/ZeissZVIReader.java

    r6655 r6784  
    10721072      s.skipBytes(6); 
    10731073 
     1074      String roiID = MetadataTools.createLSID("ROI", imageNum); 
     1075      String shapeID = MetadataTools.createLSID("Shape", imageNum, shapeIndex); 
     1076 
    10741077      if (roiType == ELLIPSE) { 
     1078        store.setROIID(roiID, imageNum); 
     1079        store.setEllipseID(shapeID, imageNum, shapeIndex); 
    10751080        store.setEllipseX(new Double(x + (w / 2)), imageNum, shapeIndex); 
    10761081        store.setEllipseY(new Double(y + (h / 2)), imageNum, shapeIndex); 
     
    10821087        roiType == OUTLINE_SPLINE) 
    10831088      { 
     1089        store.setROIID(roiID, imageNum); 
    10841090        StringBuffer points = new StringBuffer(); 
    10851091        for (int p=0; p<nPoints; p++) { 
     
    10921098        } 
    10931099 
     1100        store.setPolylineID(shapeID, imageNum, shapeIndex); 
    10941101        store.setPolylinePoints(points.toString(), imageNum, shapeIndex); 
    10951102        store.setPolylineClosed(roiType != CURVE, imageNum, shapeIndex); 
     
    10971104      } 
    10981105      else if (roiType == RECTANGLE || roiType == TEXT) { 
     1106        store.setROIID(roiID, imageNum); 
     1107        store.setRectangleID(shapeID, imageNum, shapeIndex); 
    10991108        store.setRectangleX(new Double(x), imageNum, shapeIndex); 
    11001109        store.setRectangleY(new Double(y), imageNum, shapeIndex); 
     
    11041113      } 
    11051114      else if (roiType == LINE || roiType == SCALE_BAR) { 
     1115        store.setROIID(roiID, imageNum); 
    11061116        double x1 = s.readDouble(); 
    11071117        double y1 = s.readDouble(); 
    11081118        double x2 = s.readDouble(); 
    11091119        double y2 = s.readDouble(); 
     1120        store.setLineID(shapeID, imageNum, shapeIndex); 
    11101121        store.setLineX1(x1, imageNum, shapeIndex); 
    11111122        store.setLineY1(y1, imageNum, shapeIndex); 
Note: See TracChangeset for help on using the changeset viewer.