Changeset 3998


Ignore:
Timestamp:
05/05/08 08:41:44 (12 years ago)
Author:
melissa
Message:

Added hack to correct for the fact that SVI writes ICS files upside-down.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/in/ICSReader.java

    r3854 r3998  
    6161    "shutter1", "shutter2", "shutter3", "pinhole", "laser1", "laser2", 
    6262    "laser3", "objective", "PassCount", "step1", "step2", "step3", "view", 
    63     "view1", "date", "GMTdate", "label" 
     63    "view1", "date", "GMTdate", "label", "software" 
    6464  }; 
    6565 
     
    102102  private boolean gzip; 
    103103 
     104  private boolean invertY; 
     105 
    104106  // -- Constructor -- 
    105107 
     
    133135    int bpp = bitsPerPixel / 8; 
    134136    int len = core.sizeX[0] * core.sizeY[0] * bpp * getRGBChannelCount(); 
     137    int pixel = bpp * getRGBChannelCount(); 
     138    int rowLen = w * pixel; 
    135139 
    136140    in.seek(offset + no * len); 
     
    152156    } 
    153157    else { 
    154       int pixel = bpp * getRGBChannelCount(); 
    155       int rowLen = w * pixel; 
    156  
    157158      if (!gzip) in.skipBytes(y * rowLen); 
    158159 
     
    181182    } 
    182183 
     184    if (invertY) { 
     185      byte[] row = new byte[rowLen]; 
     186      for (int r=0; r<h/2; r++) { 
     187        System.arraycopy(buf, r*rowLen, row, 0, rowLen); 
     188        System.arraycopy(buf, (h - r - 1)*rowLen, buf, r*rowLen, rowLen); 
     189        System.arraycopy(row, 0, buf, (h - r - 1)*rowLen, rowLen); 
     190      } 
     191    } 
     192 
    183193    return buf; 
    184194  } 
     
    205215    versionTwo = false; 
    206216    gzip = false; 
     217    invertY = false; 
    207218  } 
    208219 
     
    310321          else if (k.equals("sensor s_params LambdaEm")) em = v; 
    311322          else if (k.equals("sensor s_params LambdaEx")) ex = v; 
     323          else if (k.equals("history software") && v.indexOf("SVI") != -1) { 
     324            // ICS files written by SVI Huygens are inverted on the Y axis 
     325            invertY = true; 
     326          } 
    312327        } 
    313328        else { 
Note: See TracChangeset for help on using the changeset viewer.