Changeset 6430


Ignore:
Timestamp:
06/01/10 12:06:02 (10 years ago)
Author:
melissa
Message:
  • Updated OMEXMLMetadataImpl based on  ome-xml:r618.
  • Fixed a bunch of minor bugs exposed during testing.
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2/components/bio-formats/src/loci/formats/in/AVIReader.java

    r6230 r6430  
    480480      else { 
    481481        // skipping unknown block 
    482         readTypeAndSize(); 
     482        if (in.getFilePointer() + 8 < in.length()) { 
     483          readTypeAndSize(); 
     484        } 
     485        else break; 
    483486        if (in.getFilePointer() + size + 4 <= in.length()) { 
    484487          in.skipBytes(size); 
  • branches/4.2/components/bio-formats/src/loci/formats/in/BDReader.java

    r6376 r6430  
    520520        store.setRectangleWidth(new Double(cols[4]), i - firstRow, 0); 
    521521        store.setRectangleHeight(new Double(cols[5]), i - firstRow, 0); 
    522         String roiID = MetadataTools.createLSID("Rectangle", i - firstRow, 0); 
    523         store.setRectangleID(roiID, i - firstRow, 0); 
     522        String roiID = MetadataTools.createLSID("ROI", i - firstRow); 
     523        store.setROIID(roiID, i - firstRow); 
    524524        store.setImageROIRef(roiID, 0, i - firstRow); 
    525525      } 
  • branches/4.2/components/bio-formats/src/loci/formats/in/ICSReader.java

    r6376 r6430  
    821821 
    822822      Integer[] lasers = wavelengths.keySet().toArray(new Integer[0]); 
    823       for (Integer laser : lasers) { 
     823      for (int i=0; i<lasers.length; i++) { 
    824824        store.setLaserWavelength( 
    825           new PositiveInteger(wavelengths.get(laser)), 0, laser.intValue()); 
    826         store.setLaserType(getLaserType("Other"), 0, laser.intValue()); 
    827         store.setLaserLaserMedium(getLaserMedium("Other"), 0, laser.intValue()); 
     825          new PositiveInteger(wavelengths.get(lasers[i])), 0, i); 
     826        store.setLaserType(getLaserType("Other"), 0, i); 
     827        store.setLaserLaserMedium(getLaserMedium("Other"), 0, i); 
    828828      } 
    829829 
  • branches/4.2/components/bio-formats/src/loci/formats/in/LEOReader.java

    r6230 r6430  
    122122      store.setPixelsPhysicalSizeY(xSize, 0); 
    123123      store.setObjectiveWorkingDistance(workingDistance, 0, 0); 
     124      store.setObjectiveImmersion(getImmersion("Other"), 0, 0); 
     125      store.setObjectiveCorrection(getCorrection("Other"), 0, 0); 
    124126    } 
    125127  } 
  • branches/4.2/components/bio-formats/src/loci/formats/in/MetamorphReader.java

    r6381 r6430  
    926926        return l.exists() ? l.getAbsolutePath() : null; 
    927927      } 
    928       else return l.getAbsolutePath(); 
    929     } 
    930     return null; 
     928    } 
     929    return l.getAbsolutePath(); 
    931930  } 
    932931 
  • branches/4.2/components/bio-formats/src/loci/formats/in/OpenlabReader.java

    r6376 r6430  
    142142    lastPlane = no; 
    143143 
     144    if (no >= planeOffsets[series].length) return buf; 
    144145    int index = planeOffsets[series][no]; 
    145146 
    146147    long first = planes[index].planeOffset; 
    147     long last = no == getImageCount() - 1 ? in.length() : 
     148    long last = no == planeOffsets[series].length - 1 || 
     149      planeOffsets[series][no + 1] >= planes.length ? in.length() : 
    148150      planes[planeOffsets[series][no + 1]].planeOffset; 
    149151    in.seek(first); 
     
    723725      core[s].sizeZ /= core[s].sizeT; 
    724726    } 
     727 
     728    int newCount = getSizeZ() * getSizeT(); 
     729    if (!isRGB()) newCount *= getSizeC(); 
     730 
     731    if (newCount < getImageCount()) { 
     732      char firstAxis = getDimensionOrder().charAt(2); 
     733      if (firstAxis == 'Z') core[s].sizeZ++; 
     734      else if (firstAxis == 'C' && !isRGB()) core[s].sizeC++; 
     735      else core[s].sizeT++; 
     736      core[s].imageCount = getSizeZ() * getSizeT(); 
     737      if (!isRGB()) core[s].imageCount *= getSizeC(); 
     738    } 
     739    else if (newCount > getImageCount()) core[s].imageCount = newCount; 
    725740  } 
    726741 
  • branches/4.2/components/bio-formats/src/loci/formats/in/TCSReader.java

    r6301 r6430  
    147147    TiffParser tp = new TiffParser(stream); 
    148148    IFD ifd = tp.getFirstIFD(); 
    149     if (ifd == null) return false; 
     149    if (ifd == null) { 
     150      stream.seek(0); 
     151      return stream.readString(6).equals("<Data>"); 
     152    } 
    150153    String document = ifd.getIFDTextValue(IFD.DOCUMENT_NAME); 
    151154    if (document == null) document = ""; 
     
    191194    FormatTools.assertId(currentId, true, 1); 
    192195    if (noPixels) { 
    193       String name = currentId.toLowerCase(); 
    194       if (checkSuffix(name, TiffReader.TIFF_SUFFIXES)) return null; 
    195       return new String[] {currentId}; 
     196      return xmlFile == null ? null : new String[] {xmlFile}; 
    196197    } 
    197198    Vector<String> v = new Vector<String>(); 
    198199    v.addAll(tiffs); 
    199  
    200     String absoluteId = new Location(currentId).getAbsolutePath(); 
    201     if (!v.contains(absoluteId)) v.add(absoluteId); 
     200    if (xmlFile != null) v.add(xmlFile); 
    202201    return v.toArray(new String[v.size()]); 
    203202  } 
     
    237236      } 
    238237    } 
     238 
     239    if (isXML) xmlFile = l.getAbsolutePath(); 
    239240 
    240241    super.initFile(id); 
  • branches/4.2/components/bio-formats/src/loci/formats/ome/OMEXMLMetadataImpl.java

    r6415 r6430  
    3333 * 
    3434 * THIS IS AUTOMATICALLY GENERATED CODE.  DO NOT MODIFY. 
    35  * Created by callan via xsd-fu on 2010-05-28 12:45:35.110314 
     35 * Created by melissa via xsd-fu on 2010-06-01 11:06:50.718672 
    3636 * 
    3737 *----------------------------------------------------------------------------- 
     
    14691469 
    14701470        // 
    1471         // EmissionFilterRef property storage 
    1472         // 
    1473         // Indexes: {u'LightPath': [u'int imageIndex', u'int channelIndex', u'int emissionFilterRefIndex'], u'FilterSet': [u'int instrumentIndex', u'int filterSetIndex', u'int emissionFilterRefIndex']} 
    1474         // {u'LightPath': {u'Channel': {u'Pixels': {u'Image': {u'OME': None}}}}, u'FilterSet': {u'Instrument': {u'OME': None}}} 
    1475         // Is multi path? True 
    1476  
    1477         // 
    14781471        // ExcitationFilterRef property storage 
    14791472        // 
     
    14831476 
    14841477        // 
    1485         // ExcitationFilterRef property storage 
    1486         // 
    1487         // Indexes: {u'LightPath': [u'int imageIndex', u'int channelIndex', u'int excitationFilterRefIndex'], u'FilterSet': [u'int instrumentIndex', u'int filterSetIndex', u'int excitationFilterRefIndex']} 
    1488         // {u'LightPath': {u'Channel': {u'Pixels': {u'Image': {u'OME': None}}}}, u'FilterSet': {u'Instrument': {u'OME': None}}} 
    1489         // Is multi path? True 
    1490  
    1491         // 
    14921478        // Experiment property storage 
    14931479        // 
     
    16221608        // ExperimenterRef property storage 
    16231609        // 
    1624         // Indexes: {u'Project': [u'int projectIndex'], u'Image': [u'int imageIndex'], u'Experiment': [u'int experimentIndex'], u'MicrobeamManipulation': [u'int experimentIndex', u'int microbeamManipulationIndex'], u'Dataset': [u'int datasetIndex']} 
     1610        // Indexes: {u'Project': [u'int projectIndex'], u'MicrobeamManipulation': [u'int experimentIndex', u'int microbeamManipulationIndex'], u'Image': [u'int imageIndex'], u'Experiment': [u'int experimentIndex'], u'Dataset': [u'int datasetIndex']} 
    16251611        // {u'Project': {u'OME': None}, u'Image': {u'OME': None}, u'Dataset': {u'OME': None}, u'Experiment': {u'OME': None}, u'MicrobeamManipulation': {u'Experiment': {u'OME': None}}} 
    16261612        // Is multi path? True 
     
    55715557                model.addModelObject(id, o3); 
    55725558                o3.setID(id); 
     5559                // Custom content from Channel ID template 
     5560                if (o3.getLightPath() == null) 
     5561                { 
     5562                        o3.setLightPath(new LightPath()); 
     5563                } 
    55735564        } 
    55745565 
     
    68296820        // 
    68306821        // EmissionFilterRef property storage 
    6831         // 
    6832         // {u'LightPath': {u'Channel': {u'Pixels': {u'Image': {u'OME': None}}}}, u'FilterSet': {u'Instrument': {u'OME': None}}} 
    6833         // Is multi path? True 
    6834  
    6835         // 
    6836         // EmissionFilterRef property storage 
    6837         // 
    6838         // {u'LightPath': {u'Channel': {u'Pixels': {u'Image': {u'OME': None}}}}, u'FilterSet': {u'Instrument': {u'OME': None}}} 
    6839         // Is multi path? True 
    6840  
    6841         // 
    6842         // ExcitationFilterRef property storage 
    68436822        // 
    68446823        // {u'LightPath': {u'Channel': {u'Pixels': {u'Image': {u'OME': None}}}}, u'FilterSet': {u'Instrument': {u'OME': None}}} 
  • branches/4.2/components/bio-formats/src/loci/formats/tiff/IFD.java

    r6300 r6430  
    842842      if ((value instanceof Boolean) || (value instanceof Number) || 
    843843        (value instanceof String) || (value instanceof PhotoInterp) || 
    844         (value instanceof TiffCompression)) 
     844        (value instanceof TiffCompression) || (value instanceof TiffIFDEntry)) 
    845845      { 
    846846        v = value.toString(); 
  • branches/4.2/components/bio-formats/src/loci/formats/tiff/TiffCompression.java

    r6026 r6430  
    6363 
    6464  // (TIFF code, codec, codec name) 
     65  DEFAULT_UNCOMPRESSED(0, new PassthroughCodec(), "Uncompressed"), 
    6566  UNCOMPRESSED(1, new PassthroughCodec(), "Uncompressed"), 
    6667  CCITT_1D(2, null, "CCITT Group 3 1-Dimensional Modified Huffman"), 
  • branches/4.2/components/bio-formats/src/loci/formats/tiff/TiffParser.java

    r6368 r6430  
    444444      if (count == 1) return new Long(in.readInt()); 
    445445      long[] longs = new long[count]; 
    446       for (int j=0; j<count; j++) longs[j] = in.readInt(); 
     446      for (int j=0; j<count; j++) { 
     447        if (in.getFilePointer() + 4 <= in.length()) { 
     448          longs[j] = in.readInt(); 
     449        } 
     450      } 
    447451      return longs; 
    448452    } 
     
    752756    } 
    753757 
    754     int nSamples = samples.length / nChannels; 
    755  
    756758    LOGGER.debug( 
    757759      "unpacking {} samples (startIndex={}; totalBits={}; numBytes={})", 
     
    763765    int bps0 = bitsPerSample[0]; 
    764766    int numBytes = ifd.getBytesPerSample()[0]; 
     767    int nSamples = samples.length / (nChannels * numBytes); 
    765768 
    766769    boolean noDiv8 = bps0 % 8 != 0; 
     
    835838            { 
    836839              value = bb.getBits(bps0) & 0xffff; 
    837               if (littleEndian && bps0 > 8) { 
    838                 value = DataTools.swap(value) >> (64 - bps0); 
    839               } 
    840               if ((ndx % imageWidth) == imageWidth - 1 && bps0 < 8) { 
     840              //if (littleEndian && bps0 > 8) { 
     841              //  value = DataTools.swap(value) >> (32 - bps0); 
     842              //} 
     843              if ((ndx % imageWidth) == imageWidth - 1/* && bps0 < 8*/) { 
    841844                bb.skipBits(skipBits); 
    842845              } 
  • trunk/components/bio-formats/src/loci/formats/in/AVIReader.java

    r6230 r6430  
    481481        // skipping unknown block 
    482482        readTypeAndSize(); 
     483        if (in.getFilePointer() + 8 < in.length()) { 
     484          readTypeAndSize(); 
     485        } 
     486        else break; 
    483487        if (in.getFilePointer() + size + 4 <= in.length()) { 
    484488          in.skipBytes(size); 
  • trunk/components/bio-formats/src/loci/formats/in/BDReader.java

    r6377 r6430  
    520520        store.setRectangleWidth(new Double(cols[4]), i - firstRow, 0); 
    521521        store.setRectangleHeight(new Double(cols[5]), i - firstRow, 0); 
    522         String roiID = MetadataTools.createLSID("Rectangle", i - firstRow, 0); 
    523         store.setRectangleID(roiID, i - firstRow, 0); 
     522        String roiID = MetadataTools.createLSID("ROI", i - firstRow); 
     523        store.setROIID(roiID, i - firstRow); 
    524524        store.setImageROIRef(roiID, 0, i - firstRow); 
    525525      } 
  • trunk/components/bio-formats/src/loci/formats/in/ICSReader.java

    r6377 r6430  
    821821 
    822822      Integer[] lasers = wavelengths.keySet().toArray(new Integer[0]); 
    823       for (Integer laser : lasers) { 
     823      for (int i=0; i<lasers.length; i++) { 
    824824        store.setLaserWavelength( 
    825           new PositiveInteger(wavelengths.get(laser)), 0, laser.intValue()); 
    826         store.setLaserType(getLaserType("Other"), 0, laser.intValue()); 
    827         store.setLaserLaserMedium(getLaserMedium("Other"), 0, laser.intValue()); 
     825          new PositiveInteger(wavelengths.get(lasers[i])), 0, i); 
     826        store.setLaserType(getLaserType("Other"), 0, i); 
     827        store.setLaserLaserMedium(getLaserMedium("Other"), 0, i); 
    828828      } 
    829829 
  • trunk/components/bio-formats/src/loci/formats/in/LEOReader.java

    r6230 r6430  
    122122      store.setPixelsPhysicalSizeY(xSize, 0); 
    123123      store.setObjectiveWorkingDistance(workingDistance, 0, 0); 
     124      store.setObjectiveImmersion(getImmersion("Other"), 0, 0); 
     125      store.setObjectiveCorrection(getCorrection("Other"), 0, 0); 
    124126    } 
    125127  } 
  • trunk/components/bio-formats/src/loci/formats/in/MetamorphReader.java

    r6381 r6430  
    926926        return l.exists() ? l.getAbsolutePath() : null; 
    927927      } 
    928       else return l.getAbsolutePath(); 
    929     } 
    930     return null; 
     928    } 
     929    return l.getAbsolutePath(); 
    931930  } 
    932931 
  • trunk/components/bio-formats/src/loci/formats/in/OpenlabReader.java

    r6377 r6430  
    142142    lastPlane = no; 
    143143 
     144    if (no >= planeOffsets[series].length) return buf; 
    144145    int index = planeOffsets[series][no]; 
    145146 
    146147    long first = planes[index].planeOffset; 
    147     long last = no == getImageCount() - 1 ? in.length() : 
     148    long last = no == planeOffsets[series].length - 1 || 
     149      planeOffsets[series][no + 1] >= planes.length ? in.length() : 
    148150      planes[planeOffsets[series][no + 1]].planeOffset; 
    149151    in.seek(first); 
     
    723725      core[s].sizeZ /= core[s].sizeT; 
    724726    } 
     727 
     728    int newCount = getSizeZ() * getSizeT(); 
     729    if (!isRGB()) newCount *= getSizeC(); 
     730 
     731    if (newCount < getImageCount()) { 
     732      char firstAxis = getDimensionOrder().charAt(2); 
     733      if (firstAxis == 'Z') core[s].sizeZ++; 
     734      else if (firstAxis == 'C' && !isRGB()) core[s].sizeC++; 
     735      else core[s].sizeT++; 
     736      core[s].imageCount = getSizeZ() * getSizeT(); 
     737      if (!isRGB()) core[s].imageCount *= getSizeC(); 
     738    } 
     739    else if (newCount > getImageCount()) core[s].imageCount = newCount; 
    725740  } 
    726741 
  • trunk/components/bio-formats/src/loci/formats/in/TCSReader.java

    r6301 r6430  
    147147    TiffParser tp = new TiffParser(stream); 
    148148    IFD ifd = tp.getFirstIFD(); 
    149     if (ifd == null) return false; 
     149    if (ifd == null) { 
     150      stream.seek(0); 
     151      return stream.readString(6).equals("<Data>"); 
     152    } 
    150153    String document = ifd.getIFDTextValue(IFD.DOCUMENT_NAME); 
    151154    if (document == null) document = ""; 
     
    191194    FormatTools.assertId(currentId, true, 1); 
    192195    if (noPixels) { 
    193       String name = currentId.toLowerCase(); 
    194       if (checkSuffix(name, TiffReader.TIFF_SUFFIXES)) return null; 
    195       return new String[] {currentId}; 
     196      return xmlFile == null ? null : new String[] {xmlFile}; 
    196197    } 
    197198    Vector<String> v = new Vector<String>(); 
    198199    v.addAll(tiffs); 
    199  
    200     String absoluteId = new Location(currentId).getAbsolutePath(); 
    201     if (!v.contains(absoluteId)) v.add(absoluteId); 
     200    if (xmlFile != null) v.add(xmlFile); 
    202201    return v.toArray(new String[v.size()]); 
    203202  } 
     
    237236      } 
    238237    } 
     238 
     239    if (isXML) xmlFile = l.getAbsolutePath(); 
    239240 
    240241    super.initFile(id); 
  • trunk/components/bio-formats/src/loci/formats/ome/OMEXMLMetadataImpl.java

    r6413 r6430  
    3333 * 
    3434 * THIS IS AUTOMATICALLY GENERATED CODE.  DO NOT MODIFY. 
    35  * Created by callan via xsd-fu on 2010-05-28 12:45:35.110314 
     35 * Created by melissa via xsd-fu on 2010-06-01 11:06:50.718672 
    3636 * 
    3737 *----------------------------------------------------------------------------- 
     
    14691469 
    14701470        // 
    1471         // EmissionFilterRef property storage 
    1472         // 
    1473         // Indexes: {u'LightPath': [u'int imageIndex', u'int channelIndex', u'int emissionFilterRefIndex'], u'FilterSet': [u'int instrumentIndex', u'int filterSetIndex', u'int emissionFilterRefIndex']} 
    1474         // {u'LightPath': {u'Channel': {u'Pixels': {u'Image': {u'OME': None}}}}, u'FilterSet': {u'Instrument': {u'OME': None}}} 
    1475         // Is multi path? True 
    1476  
    1477         // 
    14781471        // ExcitationFilterRef property storage 
    14791472        // 
     
    14831476 
    14841477        // 
    1485         // ExcitationFilterRef property storage 
    1486         // 
    1487         // Indexes: {u'LightPath': [u'int imageIndex', u'int channelIndex', u'int excitationFilterRefIndex'], u'FilterSet': [u'int instrumentIndex', u'int filterSetIndex', u'int excitationFilterRefIndex']} 
    1488         // {u'LightPath': {u'Channel': {u'Pixels': {u'Image': {u'OME': None}}}}, u'FilterSet': {u'Instrument': {u'OME': None}}} 
    1489         // Is multi path? True 
    1490  
    1491         // 
    14921478        // Experiment property storage 
    14931479        // 
     
    16221608        // ExperimenterRef property storage 
    16231609        // 
    1624         // Indexes: {u'Project': [u'int projectIndex'], u'Image': [u'int imageIndex'], u'Experiment': [u'int experimentIndex'], u'MicrobeamManipulation': [u'int experimentIndex', u'int microbeamManipulationIndex'], u'Dataset': [u'int datasetIndex']} 
     1610        // Indexes: {u'Project': [u'int projectIndex'], u'MicrobeamManipulation': [u'int experimentIndex', u'int microbeamManipulationIndex'], u'Image': [u'int imageIndex'], u'Experiment': [u'int experimentIndex'], u'Dataset': [u'int datasetIndex']} 
    16251611        // {u'Project': {u'OME': None}, u'Image': {u'OME': None}, u'Dataset': {u'OME': None}, u'Experiment': {u'OME': None}, u'MicrobeamManipulation': {u'Experiment': {u'OME': None}}} 
    16261612        // Is multi path? True 
     
    55715557                model.addModelObject(id, o3); 
    55725558                o3.setID(id); 
     5559                // Custom content from Channel ID template 
     5560                if (o3.getLightPath() == null) 
     5561                { 
     5562                        o3.setLightPath(new LightPath()); 
     5563                } 
    55735564        } 
    55745565 
     
    68296820        // 
    68306821        // EmissionFilterRef property storage 
    6831         // 
    6832         // {u'LightPath': {u'Channel': {u'Pixels': {u'Image': {u'OME': None}}}}, u'FilterSet': {u'Instrument': {u'OME': None}}} 
    6833         // Is multi path? True 
    6834  
    6835         // 
    6836         // EmissionFilterRef property storage 
    6837         // 
    6838         // {u'LightPath': {u'Channel': {u'Pixels': {u'Image': {u'OME': None}}}}, u'FilterSet': {u'Instrument': {u'OME': None}}} 
    6839         // Is multi path? True 
    6840  
    6841         // 
    6842         // ExcitationFilterRef property storage 
    68436822        // 
    68446823        // {u'LightPath': {u'Channel': {u'Pixels': {u'Image': {u'OME': None}}}}, u'FilterSet': {u'Instrument': {u'OME': None}}} 
  • trunk/components/bio-formats/src/loci/formats/tiff/IFD.java

    r6300 r6430  
    842842      if ((value instanceof Boolean) || (value instanceof Number) || 
    843843        (value instanceof String) || (value instanceof PhotoInterp) || 
    844         (value instanceof TiffCompression)) 
     844        (value instanceof TiffCompression) || (value instanceof TiffIFDEntry)) 
    845845      { 
    846846        v = value.toString(); 
  • trunk/components/bio-formats/src/loci/formats/tiff/TiffCompression.java

    r6026 r6430  
    6363 
    6464  // (TIFF code, codec, codec name) 
     65  DEFAULT_UNCOMPRESSED(0, new PassthroughCodec(), "Uncompressed"), 
    6566  UNCOMPRESSED(1, new PassthroughCodec(), "Uncompressed"), 
    6667  CCITT_1D(2, null, "CCITT Group 3 1-Dimensional Modified Huffman"), 
  • trunk/components/bio-formats/src/loci/formats/tiff/TiffParser.java

    r6368 r6430  
    444444      if (count == 1) return new Long(in.readInt()); 
    445445      long[] longs = new long[count]; 
    446       for (int j=0; j<count; j++) longs[j] = in.readInt(); 
     446      for (int j=0; j<count; j++) { 
     447        if (in.getFilePointer() + 4 <= in.length()) { 
     448          longs[j] = in.readInt(); 
     449        } 
     450      } 
    447451      return longs; 
    448452    } 
     
    752756    } 
    753757 
    754     int nSamples = samples.length / nChannels; 
    755  
    756758    LOGGER.debug( 
    757759      "unpacking {} samples (startIndex={}; totalBits={}; numBytes={})", 
     
    763765    int bps0 = bitsPerSample[0]; 
    764766    int numBytes = ifd.getBytesPerSample()[0]; 
     767    int nSamples = samples.length / (nChannels * numBytes); 
    765768 
    766769    boolean noDiv8 = bps0 % 8 != 0; 
     
    835838            { 
    836839              value = bb.getBits(bps0) & 0xffff; 
    837               if (littleEndian && bps0 > 8) { 
    838                 value = DataTools.swap(value) >> (64 - bps0); 
    839               } 
    840               if ((ndx % imageWidth) == imageWidth - 1 && bps0 < 8) { 
     840              //if (littleEndian && bps0 > 8) { 
     841              //  value = DataTools.swap(value) >> (64 - bps0); 
     842              //} 
     843              if ((ndx % imageWidth) == imageWidth - 1/* && bps0 < 8*/) { 
    841844                bb.skipBits(skipBits); 
    842845              } 
Note: See TracChangeset for help on using the changeset viewer.