Changeset 6864


Ignore:
Timestamp:
09/01/10 13:06:05 (9 years ago)
Author:
melissa
Message:

Several tweaks to original metadata storage so that FV1000 files do not take too long to initialize.

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

Legend:

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

    r6805 r6864  
    565565    core[0].dimensionOrder = "XY"; 
    566566 
     567    Hashtable<String, String> values = new Hashtable<String, String>(); 
     568    Vector<String> baseKeys = new Vector<String>(); 
     569 
    567570    for (int i=0, ii=0; ii<getImageCount(); i++, ii++) { 
    568571      String file = filenames.get(new Integer(i)); 
     
    639642          String[] keys = table.keySet().toArray(new String[table.size()]); 
    640643          for (String key : keys) { 
    641             addGlobalMeta("Image " + ii + " : " + key, table.get(key)); 
    642           } 
     644            values.put("Image " + ii + " : " + key, table.get(key)); 
     645            if (!baseKeys.contains(key)) baseKeys.add(key); 
     646          } 
     647        } 
     648      } 
     649    } 
     650 
     651    for (String key : baseKeys) { 
     652      if (key.equals("DataName") || key.indexOf("FileName") >= 0) break; 
     653      boolean equal = true; 
     654      String first = values.get("Image 0 : " + key); 
     655      for (int i=1; i<getImageCount(); i++) { 
     656        if (!first.equals(values.get("Image " + i + " : " + key))) { 
     657          equal = false; 
     658          break; 
     659        } 
     660      } 
     661      if (equal) { 
     662        addGlobalMeta(key, first); 
     663      } 
     664      else { 
     665        for (int i=0; i<getImageCount(); i++) { 
     666          String k = "Image " + i + " : " + key; 
     667          addGlobalMeta(k, values.get(k)); 
    643668        } 
    644669      } 
  • trunk/components/bio-formats/src/loci/formats/services/OMEXMLServiceImpl.java

    r6622 r6864  
    361361    int annotationIndex = 0; 
    362362    try { 
    363       annotationIndex = omexmlMeta.getListAnnotationCount(); 
     363      annotationIndex = omexmlMeta.getCommentAnnotationCount(); 
    364364    } 
    365365    catch (NullPointerException e) { } 
    366     String listID = MetadataTools.createLSID("Annotation", annotationIndex * 3); 
    367     omexmlMeta.setListAnnotationID(listID, annotationIndex); 
    368     omexmlMeta.setListAnnotationNamespace( 
    369       StructuredAnnotations.NAMESPACE, annotationIndex); 
    370  
    371     int keyIndex = annotationIndex * 2; 
    372     int valueIndex = annotationIndex * 2 + 1; 
    373     String keyID = 
    374       MetadataTools.createLSID("Annotation", annotationIndex * 3 + 1); 
    375     String valueID = 
    376       MetadataTools.createLSID("Annotation", annotationIndex * 3 + 2); 
    377     omexmlMeta.setCommentAnnotationID(keyID, keyIndex); 
    378     omexmlMeta.setCommentAnnotationID(valueID, valueIndex); 
    379     omexmlMeta.setCommentAnnotationValue(key, keyIndex); 
    380     omexmlMeta.setCommentAnnotationValue(value, valueIndex); 
    381     omexmlMeta.setCommentAnnotationNamespace( 
    382       StructuredAnnotations.NAMESPACE, keyIndex); 
    383     omexmlMeta.setCommentAnnotationNamespace( 
    384       StructuredAnnotations.NAMESPACE, valueIndex); 
    385     omexmlMeta.setListAnnotationAnnotationRef(keyID, annotationIndex, 0); 
    386     omexmlMeta.setListAnnotationAnnotationRef(valueID, annotationIndex, 1); 
     366 
     367    String id = MetadataTools.createLSID("Annotation", annotationIndex); 
     368    omexmlMeta.setCommentAnnotationID(id, annotationIndex); 
     369    omexmlMeta.setCommentAnnotationDescription(key, annotationIndex); 
     370    omexmlMeta.setCommentAnnotationValue(value, annotationIndex); 
    387371  } 
    388372 
Note: See TracChangeset for help on using the changeset viewer.