Changeset 5685 for branches/4.1


Ignore:
Timestamp:
11/13/09 12:03:36 (11 years ago)
Author:
melissa
Message:

MIAS masks are now packed bit masks.

File:
1 edited

Legend:

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

    r5684 r5685  
    4444import loci.formats.ImageTools; 
    4545import loci.formats.MetadataTools; 
     46import loci.formats.codec.BitWriter; 
    4647import loci.formats.meta.FilterMetadata; 
    4748import loci.formats.meta.MetadataStore; 
     
    806807    int roi, int time, int z, MetadataStore store) 
    807808  { 
    808     float cx = Float.parseFloat(data[columns.indexOf("Col")]); 
    809     float cy = Float.parseFloat(data[columns.indexOf("Row")]); 
     809    double cx = Double.parseDouble(data[columns.indexOf("Col")]); 
     810    double cy = Double.parseDouble(data[columns.indexOf("Row")]); 
    810811 
    811812    Integer tv = new Integer(time); 
     
    823824    store.setCircleCy(data[columns.indexOf("Row")], series, roi, 0); 
    824825 
    825     float diam = Float.parseFloat(data[columns.indexOf("Cell Diam.")]); 
     826    double diam = Double.parseDouble(data[columns.indexOf("Cell Diam.")]); 
    826827    String radius = String.valueOf(diam / 2); 
    827828 
     
    885886        } 
    886887        else if (key.equals("Magnification")) { 
    887           int mag = (int) Float.parseFloat(value); 
     888          int mag = (int) Double.parseDouble(value); 
    888889          store.setObjectiveNominalMagnification(new Integer(mag), 0, 0); 
    889890        } 
     
    10151016    } 
    10161017 
    1017     // threshold the pixel data 
     1018    // threshold and binary encode the pixel data 
    10181019 
    10191020    boolean validMask = false; 
     1021    BitWriter bits = new BitWriter(planes[index].length / 8); 
    10201022    for (int p=0; p<planes[index].length; p++) { 
     1023      bits.write(planes[index][p] == 0 ? 0 : 1, 1); 
    10211024      if (planes[index][p] != 0) { 
    10221025        validMask = true; 
    1023         planes[index][p] = (byte) 1; 
    10241026      } 
    10251027    } 
     
    10281030      MetadataStore store = 
    10291031        new FilterMetadata(getMetadataStore(), isMetadataFiltered()); 
    1030       store.setMaskPixelsBinData(planes[index], imageIndex, roiIndex, 
     1032      store.setMaskPixelsBinData(bits.toByteArray(), imageIndex, roiIndex, 
    10311033        shapeIndex); 
    10321034    } 
Note: See TracChangeset for help on using the changeset viewer.