Changeset 6814


Ignore:
Timestamp:
08/18/10 15:21:38 (9 years ago)
Author:
melissa
Message:

Reverted a few changes from r6791 that prevented OME-TIFF files from being converted. Also, make sure that OMEXMLMetadataImpl.resolveReferences() is called before OMEXMLMetadataImpl.setRoot(Object); this prevents AnnotationRef's under ListAnnotation from being lost.

File:
1 edited

Legend:

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

    r6791 r6814  
    3636import loci.formats.meta.MetadataRetrieve; 
    3737import loci.formats.meta.MetadataStore; 
     38import loci.formats.ome.OMEXMLMetadataImpl; 
    3839import loci.formats.services.OMEXMLService; 
    3940 
     
    119120      store.setPixelsSizeC(new PositiveInteger(r.getSizeC()), i); 
    120121      store.setPixelsSizeT(new PositiveInteger(r.getSizeT()), i); 
    121  
    122       int tiffDataCount = 0; 
    123       OMEXMLService service = null; 
     122      store.setPixelsBinDataBigEndian(new Boolean(!r.isLittleEndian()), i, 0); 
     123 
    124124      try { 
    125         service = new ServiceFactory().getInstance(OMEXMLService.class); 
     125        OMEXMLService service = 
     126          new ServiceFactory().getInstance(OMEXMLService.class); 
    126127        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())) { 
     128          MetadataStore baseStore = r.getMetadataStore(); 
     129          if (service.isOMEXMLMetadata(baseStore)) { 
     130            ((OMEXMLMetadataImpl) baseStore).resolveReferences(); 
     131          } 
     132 
    139133          OME root = (OME) store.getRoot(); 
    140134          BinData bin = root.getImage(i).getPixels().getBinData(0); 
     
    143137        } 
    144138      } 
     139      catch (DependencyException exc) { 
     140        LOGGER.debug("Failed to set BinData.Length", exc); 
     141      } 
    145142 
    146143      try { 
     
    157154        for (int c=0; c<r.getEffectiveSizeC(); c++) { 
    158155          store.setChannelID(createLSID("Channel", i, c), i, c); 
    159           store.setChannelSamplesPerPixel(new PositiveInteger(sampleCount), i, c); 
     156          store.setChannelSamplesPerPixel( 
     157            new PositiveInteger(sampleCount), i, c); 
    160158        } 
    161159      } 
Note: See TracChangeset for help on using the changeset viewer.