Changeset 5684


Ignore:
Timestamp:
11/12/09 04:13:11 (10 years ago)
Author:
callan
Message:

Merging r5628 and r5651 from Trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.1/components/bio-formats/src/loci/formats/in/MIASReader.java

    r5625 r5684  
    932932    String overlayTiff) throws FormatException, IOException 
    933933  { 
    934     int nOverlays = 3; 
    935     for (int i=0; i<nOverlays; i++) { 
    936       store.setMaskX("0", series, roi + i, 0); 
    937       store.setMaskY("0", series, roi + i, 0); 
    938       store.setMaskWidth(String.valueOf(getSizeX()), series, roi + i, 0); 
    939       store.setMaskHeight(String.valueOf(getSizeY()), series, roi + i, 0); 
    940       store.setMaskPixelsBigEndian( 
    941         new Boolean(!isLittleEndian()), series, roi + i, 0); 
    942       store.setMaskPixelsSizeX(new Integer(getSizeX()), series, roi + i, 0); 
    943       store.setMaskPixelsSizeY(new Integer(getSizeY()), series, roi + i, 0); 
    944       store.setMaskPixelsExtendedPixelType("bit", series, roi + i, 0); 
    945  
    946       String id = MetadataTools.createLSID("Mask", series, roi, 0); 
     934    if (!parseMasks) return 0; 
     935    int nOverlays = 0; 
     936    for (int i=0; i<3; i++) { 
     937      String id = MetadataTools.createLSID("Mask", series, roi + nOverlays, 0); 
    947938      overlayFiles.put(id, overlayTiff); 
    948939      overlayPlanes.put(id, new Integer(i)); 
    949       if (parseMasks) { 
    950         populateMaskPixels(series, roi, 0); 
     940 
     941      boolean validMask = populateMaskPixels(series, roi + nOverlays, 0); 
     942      if (validMask) { 
     943        store.setMaskX("0", series, roi + nOverlays, 0); 
     944        store.setMaskY("0", series, roi + nOverlays, 0); 
     945        store.setMaskWidth( 
     946          String.valueOf(getSizeX()), series, roi + nOverlays, 0); 
     947        store.setMaskHeight( 
     948          String.valueOf(getSizeY()), series, roi + nOverlays, 0); 
     949        store.setMaskPixelsBigEndian( 
     950          new Boolean(!isLittleEndian()), series, roi + nOverlays, 0); 
     951        store.setMaskPixelsSizeX( 
     952          new Integer(getSizeX()), series, roi + nOverlays, 0); 
     953        store.setMaskPixelsSizeY( 
     954          new Integer(getSizeY()), series, roi + nOverlays, 0); 
     955        store.setMaskPixelsExtendedPixelType("bit", series, roi + nOverlays, 0); 
     956        nOverlays++; 
    951957      } 
    952958    } 
     
    959965   * Populate the MaskPixels.BinData attribute for the Mask identified by the 
    960966   * given Image index, ROI index, and Shape index. 
     967   * @return true if the mask was populated successfully. 
    961968   */ 
    962   public void populateMaskPixels(int imageIndex, int roiIndex, int shapeIndex) 
     969  public boolean populateMaskPixels(int imageIndex, int roiIndex, 
     970    int shapeIndex) 
    963971    throws FormatException, IOException 
    964972  { 
     
    970978    if (maskFile == null) { 
    971979      warnDebug("Could not find an overlay file matching " + id); 
    972       return; 
     980      return false; 
    973981    } 
    974982 
     
    10241032    } 
    10251033    else debug("Did not populate MaskPixels.BinData for " + id); 
     1034 
     1035    return validMask; 
    10261036  } 
    10271037 
Note: See TracChangeset for help on using the changeset viewer.