Changeset 2678


Ignore:
Timestamp:
04/25/07 14:31:44 (13 years ago)
Author:
melissa
Message:

Use the core metadata model.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/FileStitcher.java

    r2677 r2678  
    7878  private byte[][] blankThumbBytes; 
    7979 
    80   /** Image dimensions. */ 
    81   private int[] width, height; 
    82  
    8380  /** Number of images per file. */ 
    8481  private int[] imagesPerFile; 
    8582 
    86   /** Total number of image planes. */ 
    87   private int[] totalImages; 
    88  
    89   /** Dimension order. */ 
    90   private String[] order; 
    91  
    9283  /** Dimensional axis lengths per file. */ 
    9384  private int[] sizeZ, sizeC, sizeT; 
    9485 
    95   /** Total dimensional axis lengths. */ 
    96   private int[] totalSizeZ, totalSizeC, totalSizeT; 
    97  
    9886  /** Component lengths for each axis type. */ 
    9987  private int[][] lenZ, lenC, lenT; 
    10088 
     89  /** Core metadata. */ 
     90  private CoreMetadata core; 
     91   
    10192  // -- Constructors -- 
    10293 
     
    224215  /* @see IFormatReader#getImageCount() */ 
    225216  public int getImageCount() { 
    226     return totalImages[getSeries()]; 
     217    return core.imageCount[getSeries()];  
    227218  } 
    228219 
    229220  /* @see IFormatReader#isRGB() */ 
    230221  public boolean isRGB() { 
    231     return reader.isRGB(); 
     222    return core.rgb[getSeries()]; 
    232223  } 
    233224 
    234225  /* @see IFormatReader#getSizeX() */ 
    235226  public int getSizeX() { 
    236     return width[getSeries()]; 
     227    return core.sizeX[getSeries()]; 
    237228  } 
    238229 
    239230  /* @see IFormatReader#getSizeY() */ 
    240231  public int getSizeY() { 
    241     return height[getSeries()]; 
     232    return core.sizeY[getSeries()]; 
    242233  } 
    243234 
    244235  /* @see IFormatReader#getSizeZ() */ 
    245236  public int getSizeZ() { 
    246     return totalSizeZ[getSeries()]; 
     237    return core.sizeZ[getSeries()]; 
    247238  } 
    248239 
    249240  /* @see IFormatReader#getSizeC() */ 
    250241  public int getSizeC() { 
    251     return totalSizeC[getSeries()]; 
     242    return core.sizeC[getSeries()]; 
    252243  } 
    253244 
    254245  /* @see IFormatReader#getSizeT() */ 
    255246  public int getSizeT() { 
    256     return totalSizeT[getSeries()]; 
     247    return core.sizeT[getSeries()]; 
    257248  } 
    258249 
    259250  /* @see IFormatReader#getPixelType() */ 
    260251  public int getPixelType() { 
    261     return reader.getPixelType(); 
     252    return core.pixelType[getSeries()]; 
    262253  } 
    263254 
     
    307298  /* @see IFormatReader#getDimensionOrder() */ 
    308299  public String getDimensionOrder() { 
    309     return order[getSeries()]; 
     300    return core.currentOrder[getSeries()]; 
    310301  } 
    311302 
     
    337328    int sno = getSeries(); 
    338329    if (blankImage[sno] == null) { 
    339       blankImage[sno] = ImageTools.blankImage(width[sno], height[sno], 
     330      blankImage[sno] = ImageTools.blankImage(core.sizeX[sno], core.sizeY[sno], 
    340331        sizeC[sno], getPixelType()); 
    341332    } 
     
    356347    if (blankBytes[sno] == null) { 
    357348      int bytes = FormatTools.getBytesPerPixel(getPixelType()); 
    358       blankBytes[sno] = new byte[width[sno] * height[sno] * 
     349      blankBytes[sno] = new byte[core.sizeX[sno] * core.sizeY[sno] * 
    359350        bytes * getRGBChannelCount()]; 
    360351    } 
     
    547538  /* @see IFormatReader#getCoreMetadata() */ 
    548539  public CoreMetadata getCoreMetadata() { 
    549     return reader.getCoreMetadata(); 
     540    return core; 
    550541  } 
    551542 
     
    704695 
    705696    reader.setId(files[0]); 
     697    core = reader.getCoreMetadata(); 
    706698 
    707699    int seriesCount = reader.getSeriesCount(); 
     
    711703    blankThumb = new BufferedImage[seriesCount]; 
    712704    blankThumbBytes = new byte[seriesCount][]; 
    713     width = new int[seriesCount]; 
    714     height = new int[seriesCount]; 
    715705    imagesPerFile = new int[seriesCount]; 
    716     totalImages = new int[seriesCount]; 
    717     order = new String[seriesCount]; 
    718706    sizeZ = new int[seriesCount]; 
    719707    sizeC = new int[seriesCount]; 
    720708    sizeT = new int[seriesCount]; 
    721709    boolean[] certain = new boolean[seriesCount]; 
    722     totalSizeZ = new int[seriesCount]; 
    723     totalSizeC = new int[seriesCount]; 
    724     totalSizeT = new int[seriesCount]; 
    725710    lenZ = new int[seriesCount][]; 
    726711    lenC = new int[seriesCount][]; 
     
    731716    for (int i=0; i<seriesCount; i++) { 
    732717      reader.setSeries(i); 
    733       width[i] = reader.getSizeX(); 
    734       height[i] = reader.getSizeY(); 
     718      core.sizeX[i] = reader.getSizeX(); 
     719      core.sizeY[i] = reader.getSizeY(); 
    735720      imagesPerFile[i] = reader.getImageCount(); 
    736       totalImages[i] = files.length * imagesPerFile[i]; 
    737       order[i] = reader.getDimensionOrder(); 
     721      core.imageCount[i] = files.length * imagesPerFile[i]; 
     722      core.currentOrder[i] = reader.getDimensionOrder(); 
    738723      sizeZ[i] = reader.getSizeZ(); 
    739724      sizeC[i] = reader.getSizeC(); 
     
    745730    // guess at dimensions corresponding to file numbering 
    746731    for (int i=0; i<seriesCount; i++) { 
    747       ag[i] = new AxisGuesser(fp, order[i], 
     732      ag[i] = new AxisGuesser(fp, core.currentOrder[i], 
    748733        sizeZ[i], sizeT[i], sizeC[i], certain[i]); 
    749734    } 
     
    752737    for (int i=0; i<seriesCount; i++) { 
    753738      setSeries(i); 
    754       order[i] = ag[i].getAdjustedOrder(); 
     739      core.currentOrder[i] = ag[i].getAdjustedOrder(); 
    755740    } 
    756741    setSeries(oldSeries); 
     
    772757    int numT = ag[sno].getAxisCountT(); 
    773758 
    774     totalSizeZ[sno] = sizeZ[sno]; 
    775     totalSizeC[sno] = sizeC[sno]; 
    776     totalSizeT[sno] = sizeT[sno]; 
     759    core.sizeZ[sno] = sizeZ[sno]; 
     760    core.sizeC[sno] = sizeC[sno]; 
     761    core.sizeT[sno] = sizeT[sno]; 
    777762    lenZ[sno] = new int[numZ + 1]; 
    778763    lenC[sno] = new int[numC + 1]; 
     
    785770      switch (axes[i]) { 
    786771        case AxisGuesser.Z_AXIS: 
    787           totalSizeZ[sno] *= count[i]; 
     772          core.sizeZ[sno] *= count[i]; 
    788773          lenZ[sno][z++] = count[i]; 
    789774          break; 
    790775        case AxisGuesser.C_AXIS: 
    791           totalSizeC[sno] *= count[i]; 
     776          core.sizeC[sno] *= count[i]; 
    792777          lenC[sno][c++] = count[i]; 
    793778          break; 
    794779        case AxisGuesser.T_AXIS: 
    795           totalSizeT[sno] *= count[i]; 
     780          core.sizeT[sno] *= count[i]; 
    796781          lenT[sno][t++] = count[i]; 
    797782          break; 
     
    806791    boolean little = reader.isLittleEndian(); 
    807792    MetadataStore s = reader.getMetadataStore(); 
    808     s.setPixels(new Integer(width[sno]), new Integer(height[sno]), 
    809       new Integer(totalSizeZ[sno]), new Integer(totalSizeC[sno]), 
    810       new Integer(totalSizeT[sno]), new Integer(pixelType), 
    811       new Boolean(!little), order[sno], new Integer(sno), null); 
     793    s.setPixels(new Integer(core.sizeX[sno]), new Integer(core.sizeY[sno]), 
     794      new Integer(core.sizeZ[sno]), new Integer(core.sizeC[sno]), 
     795      new Integer(core.sizeT[sno]), new Integer(pixelType), 
     796      new Boolean(!little), core.currentOrder[sno], new Integer(sno), null); 
    812797  } 
    813798 
     
    843828    } 
    844829    int fno = FormatTools.positionToRaster(count, pos); 
    845     int ino = FormatTools.getIndex(order[sno], sizeZ[sno], 
     830    int ino = FormatTools.getIndex(core.currentOrder[sno], sizeZ[sno], 
    846831      reader.getEffectiveSizeC(), sizeT[sno], imagesPerFile[sno], 
    847832      posZ[0], posC[0], posT[0]); 
     
    10161001  { 
    10171002    if (!id.equals(currentId)) setId(id); 
    1018     return order[getSeries()]; 
     1003    return core.currentOrder[getSeries()]; 
    10191004  } 
    10201005 
Note: See TracChangeset for help on using the changeset viewer.