Changeset 5651


Ignore:
Timestamp:
10/29/09 09:03:25 (10 years ago)
Author:
melissa
Message:

Fixed Mask indices.

File:
1 edited

Legend:

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

    r5628 r5651  
    933933  { 
    934934    if (!parseMasks) return 0; 
    935     int nOverlays = 3; 
    936     for (int i=0; i<nOverlays; i++) { 
    937       store.setMaskX("0", series, roi + i, 0); 
    938       store.setMaskY("0", series, roi + i, 0); 
    939       store.setMaskWidth(String.valueOf(getSizeX()), series, roi + i, 0); 
    940       store.setMaskHeight(String.valueOf(getSizeY()), series, roi + i, 0); 
    941       store.setMaskPixelsBigEndian( 
    942         new Boolean(!isLittleEndian()), series, roi + i, 0); 
    943       store.setMaskPixelsSizeX(new Integer(getSizeX()), series, roi + i, 0); 
    944       store.setMaskPixelsSizeY(new Integer(getSizeY()), series, roi + i, 0); 
    945       store.setMaskPixelsExtendedPixelType("bit", series, roi + i, 0); 
    946  
    947       String id = MetadataTools.createLSID("Mask", series, roi, 0); 
     935    int nOverlays = 0; 
     936    for (int i=0; i<3; i++) { 
     937      String id = MetadataTools.createLSID("Mask", series, roi + nOverlays, 0); 
    948938      overlayFiles.put(id, overlayTiff); 
    949939      overlayPlanes.put(id, new Integer(i)); 
    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++; 
     957      } 
    951958    } 
    952959    return nOverlays; 
     
    958965   * Populate the MaskPixels.BinData attribute for the Mask identified by the 
    959966   * given Image index, ROI index, and Shape index. 
     967   * @return true if the mask was populated successfully. 
    960968   */ 
    961   public void populateMaskPixels(int imageIndex, int roiIndex, int shapeIndex) 
     969  public boolean populateMaskPixels(int imageIndex, int roiIndex, 
     970    int shapeIndex) 
    962971    throws FormatException, IOException 
    963972  { 
     
    969978    if (maskFile == null) { 
    970979      warnDebug("Could not find an overlay file matching " + id); 
    971       return; 
     980      return false; 
    972981    } 
    973982 
     
    10231032    } 
    10241033    else debug("Did not populate MaskPixels.BinData for " + id); 
     1034 
     1035    return validMask; 
    10251036  } 
    10261037 
Note: See TracChangeset for help on using the changeset viewer.