Changeset 2583


Ignore:
Timestamp:
04/09/07 10:19:50 (13 years ago)
Author:
melissa
Message:

Deprecated all methods that take the 'id' parameter. The id should be st
by calling the setId(String) method of IFormatReader.

Location:
trunk/loci
Files:
67 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/apps/stitcher/MovieStitcher.java

    r2570 r2583  
    281281      String pattern = FilePattern.findPattern(file); 
    282282      input.setText(pattern); 
    283       
     283     
    284284      try { 
    285         if (swap.getSeriesCount(pattern) > 1 && series == null) { 
     285        swap.setId(pattern); 
     286         
     287        if (swap.getSeriesCount() > 1 && series == null) { 
    286288          JLabel seriesLabel = new JLabel("Series: "); 
    287289          series = new JSpinner(new SpinnerNumberModel(1, 1,  
    288             swap.getSeriesCount(pattern), 1));  
     290            swap.getSeriesCount(), 1));  
    289291          series.addChangeListener(this); 
    290292          seriesRow.add(seriesLabel); 
     
    294296        else if (series != null) { 
    295297          ((SpinnerNumberModel) series.getModel()).setMaximum( 
    296             new Integer(swap.getSeriesCount(pattern))); 
     298            new Integer(swap.getSeriesCount())); 
    297299          pack(); 
    298300        } 
    299         else if (swap.getSeriesCount(pattern) == 1 && series != null) { 
     301        else if (swap.getSeriesCount() == 1 && series != null) { 
    300302          seriesRow.remove(series); 
    301303          series = null; 
     
    371373    if (e.getSource() == series) { 
    372374      try { 
    373         swap.setSeries(swap.getCurrentFile(),  
    374           ((Integer) series.getValue()).intValue() - 1); 
     375        swap.setSeries(((Integer) series.getValue()).intValue() - 1); 
    375376        updateLabels(input.getText()); 
    376377      } 
     
    419420      } 
    420421      output.setEditable(false); 
    421   
     422 
     423      swap.setId(in); 
    422424      if (series != null) { 
    423         swap.setSeries(in, ((Integer) series.getValue()).intValue() - 1); 
     425        swap.setSeries(((Integer) series.getValue()).intValue() - 1); 
    424426      } 
    425427 
     
    436438      // swap dimensions based on user input 
    437439 
    438       String order = swap.getDimensionOrder(in); 
     440      String order = swap.getDimensionOrder(); 
    439441       
    440442      if (zLabel.getText().indexOf("Time") != -1) { 
     
    459461      } 
    460462 
    461       swap.swapDimensions(in, order); 
     463      swap.swapDimensions(order); 
    462464 
    463465      OMEXMLMetadataStore store = new OMEXMLMetadataStore(); 
     
    468470      // determine internal and external dimensions for each axis 
    469471 
    470       int internalZ = includeZ.isSelected() ? swap.getSizeZ(in) : 1; 
    471       int internalT = includeT.isSelected() ? swap.getSizeT(in) : 1; 
    472       int internalC = includeC.isSelected() ? swap.getEffectiveSizeC(in) : 1; 
    473  
    474       int externalZ = includeZ.isSelected() ? 1 : swap.getSizeZ(in); 
    475       int externalT = includeT.isSelected() ? 1 : swap.getSizeT(in); 
    476       int externalC = includeC.isSelected() ? 1 : swap.getEffectiveSizeC(in); 
     472      int internalZ = includeZ.isSelected() ? swap.getSizeZ() : 1; 
     473      int internalT = includeT.isSelected() ? swap.getSizeT() : 1; 
     474      int internalC = includeC.isSelected() ? swap.getEffectiveSizeC() : 1; 
     475 
     476      int externalZ = includeZ.isSelected() ? 1 : swap.getSizeZ(); 
     477      int externalT = includeT.isSelected() ? 1 : swap.getSizeT(); 
     478      int externalC = includeC.isSelected() ? 1 : swap.getEffectiveSizeC(); 
    477479 
    478480      int numFiles = externalZ * externalT * externalC; 
     
    482484      int cDigits = ("" + externalC).length(); 
    483485 
    484       progress.setMaximum(2 * swap.getImageCount(in)); 
     486      progress.setMaximum(2 * swap.getImageCount()); 
    485487 
    486488      int star = out.lastIndexOf("."); 
     
    491493      // determine appropriate pixel type 
    492494 
    493       int type = swap.getPixelType(in); 
     495      int type = swap.getPixelType(); 
    494496      if (force && !writer.isSupportedType(out, type)) { 
    495497        int[] types = writer.getPixelTypes(out); 
     
    569571                  progress.setValue(2 * (plane + 1)); 
    570572                  plane++; 
    571                   int ndx = swap.getIndex(in, zPos, cPos, tPos); 
    572  
    573                   BufferedImage img = swap.openImage(in, ndx); 
     573                  int ndx = swap.getIndex(zPos, cPos, tPos); 
     574 
     575                  BufferedImage img = swap.openImage(ndx); 
    574576                  if (force &&  
    575                     !writer.isSupportedType(out, swap.getPixelType(in)))  
     577                    !writer.isSupportedType(out, swap.getPixelType()))  
    576578                  { 
    577579                    int pixelType = 0; 
     
    613615               
    614616              OMENode root = (OMENode)  
    615                 ((OMEXMLMetadataStore) swap.getMetadataStore(in)).getRoot(); 
     617                ((OMEXMLMetadataStore) swap.getMetadataStore()).getRoot(); 
    616618                 
    617619              // add TiffData element here  
     
    631633      } 
    632634 
    633       progress.setValue(2 * swap.getImageCount(in)); 
     635      progress.setValue(2 * swap.getImageCount()); 
    634636      progress.setString("Finishing"); 
    635637      if (writer != null) writer.close(); 
     
    637639      long end = System.currentTimeMillis(); 
    638640      double time = (end - start) / 1000.0; 
    639       long avg = (end - start) / (swap.getImageCount(in)); 
     641      long avg = (end - start) / (swap.getImageCount()); 
    640642      progress.setString(time + " s elapsed (" + avg + " ms/plane)"); 
    641643      progress.setValue(0); 
     
    679681  private void updateLabels(String pattern) { 
    680682    try { 
     683      swap.setId(pattern);  
     684 
    681685      String z = zLabel.getText(); 
    682686      z = z.substring(0, z.indexOf("<")); 
    683       z += "<1-" + swap.getSizeZ(pattern) + ">"; 
     687      z += "<1-" + swap.getSizeZ() + ">"; 
    684688      zLabel.setText(z); 
    685689 
    686690      String t = tLabel.getText(); 
    687691      t = t.substring(0, t.indexOf("<")); 
    688       t += "<1-" + swap.getSizeT(pattern) + ">"; 
     692      t += "<1-" + swap.getSizeT() + ">"; 
    689693      tLabel.setText(t); 
    690694 
    691695      String c = cLabel.getText(); 
    692696      c = c.substring(0, c.indexOf("<")); 
    693       c += "<1-" + swap.getEffectiveSizeC(pattern) + ">"; 
     697      c += "<1-" + swap.getEffectiveSizeC() + ">"; 
    694698      cLabel.setText(c); 
    695699       
  • trunk/loci/formats/AxisGuesser.java

    r2178 r2583  
    300300          System.out.print("Reading first file "); 
    301301          ImageReader reader = new ImageReader(); 
    302           String dimOrder = reader.getDimensionOrder(id); 
    303           int sizeZ = reader.getSizeZ(id); 
    304           int sizeT = reader.getSizeT(id); 
    305           int sizeC = reader.getSizeC(id); 
    306           boolean certain = reader.isOrderCertain(id); 
     302          reader.setId(id);  
     303          String dimOrder = reader.getDimensionOrder(); 
     304          int sizeZ = reader.getSizeZ(); 
     305          int sizeT = reader.getSizeT(); 
     306          int sizeC = reader.getSizeC(); 
     307          boolean certain = reader.isOrderCertain(); 
    307308          reader.close(); 
    308309          System.out.println("[done]"); 
  • trunk/loci/formats/ChannelMerger.java

    r2459 r2583  
    4242 
    4343  /** Determines whether the channels in the file can be merged. */ 
    44   public boolean canMerge(String id) throws FormatException, IOException { 
    45     int c = getSizeC(id); 
    46     return c > 1 && c <= 4 && !reader.isRGB(id); 
     44  public boolean canMerge() throws FormatException, IOException { 
     45    int c = getSizeC(); 
     46    return c > 1 && c <= 4 && !reader.isRGB(); 
    4747  } 
    4848 
    4949  // -- IFormatReader API methods -- 
    5050 
    51   /** Determines the number of images in the given file. */ 
    52   public int getImageCount(String id) throws FormatException, IOException { 
    53     int no = reader.getImageCount(id); 
    54     if (canMerge(id)) no /= getSizeC(id); 
     51  /* @see IFormatReader#getImageCount() */  
     52  public int getImageCount() throws FormatException, IOException { 
     53    int no = reader.getImageCount(); 
     54    if (canMerge()) no /= getSizeC(); 
    5555    return no; 
    5656  } 
    5757 
    58   /* @see IFormatReader#getDimensionOrder(String) */ 
    59   public String getDimensionOrder(String id) 
    60     throws FormatException, IOException 
    61   { 
    62     String order = reader.getDimensionOrder(id); 
    63     if (canMerge(id)) { 
     58  /* @see IFormatReader#getDimensionOrder() */ 
     59  public String getDimensionOrder() throws FormatException, IOException { 
     60    String order = reader.getDimensionOrder(); 
     61    if (canMerge()) { 
    6462      StringBuffer sb = new StringBuffer(order); 
    6563      while (order.indexOf("C") != 2) { 
     
    7371  } 
    7472 
    75   /** Checks if the images in the file are RGB. */ 
    76   public boolean isRGB(String id) throws FormatException, IOException { 
    77     return canMerge(id) || reader.isRGB(id); 
     73  /* @see IFormatReader#isRGB() */  
     74  public boolean isRGB() throws FormatException, IOException { 
     75    return canMerge() || reader.isRGB(); 
    7876  } 
    7977 
    80   /** Obtains the specified image from the given file. */ 
    81   public BufferedImage openImage(String id, int no) 
    82     throws FormatException, IOException 
    83   { 
    84     if (!canMerge(id)) return super.openImage(id, no); 
    85     int sizeC = getSizeC(id); 
    86     int[] nos = getZCTCoords(id, no); 
     78  /* @see IFormatReader#openImage(int) */  
     79  public BufferedImage openImage(int no) throws FormatException, IOException { 
     80    if (!canMerge()) return super.openImage(no); 
     81    int sizeC = getSizeC(); 
     82    int[] nos = getZCTCoords(no); 
    8783 
    8884    int z = nos[0], t = nos[2]; 
    89     String order = reader.getDimensionOrder(id); 
     85    String order = reader.getDimensionOrder(); 
    9086    int ic = order.indexOf("C") - 2; 
    9187    if (ic < 0 || ic > 2) { 
     
    9490    BufferedImage[] img = new BufferedImage[sizeC]; 
    9591    for (int c=0; c<sizeC; c++) { 
    96       img[c] = reader.openImage(id, reader.getIndex(id, z, c, t)); 
     92      img[c] = reader.openImage(reader.getIndex(z, c, t)); 
    9793    } 
    9894    return ImageTools.mergeChannels(img); 
     
    10399   * For convenience, the channels are sequential, i.e. "RRR...GGG...BBB". 
    104100   */ 
    105   public byte[] openBytes(String id, int no) 
    106     throws FormatException, IOException 
    107   { 
    108     if (!canMerge(id)) return super.openBytes(id, no); 
    109     int sizeC = getSizeC(id); 
    110     int[] nos = getZCTCoords(id, no); 
     101  public byte[] openBytes(int no) throws FormatException, IOException { 
     102    if (!canMerge()) return super.openBytes(no); 
     103    int sizeC = getSizeC(); 
     104    int[] nos = getZCTCoords( no); 
    111105    int z = nos[0], t = nos[2]; 
    112     String dimOrder = reader.getDimensionOrder(id); 
     106    String dimOrder = reader.getDimensionOrder(); 
    113107    int ic = dimOrder.indexOf("C") - 2; 
    114108    byte[] bytes = null; 
    115109    for (int c=0; c<sizeC; c++) { 
    116       byte[] b = reader.openBytes(id, reader.getIndex(id, z, c, t)); 
     110      byte[] b = reader.openBytes(reader.getIndex(z, c, t)); 
    117111 
    118112      if (c == 0) { 
     
    125119  } 
    126120 
    127   /** Obtains a thumbnail for the specified image from the given file. */ 
    128   public BufferedImage openThumbImage(String id, int no) 
     121  /* @see IFormatReader#openThumbImage(int) */  
     122  public BufferedImage openThumbImage(int no) 
    129123    throws FormatException, IOException 
    130124  { 
    131     if (!canMerge(id)) return super.openThumbImage(id, no); 
    132     return ImageTools.scale(openImage(id, no), getThumbSizeX(id), 
    133       getThumbSizeY(id), true); 
     125    if (!canMerge()) return super.openThumbImage(no); 
     126    return ImageTools.scale(openImage(no), getThumbSizeX(), 
     127      getThumbSizeY(), true); 
    134128  } 
    135129 
    136   public int getIndex(String id, int z, int c, int t) 
    137     throws FormatException, IOException 
     130  public int getIndex(int z, int c, int t) throws FormatException, IOException 
    138131  { 
    139     return FormatTools.getIndex(this, id, z, c, t); 
     132    return FormatTools.getIndex(this, z, c, t); 
    140133  } 
    141134 
    142   public int[] getZCTCoords(String id, int index) 
    143     throws FormatException, IOException 
    144   { 
    145     return FormatTools.getZCTCoords(this, id, index); 
     135  public int[] getZCTCoords(int index) throws FormatException, IOException { 
     136    return FormatTools.getZCTCoords(this, index); 
    146137  } 
    147138 
  • trunk/loci/formats/ChannelSeparator.java

    r2430 r2583  
    5252  // -- IFormatReader API methods -- 
    5353 
    54   /** Determines the number of images in the given file. */ 
    55   public int getImageCount(String id) throws FormatException, IOException { 
    56     return reader.isRGB(id) ? 
    57       (getSizeC(id) / reader.getEffectiveSizeC(id)) * reader.getImageCount(id) : 
    58       reader.getImageCount(id); 
     54  /* @see IFormatReader#getImageCount() */  
     55  public int getImageCount() throws FormatException, IOException { 
     56    return reader.isRGB() ? 
     57      (getSizeC() / reader.getEffectiveSizeC()) * reader.getImageCount() : 
     58      reader.getImageCount(); 
    5959  } 
    6060 
    61   /** 
    62    * Gets a five-character string representing 
    63    * the dimension order within the file. 
    64    */ 
    65   public String getDimensionOrder(String id) 
    66     throws FormatException, IOException 
    67   { 
    68     String order = super.getDimensionOrder(id); 
    69     if (reader.isRGB(id)) { 
     61  /* @see IFormatReader#getDimensionOrder() */  
     62  public String getDimensionOrder() throws FormatException, IOException { 
     63    String order = super.getDimensionOrder(); 
     64    if (reader.isRGB()) { 
    7065      String newOrder = "XYC"; 
    7166      if (order.indexOf("Z") > order.indexOf("T")) newOrder += "TZ"; 
     
    7671  } 
    7772 
    78   /** Checks if the images in the file are RGB. */ 
    79   public boolean isRGB(String id) { 
    80     return false; 
    81   } 
     73  /* @see IFormatReader#isRGB() */  
     74  public boolean isRGB() { return false; } 
    8275 
    83   /** Obtains the specified image from the given file. */ 
    84   public BufferedImage openImage(String id, int no) 
    85     throws FormatException, IOException 
    86   { 
    87     if (no < 0 || no >= getImageCount(id)) { 
     76  /* @see IFormatReader#openImage(int) */  
     77  public BufferedImage openImage(int no) throws FormatException, IOException { 
     78    if (no < 0 || no >= getImageCount()) { 
    8879      throw new FormatException("Invalid image number: " + no); 
    8980    } 
    9081 
    9182    int bytes = 0; 
    92     switch (getPixelType(id)) { 
     83    switch (getPixelType()) { 
    9384      case 0: 
    9485      case 1: 
     
    109100    } 
    110101 
    111     byte[] b = openBytes(id, no); 
     102    byte[] b = openBytes(no); 
    112103 
    113     if (getPixelType(id) == FormatTools.FLOAT) { 
     104    if (getPixelType() == FormatTools.FLOAT) { 
    114105      float[] f = new float[b.length / 4]; 
    115106      for (int i=0; i<b.length; i+=4) { 
    116         f[i/4] = Float.intBitsToFloat(DataTools.bytesToInt(b, i, 4, 
    117           isLittleEndian(id))); 
     107        f[i/4] = Float.intBitsToFloat(DataTools.bytesToInt(b, i, 4,  
     108          isLittleEndian())); 
    118109      } 
    119110      if (isNormalized()) f = DataTools.normalizeFloats(f); 
    120       return ImageTools.makeImage(f, getSizeX(id), getSizeY(id)); 
     111      return ImageTools.makeImage(f, getSizeX(), getSizeY()); 
    121112    } 
    122113 
    123     return ImageTools.makeImage(b, getSizeX(id), getSizeY(id), 1, false, 
    124       bytes, isLittleEndian(id)); 
     114    return ImageTools.makeImage(b, getSizeX(), getSizeY(), 1, false, 
     115      bytes, isLittleEndian()); 
    125116  } 
    126117 
    127   /** Obtains the specified image from the given file, as a byte array. */ 
    128   public byte[] openBytes(String id, int no) 
    129     throws FormatException, IOException 
    130   { 
    131     if (no < 0 || no >= getImageCount(id)) { 
     118  /* @see IFormatReader#openBytes(int) */  
     119  public byte[] openBytes(int no) throws FormatException, IOException { 
     120    if (no < 0 || no >= getImageCount()) { 
    132121      throw new FormatException("Invalid image number: " + no); 
    133122    } 
    134123 
    135     if (reader.isRGB(id)) { 
    136       int c = getSizeC(id) / reader.getEffectiveSizeC(id); 
     124    if (reader.isRGB()) { 
     125      int c = getSizeC() / reader.getEffectiveSizeC(); 
    137126      int source = no / c; 
    138127      int channel = no % c; 
    139       int series = getSeries(id); 
     128      int series = getSeries(); 
    140129 
    141130      if (source != lastImageIndex || series != lastImageSeries) { 
    142         lastImage = reader.openBytes(id, source); 
     131        lastImage = reader.openBytes(source); 
    143132        lastImageIndex = source; 
    144133        lastImageSeries = series; 
     
    146135 
    147136      return ImageTools.splitChannels(lastImage, c, 
    148         false, isInterleaved(id))[channel]; 
     137        false, isInterleaved())[channel]; 
    149138    } 
    150     else return reader.openBytes(id, no); 
     139    else return reader.openBytes(no); 
    151140  } 
    152141 
    153   /** Obtains a thumbnail for the specified image from the given file. */ 
    154   public BufferedImage openThumbImage(String id, int no) 
     142  /* @see IFormatReader#openThumbImage(int) */  
     143  public BufferedImage openThumbImage(int no)  
    155144    throws FormatException, IOException 
    156145  { 
    157     return ImageTools.scale(openImage(id, no), getThumbSizeX(id), 
    158       getThumbSizeY(id), true); 
     146    return ImageTools.scale(openImage(no), getThumbSizeX(), 
     147      getThumbSizeY(), true); 
    159148  } 
    160149 
     
    165154  } 
    166155 
    167   public int getIndex(String id, int z, int c, int t) 
    168     throws FormatException, IOException 
     156  public int getIndex(int z, int c, int t) throws FormatException, IOException 
    169157  { 
    170     return FormatTools.getIndex(this, id, z, c, t); 
     158    return FormatTools.getIndex(this, z, c, t); 
    171159  } 
    172160 
    173   public int[] getZCTCoords(String id, int index) 
    174     throws FormatException, IOException 
    175   { 
    176     return FormatTools.getZCTCoords(this, id, index); 
     161  public int[] getZCTCoords(int index) throws FormatException, IOException { 
     162    return FormatTools.getZCTCoords(this, index); 
    177163  } 
    178164 
  • trunk/loci/formats/DimensionSwapper.java

    r2564 r2583  
    4040  // -- IFormatReader API methods -- 
    4141 
    42   /* @see loci.formats.IFormatReader#getSizeX(String) */ 
    43   public int getSizeX(String id) throws FormatException, IOException { 
    44     return getCoreMetadata(id).sizeX[getSeries(id)];  
     42  /* @see loci.formats.IFormatReader#getSizeX() */ 
     43  public int getSizeX() throws FormatException, IOException { 
     44    return getCoreMetadata().sizeX[getSeries()];  
    4545  } 
    4646 
    47   /* @see loci.formats.IFormatReader#getSizeY(String) */ 
    48   public int getSizeY(String id) throws FormatException, IOException { 
    49     return getCoreMetadata(id).sizeY[getSeries(id)];  
     47  /* @see loci.formats.IFormatReader#getSizeY() */ 
     48  public int getSizeY() throws FormatException, IOException { 
     49    return getCoreMetadata().sizeY[getSeries()];  
    5050  } 
    5151   
    52   /* @see loci.formats.IFormatReader#getSizeZ(String) */ 
    53   public int getSizeZ(String id) throws FormatException, IOException { 
    54     return getCoreMetadata(id).sizeZ[getSeries(id)];  
     52  /* @see loci.formats.IFormatReader#getSizeZ() */ 
     53  public int getSizeZ() throws FormatException, IOException { 
     54    return getCoreMetadata().sizeZ[getSeries()];  
    5555  } 
    5656 
    57   /* @see loci.formats.IFormatReader#getSizeC(String) */ 
    58   public int getSizeC(String id) throws FormatException, IOException { 
    59     return getCoreMetadata(id).sizeC[getSeries(id)];  
     57  /* @see loci.formats.IFormatReader#getSizeC() */ 
     58  public int getSizeC() throws FormatException, IOException { 
     59    return getCoreMetadata().sizeC[getSeries()];  
    6060  } 
    6161 
    62   /* @see loci.formats.IFormatReader#getSizeT(String) */ 
    63   public int getSizeT(String id) throws FormatException, IOException { 
    64     return getCoreMetadata(id).sizeT[getSeries(id)];  
     62  /* @see loci.formats.IFormatReader#getSizeT() */ 
     63  public int getSizeT() throws FormatException, IOException { 
     64    return getCoreMetadata().sizeT[getSeries()];  
    6565  } 
    6666 
    67   /* @see loci.formats.IFormatReader#getDimensionOrder(String) */ 
    68   public String getDimensionOrder(String id)  
    69     throws FormatException, IOException  
    70   { 
    71     return getCoreMetadata(id).currentOrder[getSeries(id)];  
     67  /* @see loci.formats.IFormatReader#getDimensionOrder() */ 
     68  public String getDimensionOrder() throws FormatException, IOException { 
     69    return getCoreMetadata().currentOrder[getSeries()];  
    7270  } 
    7371 
     
    8078   * positions 0 and 1 (although X and Y can be reversed). 
    8179   */ 
    82   public void swapDimensions(String id, String order)  
    83     throws FormatException, IOException  
     80  public void swapDimensions(String order)  throws FormatException, IOException  
    8481  { 
    8582    if (order == null) return; 
    8683     
    87     String oldOrder = getDimensionOrder(id);  
     84    String oldOrder = getDimensionOrder();  
    8885     
    8986    if (order.equals(oldOrder)) return; 
     
    9794    int tndx = oldOrder.indexOf("T"); 
    9895 
    99     dims[xndx] = getSizeX(id); 
    100     dims[yndx] = getSizeY(id); 
    101     dims[zndx] = getSizeZ(id); 
    102     dims[cndx] = getSizeC(id); 
    103     dims[tndx] = getSizeT(id); 
     96    dims[xndx] = getSizeX(); 
     97    dims[yndx] = getSizeY(); 
     98    dims[zndx] = getSizeZ(); 
     99    dims[cndx] = getSizeC(); 
     100    dims[tndx] = getSizeT(); 
    104101 
    105     int series = getSeries(id); 
    106     CoreMetadata core = getCoreMetadata(id); 
     102    int series = getSeries(); 
     103    CoreMetadata core = getCoreMetadata(); 
    107104 
    108105    core.sizeX[series] = dims[order.indexOf("X")]; 
     
    113110    core.currentOrder[series] = order; 
    114111 
    115     MetadataStore store = getMetadataStore(id); 
     112    MetadataStore store = getMetadataStore(); 
    116113    store.setPixels(new Integer(dims[xndx]), new Integer(dims[yndx]),  
    117114      new Integer(dims[zndx]), new Integer(dims[cndx]),  
  • trunk/loci/formats/FileStitcher.java

    r2564 r2583  
    222222  } 
    223223 
    224   /* @see IFormatReader#getImageCount(String) */ 
    225   public int getImageCount(String id) throws FormatException, IOException { 
     224  /* @see IFormatReader#setId(String) */ 
     225  public void setId(String id) throws FormatException, IOException { 
    226226    if (!id.equals(currentId)) initFile(id); 
    227     return totalImages[getSeries(id)]; 
    228   } 
    229  
    230   /* @see IFormatReader#isRGB(String) */ 
    231   public boolean isRGB(String id) throws FormatException, IOException { 
    232     if (!id.equals(currentId)) initFile(id); 
    233     return reader.isRGB(files[0]); 
    234   } 
    235  
    236   /* @see IFormatReader#getSizeX(String) */ 
    237   public int getSizeX(String id) throws FormatException, IOException { 
    238     if (!id.equals(currentId)) initFile(id); 
    239     return width[getSeries(id)]; 
    240   } 
    241  
    242   /* @see IFormatReader#getSizeY(String) */ 
    243   public int getSizeY(String id) throws FormatException, IOException { 
    244     if (!id.equals(currentId)) initFile(id); 
    245     return height[getSeries(id)]; 
    246   } 
    247  
    248   /* @see IFormatReader#getSizeZ(String) */ 
    249   public int getSizeZ(String id) throws FormatException, IOException { 
    250     if (!id.equals(currentId)) initFile(id); 
    251     return totalSizeZ[getSeries(id)]; 
    252   } 
    253  
    254   /* @see IFormatReader#getSizeC(String) */ 
    255   public int getSizeC(String id) throws FormatException, IOException { 
    256     if (!id.equals(currentId)) initFile(id); 
    257     return totalSizeC[getSeries(id)]; 
    258   } 
    259  
    260   /* @see IFormatReader#getSizeT(String) */ 
    261   public int getSizeT(String id) throws FormatException, IOException { 
    262     if (!id.equals(currentId)) initFile(id); 
    263     return totalSizeT[getSeries(id)]; 
    264   } 
    265  
    266   /* @see IFormatReader#getPixelType(String) */ 
    267   public int getPixelType(String id) throws FormatException, IOException { 
    268     if (!id.equals(currentId)) initFile(id); 
    269     return reader.getPixelType(files[0]); 
    270   } 
    271  
    272   /* @see IFormatReader#getEffectiveSizeC(String) */ 
    273   public int getEffectiveSizeC(String id) throws FormatException, IOException { 
    274     return getImageCount(id) / (getSizeZ(id) * getSizeT(id)); 
    275   } 
    276  
    277   /* @see IFormatReader#getRGBChannelCount(String) */ 
    278   public int getRGBChannelCount(String id) throws FormatException, IOException { 
    279     return getSizeC(id) / getEffectiveSizeC(id); 
    280   } 
    281  
    282   /* @see IFormatReader#getChannelDimLengths(String) */ 
    283   public int[] getChannelDimLengths(String id) 
    284     throws FormatException, IOException 
    285   { 
    286     if (!id.equals(currentId)) initFile(id); 
    287     int sno = getSeries(id); 
     227  } 
     228 
     229  /* @see IFormatReader#getImageCount() */ 
     230  public int getImageCount() throws FormatException, IOException { 
     231    return totalImages[getSeries()]; 
     232  } 
     233 
     234  /* @see IFormatReader#isRGB() */ 
     235  public boolean isRGB() throws FormatException, IOException { 
     236    return reader.isRGB(); 
     237  } 
     238 
     239  /* @see IFormatReader#getSizeX() */ 
     240  public int getSizeX() throws FormatException, IOException { 
     241    return width[getSeries()]; 
     242  } 
     243 
     244  /* @see IFormatReader#getSizeY() */ 
     245  public int getSizeY() throws FormatException, IOException { 
     246    return height[getSeries()]; 
     247  } 
     248 
     249  /* @see IFormatReader#getSizeZ() */ 
     250  public int getSizeZ() throws FormatException, IOException { 
     251    return totalSizeZ[getSeries()]; 
     252  } 
     253 
     254  /* @see IFormatReader#getSizeC() */ 
     255  public int getSizeC() throws FormatException, IOException { 
     256    return totalSizeC[getSeries()]; 
     257  } 
     258 
     259  /* @see IFormatReader#getSizeT() */ 
     260  public int getSizeT() throws FormatException, IOException { 
     261    return totalSizeT[getSeries()]; 
     262  } 
     263 
     264  /* @see IFormatReader#getPixelType() */ 
     265  public int getPixelType() throws FormatException, IOException { 
     266    return reader.getPixelType(); 
     267  } 
     268 
     269  /* @see IFormatReader#getEffectiveSizeC() */ 
     270  public int getEffectiveSizeC() throws FormatException, IOException { 
     271    return getImageCount() / (getSizeZ() * getSizeT()); 
     272  } 
     273 
     274  /* @see IFormatReader#getRGBChannelCount() */ 
     275  public int getRGBChannelCount() throws FormatException, IOException { 
     276    return getSizeC() / getEffectiveSizeC(); 
     277  } 
     278 
     279  /* @see IFormatReader#getChannelDimLengths() */ 
     280  public int[] getChannelDimLengths() throws FormatException, IOException { 
     281    int sno = getSeries(); 
    288282    int len = lenC[sno].length; 
    289283    int[] cLengths = new int[len]; 
     
    292286  } 
    293287 
    294   /* @see IFormatReader#getChannelDimTypes(String) */ 
    295   public String[] getChannelDimTypes(String id) 
    296     throws FormatException, IOException 
    297   { 
    298     int sno = getSeries(id); 
     288  /* @see IFormatReader#getChannelDimTypes() */ 
     289  public String[] getChannelDimTypes() throws FormatException, IOException { 
     290    int sno = getSeries(); 
    299291    int len = lenC[sno].length; 
    300292    String[] cTypes = new String[len]; 
     
    303295  } 
    304296 
    305   /* @see IFormatReader#getThumbSizeX(String) */ 
    306   public int getThumbSizeX(String id) throws FormatException, IOException { 
    307     if (!id.equals(currentId)) initFile(id); 
    308     return reader.getThumbSizeX(files[0]); 
    309   } 
    310  
    311   /* @see IFormatReader#getThumbSizeY(String) */ 
    312   public int getThumbSizeY(String id) throws FormatException, IOException { 
    313     if (!id.equals(currentId)) initFile(id); 
    314     return reader.getThumbSizeY(files[0]); 
    315   } 
    316  
    317   /* @see IFormatReader#isLittleEndian(String) */ 
    318   public boolean isLittleEndian(String id) throws FormatException, IOException { 
    319     if (!id.equals(currentId)) initFile(id); 
    320     return reader.isLittleEndian(files[0]); 
    321   } 
    322  
    323   /** 
    324    * Gets a five-character string representing the 
    325    * dimension order across the file series. 
    326    */ 
    327   public String getDimensionOrder(String id) 
    328     throws FormatException, IOException 
    329   { 
    330     if (!id.equals(currentId)) initFile(id); 
    331     return order[getSeries(id)]; 
    332   } 
    333  
    334   /* @see IFormatReader#isOrderCertain(String) */ 
    335   public boolean isOrderCertain(String id) throws FormatException, IOException { 
    336     if (!id.equals(currentId)) initFile(id); 
    337     return ag[getSeries(id)].isCertain(); 
    338   } 
    339  
    340   /* @see IFormatReader#isInterleaved(String) */ 
    341   public boolean isInterleaved(String id) throws FormatException, IOException { 
    342     if (!id.equals(currentId)) initFile(id); 
    343     return reader.isInterleaved(files[0]); 
    344   } 
    345  
    346   /* @see IFormatReader#isInterleaved(String, int) */ 
    347   public boolean isInterleaved(String id, int subC) 
    348     throws FormatException, IOException 
    349   { 
    350     if (!id.equals(currentId)) initFile(id); 
    351     return reader.isInterleaved(files[0], subC); 
    352   } 
    353  
    354   /** Obtains the specified image from the given file series. */ 
    355   public BufferedImage openImage(String id, int no) 
    356     throws FormatException, IOException 
    357   { 
    358     int[] q = computeIndices(id, no); 
     297  /* @see IFormatReader#getThumbSizeX() */ 
     298  public int getThumbSizeX() throws FormatException, IOException { 
     299    return reader.getThumbSizeX(); 
     300  } 
     301 
     302  /* @see IFormatReader#getThumbSizeY() */ 
     303  public int getThumbSizeY() throws FormatException, IOException { 
     304    return reader.getThumbSizeY(); 
     305  } 
     306 
     307  /* @see IFormatReader#isLittleEndian() */ 
     308  public boolean isLittleEndian() throws FormatException, IOException { 
     309    return reader.isLittleEndian(); 
     310  } 
     311 
     312  /* @see IFormatReader#getDimensionOrder() */  
     313  public String getDimensionOrder() throws FormatException, IOException { 
     314    return order[getSeries()]; 
     315  } 
     316 
     317  /* @see IFormatReader#isOrderCertain() */ 
     318  public boolean isOrderCertain() throws FormatException, IOException { 
     319    return ag[getSeries()].isCertain(); 
     320  } 
     321 
     322  /* @see IFormatReader#isInterleaved() */ 
     323  public boolean isInterleaved() throws FormatException, IOException { 
     324    return reader.isInterleaved(); 
     325  } 
     326 
     327  /* @see IFormatReader#isInterleaved(int) */ 
     328  public boolean isInterleaved(int subC) throws FormatException, IOException { 
     329    return reader.isInterleaved(subC); 
     330  } 
     331 
     332  /* @see IFormatReader#openImage(int) */  
     333  public BufferedImage openImage(int no) throws FormatException, IOException { 
     334    int[] q = computeIndices(no); 
    359335    int fno = q[0], ino = q[1]; 
    360     if (ino < readers[fno].getImageCount(files[fno])) { 
    361       return readers[fno].openImage(files[fno], ino); 
     336    readers[fno].setId(files[fno]);  
     337    if (ino < readers[fno].getImageCount()) { 
     338      return readers[fno].openImage(ino); 
    362339    } 
    363340    // return a blank image to cover for the fact that 
    364341    // this file does not contain enough image planes 
    365     int sno = getSeries(id); 
     342    int sno = getSeries(); 
    366343    if (blankImage[sno] == null) { 
    367344      blankImage[sno] = ImageTools.blankImage(width[sno], height[sno], 
    368         sizeC[sno], getPixelType(currentId)); 
     345        sizeC[sno], getPixelType()); 
    369346    } 
    370347    return blankImage[sno]; 
    371348  } 
    372  
    373   /** Obtains the specified image from the given file series as a byte array. */ 
    374   public byte[] openBytes(String id, int no) 
    375     throws FormatException, IOException 
    376   { 
    377     int[] q = computeIndices(id, no); 
     349  
     350  /* @see IFormatReader#openBytes(int) */ 
     351  public byte[] openBytes(int no) throws FormatException, IOException { 
     352    int[] q = computeIndices(no); 
    378353    int fno = q[0], ino = q[1]; 
    379     if (ino < readers[fno].getImageCount(files[fno])) { 
    380       return readers[fno].openBytes(files[fno], ino); 
     354    readers[fno].setId(files[fno]);  
     355    if (ino < readers[fno].getImageCount()) { 
     356      return readers[fno].openBytes(ino); 
    381357    } 
    382358    // return a blank image to cover for the fact that 
    383359    // this file does not contain enough image planes 
    384     int sno = getSeries(id); 
     360    int sno = getSeries(); 
    385361    if (blankBytes[sno] == null) { 
    386       int bytes = FormatTools.getBytesPerPixel(getPixelType(currentId)); 
     362      int bytes = FormatTools.getBytesPerPixel(getPixelType()); 
    387363      blankBytes[sno] = new byte[width[sno] * height[sno] * 
    388         bytes * getRGBChannelCount(id)]; 
     364        bytes * getRGBChannelCount()]; 
    389365    } 
    390366    return blankBytes[sno]; 
    391367  } 
    392368 
    393   /* @see IFormatReader#openBytes(String, int, byte[]) */ 
    394   public byte[] openBytes(String id, int no, byte[] buf) 
    395     throws FormatException, IOException 
    396   { 
    397     int[] q = computeIndices(id, no); 
     369  /* @see IFormatReader#openBytes(int, byte[]) */ 
     370  public byte[] openBytes(int no, byte[] buf) 
     371    throws FormatException, IOException 
     372  { 
     373    int[] q = computeIndices(no); 
    398374    int fno = q[0], ino = q[1]; 
    399     return readers[fno].openBytes(files[fno], ino, buf); 
    400   } 
    401  
    402   /* @see IFormatReader#openThumbImage(String, int) */ 
    403   public BufferedImage openThumbImage(String id, int no) 
    404     throws FormatException, IOException 
    405   { 
    406     int[] q = computeIndices(id, no); 
     375    readers[fno].setId(files[fno]);  
     376    return readers[fno].openBytes(ino, buf); 
     377  } 
     378 
     379  /* @see IFormatReader#openThumbImage(int) */ 
     380  public BufferedImage openThumbImage(int no) 
     381    throws FormatException, IOException 
     382  { 
     383    int[] q = computeIndices(no); 
    407384    int fno = q[0], ino = q[1]; 
    408     if (ino < readers[fno].getImageCount(files[fno])) { 
    409       return readers[fno].openThumbImage(files[fno], ino); 
     385    readers[fno].setId(files[fno]);  
     386    if (ino < readers[fno].getImageCount()) { 
     387      return readers[fno].openThumbImage(ino); 
    410388    } 
    411389    // return a blank image to cover for the fact that 
    412390    // this file does not contain enough image planes 
    413     int sno = getSeries(id); 
     391    int sno = getSeries(); 
    414392    if (blankThumb[sno] == null) { 
    415       blankThumb[sno] = ImageTools.blankImage(getThumbSizeX(id), 
    416         getThumbSizeY(id), sizeC[sno], FormatTools.UINT8); 
     393      blankThumb[sno] = ImageTools.blankImage(getThumbSizeX(), 
     394        getThumbSizeY(), sizeC[sno], FormatTools.UINT8); 
    417395    } 
    418396    return blankThumb[sno]; 
    419397  } 
    420398 
    421   /* @see IFormatReader#openThumbImage(String, int) */ 
    422   public byte[] openThumbBytes(String id, int no) 
    423     throws FormatException, IOException 
    424   { 
    425     int[] q = computeIndices(id, no); 
     399  /* @see IFormatReader#openThumbBytes(int) */ 
     400  public byte[] openThumbBytes(int no) throws FormatException, IOException { 
     401    int[] q = computeIndices(no); 
    426402    int fno = q[0], ino = q[1]; 
    427     if (ino < readers[fno].getImageCount(files[fno])) { 
    428       return readers[fno].openThumbBytes(files[fno], ino); 
     403    readers[fno].setId(files[fno]);  
     404    if (ino < readers[fno].getImageCount()) { 
     405      return readers[fno].openThumbBytes(ino); 
    429406    } 
    430407    // return a blank image to cover for the fact that 
    431408    // this file does not contain enough image planes 
    432     int sno = getSeries(id); 
     409    int sno = getSeries(); 
    433410    if (blankThumbBytes[sno] == null) { 
    434       blankThumbBytes[sno] = new byte[getThumbSizeX(id) * getThumbSizeY(id) * 
    435         getRGBChannelCount(id)]; 
     411      blankThumbBytes[sno] = new byte[getThumbSizeX() * getThumbSizeY() * 
     412        getRGBChannelCount()]; 
    436413    } 
    437414    return blankThumbBytes[sno]; 
     
    464441  } 
    465442 
    466   /* @see IFormatReader#getSeriesCount(String) */ 
    467   public int getSeriesCount(String id) throws FormatException, IOException { 
    468     if (!id.equals(currentId)) initFile(id); 
    469     return reader.getSeriesCount(files[0]); 
    470   } 
    471  
    472   /* @see IFormatReader#setSeries(String, int) */ 
    473   public void setSeries(String id, int no) throws FormatException, IOException { 
    474     if (!id.equals(currentId)) initFile(id); 
    475     reader.setSeries(files[0], no); 
    476   } 
    477  
    478   /* @see IFormatReader#getSeries(String) */ 
    479   public int getSeries(String id) throws FormatException, IOException { 
    480     if (!id.equals(currentId)) initFile(id); 
    481     return reader.getSeries(files[0]); 
     443  /* @see IFormatReader#getSeriesCount() */ 
     444  public int getSeriesCount() throws FormatException, IOException { 
     445    return reader.getSeriesCount(); 
     446  } 
     447 
     448  /* @see IFormatReader#setSeries(int) */ 
     449  public void setSeries(int no) throws FormatException, IOException { 
     450    reader.setSeries(no); 
     451  } 
     452 
     453  /* @see IFormatReader#getSeries() */ 
     454  public int getSeries() throws FormatException, IOException { 
     455    return reader.getSeries(); 
    482456  } 
    483457 
     
    496470 
    497471  /* @see IFormatReader#getUsedFiles() */ 
    498   public String[] getUsedFiles(String id) throws FormatException, IOException { 
    499     if (!id.equals(currentId)) initFile(id); 
    500  
     472  public String[] getUsedFiles() throws FormatException, IOException { 
    501473    // returning the files list directly here is fast, since we do not 
    502474    // have to call initFile on each constituent file; but we can only do so 
    503475    // when each constituent file does not itself have multiple used files 
    504476 
    505     if (reader.getUsedFiles(files[0]).length > 1) { 
     477    if (reader.getUsedFiles().length > 1) { 
    506478      // each constituent file has multiple used files; we must build the list 
    507479      // this could happen with, e.g., a stitched collection of ICS/IDS pairs 
     
    511483        int total = 0; 
    512484        for (int i=0; i<files.length; i++) { 
    513           used[i] = readers[i].getUsedFiles(files[i]); 
     485          readers[i].setId(files[i]);  
     486          used[i] = readers[i].getUsedFiles(); 
    514487          total += used[i].length; 
    515488        } 
     
    531504  public String getCurrentFile() { return currentId; } 
    532505 
    533   /* @see IFormatReader#getIndex(String, int, int, int) */ 
    534   public int getIndex(String id, int z, int c, int t) 
    535     throws FormatException, IOException 
    536   { 
    537     return FormatTools.getIndex(this, id, z, c, t); 
    538   } 
    539  
    540   /* @see IFormatReader#getZCTCoords(String, int) */ 
    541   public int[] getZCTCoords(String id, int index) 
    542     throws FormatException, IOException 
    543   { 
    544     return FormatTools.getZCTCoords(this, id, index); 
    545   } 
    546  
    547   /* @see IFormatReader#getMetadataValue(String, String) */ 
    548   public Object getMetadataValue(String id, String field) 
    549     throws FormatException, IOException 
    550   { 
    551     if (!id.equals(currentId)) initFile(id); 
    552     return reader.getMetadataValue(files[0], field); 
    553   } 
    554  
    555   /* @see IFormatReader#getMetadata(String) */ 
    556   public Hashtable getMetadata(String id) throws FormatException, IOException { 
    557     if (!id.equals(currentId)) initFile(id); 
    558     return reader.getMetadata(files[0]); 
    559   } 
    560  
    561   /* @see IFormatReader#getCoreMetadata(String) */ 
    562   public CoreMetadata getCoreMetadata(String id) 
    563     throws FormatException, IOException 
    564   { 
    565     if (!id.equals(currentId)) initFile(id); 
    566     return reader.getCoreMetadata(files[0]); 
     506  /* @see IFormatReader#getIndex(int, int, int) */ 
     507  public int getIndex(int z, int c, int t) throws FormatException, IOException 
     508  { 
     509    return FormatTools.getIndex(this, z, c, t); 
     510  } 
     511 
     512  /* @see IFormatReader#getZCTCoords(int) */ 
     513  public int[] getZCTCoords(int index) throws FormatException, IOException { 
     514    return FormatTools.getZCTCoords(this, index); 
     515  } 
     516 
     517  /* @see IFormatReader#getMetadataValue(String) */ 
     518  public Object getMetadataValue(String field) 
     519    throws FormatException, IOException 
     520  { 
     521    return reader.getMetadataValue(field); 
     522  } 
     523 
     524  /* @see IFormatReader#getMetadata() */ 
     525  public Hashtable getMetadata() throws FormatException, IOException { 
     526    return reader.getMetadata(); 
     527  } 
     528 
     529  /* @see IFormatReader#getCoreMetadata() */ 
     530  public CoreMetadata getCoreMetadata() throws FormatException, IOException { 
     531    return reader.getCoreMetadata(); 
    567532  } 
    568533 
     
    582547  } 
    583548 
    584   /* @see IFormatReader#getMetadataStore(String) */ 
    585   public MetadataStore getMetadataStore(String id) 
    586     throws FormatException, IOException 
    587   { 
    588     if (!id.equals(currentId)) initFile(id); 
    589     return reader.getMetadataStore(files[0]); 
    590   } 
    591  
    592   /* @see IFormatReader#getMetadataStoreRoot(String) */ 
    593   public Object getMetadataStoreRoot(String id) 
    594     throws FormatException, IOException 
    595   { 
    596     if (!id.equals(currentId)) initFile(id); 
    597     return reader.getMetadataStoreRoot(files[0]); 
     549  /* @see IFormatReader#getMetadataStore() */ 
     550  public MetadataStore getMetadataStore() throws FormatException, IOException 
     551  { 
     552    return reader.getMetadataStore(); 
     553  } 
     554 
     555  /* @see IFormatReader#getMetadataStoreRoot() */ 
     556  public Object getMetadataStoreRoot() throws FormatException, IOException { 
     557    return reader.getMetadataStoreRoot(); 
    598558  } 
    599559 
     
    601561  public boolean testRead(String[] args) throws FormatException, IOException { 
    602562    return FormatTools.testRead(this, args); 
     563  } 
     564 
     565  // -- Deprecated IFormatReader API methods -- 
     566 
     567  /** @deprecated Replaced by {@link getImageCount()} */ 
     568  public int getImageCount(String id) throws FormatException, IOException { 
     569    if (!id.equals(currentId)) setId(id); 
     570    return getImageCount();  
     571  } 
     572 
     573  /** @deprecated Replaced by {@link isRGB()} */ 
     574  public boolean isRGB(String id) throws FormatException, IOException { 
     575    if (!id.equals(currentId)) setId(id); 
     576    return isRGB();  
     577  } 
     578 
     579  /** @deprecated Replaced by {@link getSizeX()} */ 
     580  public int getSizeX(String id) throws FormatException, IOException { 
     581    if (!id.equals(currentId)) setId(id); 
     582    return getSizeX();  
     583  } 
     584 
     585  /** @deprecated Replaced by {@link getSizeY()} */ 
     586  public int getSizeY(String id) throws FormatException, IOException { 
     587    if (!id.equals(currentId)) setId(id); 
     588    return getSizeY();  
     589  } 
     590 
     591  /** @deprecated Replaced by {@link getSizeZ()} */ 
     592  public int getSizeZ(String id) throws FormatException, IOException { 
     593    if (!id.equals(currentId)) setId(id); 
     594    return getSizeZ();  
     595  } 
     596 
     597  /** @deprecated Replaced by {@link getSizeC()} */ 
     598  public int getSizeC(String id) throws FormatException, IOException { 
     599    if (!id.equals(currentId)) setId(id); 
     600    return getSizeC();  
     601  } 
     602 
     603  /** @deprecated Replaced by {@link getSizeT()} */ 
     604  public int getSizeT(String id) throws FormatException, IOException { 
     605    if (!id.equals(currentId)) setId(id); 
     606    return getSizeT();  
     607  } 
     608 
     609  /** @deprecated Replaced by {@link getPixelType()} */ 
     610  public int getPixelType(String id) throws FormatException, IOException { 
     611    if (!id.equals(currentId)) setId(id); 
     612    return getPixelType();   
     613  } 
     614 
     615  /** @deprecated Replaced by {@link getEffectiveSizeC()} */ 
     616  public int getEffectiveSizeC(String id) throws FormatException, IOException { 
     617    if (!id.equals(currentId)) setId(id); 
     618    return getImageCount() / (getSizeZ() * getSizeT()); 
     619  } 
     620 
     621  /** @deprecated Replaced by {@link getRGBChannelCount()} */ 
     622  public int getRGBChannelCount(String id) throws FormatException, IOException { 
     623    if (!id.equals(currentId)) setId(id); 
     624    return getSizeC() / getEffectiveSizeC(); 
     625  } 
     626 
     627  /** @deprecated Replaced by {@link getChannelDimLengths()} */ 
     628  public int[] getChannelDimLengths(String id) 
     629    throws FormatException, IOException 
     630  { 
     631    if (!id.equals(currentId)) setId(id); 
     632    int sno = getSeries(); 
     633    int len = lenC[sno].length; 
     634    int[] cLengths = new int[len]; 
     635    System.arraycopy(lenC[sno], 0, cLengths, 0, len); 
     636    return cLengths; 
     637  } 
     638 
     639  /** @deprecated Replaced by {@link getChannelDimTypes()} */ 
     640  public String[] getChannelDimTypes(String id) 
     641    throws FormatException, IOException 
     642  { 
     643    if (!id.equals(currentId)) setId(id); 
     644    int sno = getSeries(); 
     645    int len = lenC[sno].length; 
     646    String[] cTypes = new String[len]; 
     647    Arrays.fill(cTypes, FormatTools.CHANNEL); 
     648    return cTypes; 
     649  } 
     650 
     651  /** @deprecated Replaced by {@link getThumbSizeX()} */ 
     652  public int getThumbSizeX(String id) throws FormatException, IOException { 
     653    if (!id.equals(currentId)) setId(id); 
     654    return reader.getThumbSizeX(); 
     655  } 
     656 
     657  /** @deprecated Replaced by {@link getThumbSizeY()} */ 
     658  public int getThumbSizeY(String id) throws FormatException, IOException { 
     659    if (!id.equals(currentId)) setId(id); 
     660    return reader.getThumbSizeY(); 
     661  } 
     662 
     663  /** @deprecated Replaced by {@link isLittleEndian()} */ 
     664  public boolean isLittleEndian(String id) throws FormatException, IOException { 
     665    if (!id.equals(currentId)) setId(id); 
     666    return reader.isLittleEndian(); 
     667  } 
     668 
     669  /** @deprecated Replaced by {@link getDimensionOrder()} */  
     670  public String getDimensionOrder(String id) 
     671    throws FormatException, IOException 
     672  { 
     673    if (!id.equals(currentId)) setId(id); 
     674    return order[getSeries()]; 
     675  } 
     676 
     677  /** @deprecated Replaced by {@link isOrderCertain()} */ 
     678  public boolean isOrderCertain(String id) throws FormatException, IOException { 
     679    if (!id.equals(currentId)) setId(id); 
     680    return ag[getSeries()].isCertain(); 
     681  } 
     682 
     683  /** @deprecated Replaced by {@link isInterleaved()} */ 
     684  public boolean isInterleaved(String id) throws FormatException, IOException { 
     685    if (!id.equals(currentId)) setId(id); 
     686    return reader.isInterleaved(); 
     687  } 
     688 
     689  /** @deprecated Replaced by {@link isInterleaved(int)} */ 
     690  public boolean isInterleaved(String id, int subC) 
     691    throws FormatException, IOException 
     692  { 
     693    if (!id.equals(currentId)) setId(id); 
     694    return reader.isInterleaved(subC); 
     695  } 
     696 
     697  /** @deprecated Replaced by {@link openImage(int)} */  
     698  public BufferedImage openImage(String id, int no) 
     699    throws FormatException, IOException 
     700  { 
     701    if (!id.equals(currentId)) setId(id); 
     702    return openImage(no);  
     703  } 
     704 
     705  /** @deprecated Replaced by {@link openBytes(int)} */  
     706  public byte[] openBytes(String id, int no) 
     707    throws FormatException, IOException 
     708  { 
     709    if (!id.equals(currentId)) setId(id); 
     710    return openBytes(no);  
     711  } 
     712 
     713  /** @deprecated Replaced by {@link openBytes(int, byte[]) */ 
     714  public byte[] openBytes(String id, int no, byte[] buf) 
     715    throws FormatException, IOException 
     716  { 
     717    if (!id.equals(currentId)) setId(id); 
     718    return openBytes(no, buf);  
     719  } 
     720 
     721  /** @deprecated Replaced by {@link openThumbImage(int)} */ 
     722  public BufferedImage openThumbImage(String id, int no) 
     723    throws FormatException, IOException 
     724  { 
     725    if (!id.equals(currentId)) setId(id); 
     726    return openThumbImage(no);  
     727  } 
     728 
     729  /** @deprecated Replaced by {@link openThumbImage(int)} */ 
     730  public byte[] openThumbBytes(String id, int no) 
     731    throws FormatException, IOException 
     732  { 
     733    if (!id.equals(currentId)) setId(id); 
     734    return openThumbBytes(no);  
     735  } 
     736 
     737  /** @deprecated Replaced by {@link getSeriesCount()} */ 
     738  public int getSeriesCount(String id) throws FormatException, IOException { 
     739    if (!id.equals(currentId)) setId(id); 
     740    return reader.getSeriesCount(); 
     741  } 
     742 
     743  /** @deprecated Replaced by {@link setSeries(int)} */ 
     744  public void setSeries(String id, int no) throws FormatException, IOException { 
     745    if (!id.equals(currentId)) setId(id); 
     746    reader.setSeries(no); 
     747  } 
     748 
     749  /** @deprecated Replaced by {@link getSeries()} */ 
     750  public int getSeries(String id) throws FormatException, IOException { 
     751    if (!id.equals(currentId)) setId(id); 
     752    return reader.getSeries(); 
     753  } 
     754 
     755  /** @deprecated Replaced by {@link getUsedFiles()} */ 
     756  public String[] getUsedFiles(String id) throws FormatException, IOException { 
     757    if (!id.equals(currentId)) setId(id); 
     758    return getUsedFiles(); 
     759  } 
     760 
     761  /** @deprecated Replaced by {@link getIndex(int, int, int)} */ 
     762  public int getIndex(String id, int z, int c, int t) 
     763    throws FormatException, IOException 
     764  { 
     765    if (!id.equals(currentId)) setId(id); 
     766    return FormatTools.getIndex(this, z, c, t); 
     767  } 
     768 
     769  /** @deprecated Replaced by {@link getZCTCoords(int)} */ 
     770  public int[] getZCTCoords(String id, int index) 
     771    throws FormatException, IOException 
     772  { 
     773    if (!id.equals(currentId)) setId(id); 
     774    return FormatTools.getZCTCoords(this, index); 
     775  } 
     776 
     777  /** @deprecated Replaced by {@link getMetadataValue(String)} */ 
     778  public Object getMetadataValue(String id, String field) 
     779    throws FormatException, IOException 
     780  { 
     781    if (!id.equals(currentId)) setId(id); 
     782    return reader.getMetadataValue(field); 
     783  } 
     784 
     785  /** @deprecated Replaced by {@link getMetadata()} */ 
     786  public Hashtable getMetadata(String id) throws FormatException, IOException { 
     787    if (!id.equals(currentId)) setId(id); 
     788    return reader.getMetadata(); 
     789  } 
     790 
     791  /** @deprecated Replaced by {@link getCoreMetadata()} */ 
     792  public CoreMetadata getCoreMetadata(String id) 
     793    throws FormatException, IOException 
     794  { 
     795    if (!id.equals(currentId)) setId(id); 
     796    return reader.getCoreMetadata(); 
     797  } 
     798 
     799  /** @deprecated Replaced by {@link getMetadataStore()} */ 
     800  public MetadataStore getMetadataStore(String id) 
     801    throws FormatException, IOException 
     802  { 
     803    if (!id.equals(currentId)) setId(id); 
     804    return reader.getMetadataStore(); 
     805  } 
     806 
     807  /** @deprecated Replaced by {@link getMetadataStoreRoot()} */ 
     808  public Object getMetadataStoreRoot(String id) 
     809    throws FormatException, IOException 
     810  { 
     811    if (!id.equals(currentId)) setId(id); 
     812    return reader.getMetadataStoreRoot(); 
    603813  } 
    604814 
     
    724934    } 
    725935 
    726     String f0 = files[0]; 
    727  
    728     int seriesCount = reader.getSeriesCount(f0); 
     936    reader.setId(files[0]); 
     937 
     938    int seriesCount = reader.getSeriesCount(); 
    729939    ag = new AxisGuesser[seriesCount]; 
    730940    blankImage = new BufferedImage[seriesCount]; 
     
    750960    // analyze first file; assume each file has the same parameters 
    751961 
    752     int oldSeries = reader.getSeries(f0); 
     962    int oldSeries = reader.getSeries(); 
    753963    for (int i=0; i<seriesCount; i++) { 
    754       reader.setSeries(f0, i); 
    755       width[i] = reader.getSizeX(f0); 
    756       height[i] = reader.getSizeY(f0); 
    757       imagesPerFile[i] = reader.getImageCount(f0); 
     964      reader.setSeries(i); 
     965      width[i] = reader.getSizeX(); 
     966      height[i] = reader.getSizeY(); 
     967      imagesPerFile[i] = reader.getImageCount(); 
    758968      totalImages[i] = files.length * imagesPerFile[i]; 
    759       order[i] = reader.getDimensionOrder(f0); 
    760       sizeZ[i] = reader.getSizeZ(f0); 
    761       sizeC[i] = reader.getSizeC(f0); 
    762       sizeT[i] = reader.getSizeT(f0); 
    763       certain[i] = reader.isOrderCertain(f0); 
    764     } 
    765     reader.setSeries(f0, oldSeries); 
     969      order[i] = reader.getDimensionOrder(); 
     970      sizeZ[i] = reader.getSizeZ(); 
     971      sizeC[i] = reader.getSizeC(); 
     972      sizeT[i] = reader.getSizeT(); 
     973      certain[i] = reader.isOrderCertain(); 
     974    } 
     975    reader.setSeries(oldSeries); 
    766976 
    767977    // guess at dimensions corresponding to file numbering 
     
    773983    // order may need to be adjusted 
    774984    for (int i=0; i<seriesCount; i++) { 
    775       setSeries(currentId, i); 
     985      setSeries(i); 
    776986      order[i] = ag[i].getAdjustedOrder(); 
    777987    } 
    778     setSeries(currentId, oldSeries); 
     988    setSeries(oldSeries); 
    779989 
    780990    // initialize used files list only when requested 
     
    8231033 
    8241034    // populate metadata store 
    825     String f0 = files[0]; 
    826     int pixelType = getPixelType(currentId); 
    827     boolean little = reader.isLittleEndian(f0); 
    828     MetadataStore s = reader.getMetadataStore(f0); 
     1035    int pixelType = getPixelType(); 
     1036    boolean little = reader.isLittleEndian(); 
     1037    MetadataStore s = reader.getMetadataStore(); 
    8291038    s.setPixels(new Integer(width[sno]), new Integer(height[sno]), 
    8301039      new Integer(totalSizeZ[sno]), new Integer(totalSizeC[sno]), 
     
    8391048   * @return An array of size 2, dimensioned {file index, image index}. 
    8401049   */ 
    841   protected int[] computeIndices(String id, int no) 
    842     throws FormatException, IOException 
    843   { 
    844     if (!id.equals(currentId)) initFile(id); 
    845     int sno = getSeries(id); 
     1050  protected int[] computeIndices(int no) throws FormatException, IOException { 
     1051    int sno = getSeries(); 
    8461052 
    8471053    int[] axes = ag[sno].getAxisTypes(); 
     
    8491055 
    8501056    // get Z, C and T positions 
    851     int[] zct = getZCTCoords(id, no); 
     1057    int[] zct = getZCTCoords(no); 
    8521058    int[] posZ = FormatTools.rasterToPosition(lenZ[sno], zct[0]); 
    8531059    int[] posC = FormatTools.rasterToPosition(lenC[sno], zct[1]); 
     
    8681074    int fno = FormatTools.positionToRaster(count, pos); 
    8691075    int ino = FormatTools.getIndex(order[sno], sizeZ[sno], 
    870       reader.getEffectiveSizeC(files[0]), sizeT[sno], imagesPerFile[sno], 
     1076      reader.getEffectiveSizeC(), sizeT[sno], imagesPerFile[sno], 
    8711077      posZ[0], posC[0], posT[0]); 
    8721078 
    8731079    // configure the reader, in case we haven't done this one yet 
    874     readers[fno].setSeries(files[fno], reader.getSeries(files[0])); 
     1080    readers[fno].setId(files[fno]);  
     1081    readers[fno].setSeries(reader.getSeries()); 
    8751082 
    8761083    return new int[] {fno, ino}; 
     
    8821089   *   values indicating the internal channel index to use for that reader. 
    8831090   */ 
    884   protected int[] getIncludeList(String id, int theC) 
    885     throws FormatException, IOException 
     1091  protected int[] getIncludeList(int theC) throws FormatException, IOException 
    8861092  { 
    8871093    int[] include = new int[readers.length]; 
    8881094    Arrays.fill(include, -1); 
    889     for (int t=0; t<sizeT[getSeries(id)]; t++) { 
    890       for (int z=0; z<sizeZ[getSeries(id)]; z++) { 
    891         int no = getIndex(id, z, theC, t); 
    892         int[] q = computeIndices(id, no); 
     1095    for (int t=0; t<sizeT[getSeries()]; t++) { 
     1096      for (int z=0; z<sizeZ[getSeries()]; z++) { 
     1097        int no = getIndex(z, theC, t); 
     1098        int[] q = computeIndices(no); 
    8931099        int fno = q[0], ino = q[1]; 
    8941100        include[fno] = ino; 
     
    8981104  } 
    8991105 
    900   // -- Main method -- 
    901  
    902   public static void main(String[] args) throws FormatException, IOException { 
    903     if (!new FileStitcher().testRead(args)) System.exit(1); 
    904   } 
    905  
    9061106} 
  • trunk/loci/formats/FormatReader.java

    r2577 r2583  
    103103 
    104104    // reinitialize the MetadataStore 
    105     getMetadataStore(id).createRoot(); 
     105    getMetadataStore().createRoot(); 
    106106  } 
    107107 
     
    187187  public abstract boolean isThisType(byte[] block); 
    188188 
    189   /* @see IFormatReader#getImageCount(String) */ 
    190   public abstract int getImageCount(String id) 
     189  /* @see IFormatReader#getImageCount() */ 
     190  public abstract int getImageCount() throws FormatException, IOException; 
     191 
     192  /* @see IFormatReader#setId(String) */ 
     193  public void setId(String id) throws FormatException, IOException { 
     194    initFile(id); 
     195  } 
     196 
     197  /* @see IFormatReader#isRGB() */ 
     198  public boolean isRGB() throws FormatException, IOException { 
     199    return getRGBChannelCount() > 1; 
     200  } 
     201 
     202  /* @see IFormatReader#getSizeX() */ 
     203  public int getSizeX() throws FormatException, IOException { 
     204    return core.sizeX[series]; 
     205  } 
     206 
     207  /* @see IFormatReader#getSizeY() */ 
     208  public int getSizeY() throws FormatException, IOException { 
     209    return core.sizeY[series]; 
     210  } 
     211 
     212  /* @see IFormatReader#getSizeZ() */ 
     213  public int getSizeZ() throws FormatException, IOException { 
     214    return core.sizeZ[series]; 
     215  } 
     216 
     217  /* @see IFormatReader#getSizeC() */ 
     218  public int getSizeC() throws FormatException, IOException { 
     219    return core.sizeC[series]; 
     220  } 
     221 
     222  /* @see IFormatReader#getSizeT() */ 
     223  public int getSizeT() throws FormatException, IOException { 
     224    return core.sizeT[series]; 
     225  } 
     226 
     227  /* @see IFormatReader#getPixelType() */ 
     228  public int getPixelType() throws FormatException, IOException { 
     229    return core.pixelType[series]; 
     230  } 
     231 
     232  /* @see IFormatReader#getEffectiveSizeC() */ 
     233  public int getEffectiveSizeC() throws FormatException, IOException { 
     234    // NB: by definition, imageCount == effectiveSizeC * sizeZ * sizeT 
     235    return getImageCount() / (getSizeZ() * getSizeT()); 
     236  } 
     237 
     238  /* @see IFormatReader#getRGBChannelCount() */ 
     239  public int getRGBChannelCount() throws FormatException, IOException { 
     240    return getSizeC() / getEffectiveSizeC(); 
     241  } 
     242 
     243  /* @see IFormatReader#getChannelDimLengths() */ 
     244  public int[] getChannelDimLengths() 
     245    throws FormatException, IOException 
     246  { 
     247    if (core.cLengths[series] == null) { 
     248      core.cLengths[series] = new int[] {core.sizeC[series]}; 
     249    } 
     250    return core.cLengths[series]; 
     251  } 
     252 
     253  /* @see IFormatReader#getChannelDimTypes() */ 
     254  public String[] getChannelDimTypes() throws FormatException, IOException { 
     255    if (core.cTypes[series] == null) { 
     256      core.cTypes[series] = new String[] {FormatTools.CHANNEL}; 
     257    } 
     258    return core.cTypes[series]; 
     259  } 
     260 
     261  /* @see IFormatReader#getThumbSizeX() */ 
     262  public int getThumbSizeX() throws FormatException, IOException { 
     263    int sx = getSizeX(); 
     264    int sy = getSizeY(); 
     265    return sx > sy ? THUMBNAIL_DIMENSION : sx * THUMBNAIL_DIMENSION / sy; 
     266  } 
     267 
     268  /* @see IFormatReader#getThumbSizeY() */ 
     269  public int getThumbSizeY() throws FormatException, IOException { 
     270    int sx = getSizeX(); 
     271    int sy = getSizeY(); 
     272    return sy > sx ? THUMBNAIL_DIMENSION : sy * THUMBNAIL_DIMENSION / sx; 
     273  } 
     274 
     275  /* @see IFormatReader.isLittleEndian() */ 
     276  public abstract boolean isLittleEndian() throws FormatException, IOException; 
     277 
     278  /* @see IFormatReader#getDimensionOrder() */ 
     279  public String getDimensionOrder() throws FormatException, IOException { 
     280    return core.currentOrder[series]; 
     281  } 
     282 
     283  /* @see IFormatReader.isOrderCertain() */ 
     284  public boolean isOrderCertain() throws FormatException, IOException { 
     285    return core.orderCertain[series]; 
     286  } 
     287 
     288  /* @see IFormatReader#isInterleaved() */ 
     289  public boolean isInterleaved() throws FormatException, IOException { 
     290    return isInterleaved(0); 
     291  } 
     292 
     293  /* @see IFormatReader#isInterleaved(int) */ 
     294  public abstract boolean isInterleaved(int subC)  
    191295    throws FormatException, IOException; 
    192296 
    193   /* @see IFormatReader#isRGB(String) */ 
     297  /* @see IFormatReader#openImage(int) */ 
     298  public abstract BufferedImage openImage(int no) 
     299    throws FormatException, IOException; 
     300 
     301  /* @see IFormatReader#openBytes(int) */ 
     302  public abstract byte[] openBytes(int no) 
     303    throws FormatException, IOException; 
     304 
     305  /* @see IFormatReader#openBytes(int, byte[]) */ 
     306  public byte[] openBytes(int no, byte[] buf) 
     307    throws FormatException, IOException 
     308  { 
     309    return openBytes(no); 
     310  } 
     311 
     312  /* @see IFormatReader#openThumbImage(int) */ 
     313  public BufferedImage openThumbImage(int no) 
     314    throws FormatException, IOException 
     315  { 
     316    return ImageTools.scale(openImage(no), getThumbSizeX(),  
     317      getThumbSizeY(), false); 
     318  } 
     319 
     320  /* @see IFormatReader#openThumbBytes(int) */ 
     321  public byte[] openThumbBytes(int no) throws FormatException, IOException { 
     322    BufferedImage img = openThumbImage(no); 
     323    byte[][] bytes = ImageTools.getBytes(img); 
     324    if (bytes.length == 1) return bytes[0]; 
     325    byte[] rtn = new byte[getRGBChannelCount() * bytes[0].length]; 
     326    for (int i=0; i<getRGBChannelCount(); i++) { 
     327      System.arraycopy(bytes[i], 0, rtn, bytes[0].length * i, bytes[i].length); 
     328    } 
     329    return rtn; 
     330  } 
     331 
     332  /* @see IFormatReader#close() */ 
     333  public abstract void close() throws FormatException, IOException; 
     334 
     335  /* @see IFormatReader#getSeriesCount() */ 
     336  public int getSeriesCount() throws FormatException, IOException { 
     337    return 1; 
     338  } 
     339 
     340  /* @see IFormatReader#setSeries(int) */ 
     341  public void setSeries(int no) throws FormatException, IOException { 
     342    if (no < 0 || no >= getSeriesCount()) { 
     343      throw new FormatException("Invalid series: " + no); 
     344    } 
     345    series = no; 
     346  } 
     347 
     348  /* @see IFormatReader#getSeries() */ 
     349  public int getSeries() throws FormatException, IOException { 
     350    return series; 
     351  } 
     352 
     353  /* @see IFormatReader#setNormalized(boolean) */ 
     354  public void setNormalized(boolean normalize) { 
     355    if (currentId != null) { 
     356      String s = "setNormalized called with open file."; 
     357      if (debug && debugLevel >= 2) trace(s); 
     358      else System.err.println("Warning: " + s); 
     359    } 
     360    normalizeData = normalize; 
     361  } 
     362 
     363  /* @see IFormatReader#isNormalized() */ 
     364  public boolean isNormalized() { 
     365    return normalizeData; 
     366  } 
     367 
     368  /* @see IFormatReader#getUsedFiles() */ 
     369  public String[] getUsedFiles() throws FormatException, IOException { 
     370    return new String[] {currentId}; 
     371  } 
     372 
     373  /* @see IFormatReader#getCurrentFile() */ 
     374  public String getCurrentFile() { 
     375    return currentId == null ? "" : currentId; 
     376  } 
     377 
     378  /* @see IFormatReader#getIndex(int, int, int) */ 
     379  public int getIndex(int z, int c, int t) 
     380    throws FormatException, IOException 
     381  { 
     382    return FormatTools.getIndex(this, z, c, t); 
     383  } 
     384 
     385  /* @see IFormatReader#getZCTCoords(int) */ 
     386  public int[] getZCTCoords(int index) throws FormatException, IOException { 
     387    return FormatTools.getZCTCoords(this, index); 
     388  } 
     389 
     390  /* @see IFormatReader#getMetadataValue(String) */ 
     391  public Object getMetadataValue(String field)  
     392    throws FormatException, IOException 
     393  { 
     394    return getMeta(field); 
     395  } 
     396 
     397  /* @see IFormatReader#getMetadata() */ 
     398  public Hashtable getMetadata() throws FormatException, IOException { 
     399    return metadata; 
     400  } 
     401 
     402  /* @see IFormatReader#getCoreMetadata() */ 
     403  public CoreMetadata getCoreMetadata() throws FormatException, IOException { 
     404    return core; 
     405  } 
     406 
     407  /* @see IFormatReader#setMetadataFiltered(boolean) */ 
     408  public void setMetadataFiltered(boolean filter) { 
     409    if (currentId != null) { 
     410      String s = "setMetadataFiltered called with open file."; 
     411      if (debug && debugLevel >= 2) trace(s); 
     412      else System.err.println("Warning: " + s); 
     413    } 
     414    filterMetadata = filter; 
     415  } 
     416 
     417  /* @see IFormatReader#isMetadataFiltered() */ 
     418  public boolean isMetadataFiltered() { 
     419    return filterMetadata; 
     420  } 
     421 
     422  /* @see IFormatReader#setMetadataStore(MetadataStore) */ 
     423  public void setMetadataStore(MetadataStore store) { 
     424    if (currentId != null) { 
     425      String s = "setMetadataStore called with open file."; 
     426      if (debug && debugLevel >= 2) trace(s); 
     427      else System.err.println("Warning: " + s); 
     428    } 
     429    metadataStore = store; 
     430  } 
     431 
     432  /* @see IFormatReader#getMetadataStore() */ 
     433  public MetadataStore getMetadataStore() throws FormatException, IOException { 
     434    return metadataStore; 
     435  } 
     436 
     437  /* @see IFormatReader#getMetadataStoreRoot() */ 
     438  public Object getMetadataStoreRoot() throws FormatException, IOException { 
     439    return getMetadataStore().getRoot(); 
     440  } 
     441 
     442  /* @see FormatReader#testRead(String[]) */ 
     443  public boolean testRead(String[] args) throws FormatException, IOException { 
     444    return FormatTools.testRead(this, args); 
     445  } 
     446 
     447  // -- Deprecated IFormatReader API methods -- 
     448 
     449  /** @deprecated Replaced by {@link getImageCount()} */  
     450  public int getImageCount(String id) throws FormatException, IOException { 
     451    if (!id.equals(currentId)) setId(id);  
     452    return getImageCount(); 
     453  } 
     454 
     455  /** @deprecated Replaced by {@link isRGB()} */  
    194456  public boolean isRGB(String id) throws FormatException, IOException { 
    195457    return getRGBChannelCount(id) > 1; 
    196458  } 
    197459 
    198   /* @see IFormatReader#getSizeX(String) */ 
     460  /** @deprecated Replaced by {@link getSizeX()} */  
    199461  public int getSizeX(String id) throws FormatException, IOException { 
    200     if (!id.equals(currentId)) initFile(id); 
     462    if (!id.equals(currentId)) setId(id);  
    201463    return core.sizeX[series]; 
    202464  } 
    203465 
    204   /* @see IFormatReader#getSizeY(String) */ 
     466  /** @deprecated Replaced by {@link getSizeY()} */  
    205467  public int getSizeY(String id) throws FormatException, IOException { 
    206     if (!id.equals(currentId)) initFile(id); 
     468    if (!id.equals(currentId)) setId(id);  
    207469    return core.sizeY[series]; 
    208470  } 
    209471 
    210   /* @see IFormatReader#getSizeZ(String) */ 
     472  /** @deprecated Replaced by {@link getSizeZ()} */  
    211473  public int getSizeZ(String id) throws FormatException, IOException { 
    212     if (!id.equals(currentId)) initFile(id); 
     474    if (!id.equals(currentId)) setId(id);  
    213475    return core.sizeZ[series]; 
    214476  } 
    215477 
    216   /* @see IFormatReader#getSizeC(String) */ 
     478  /** @deprecated Replaced by {@link getSizeC()} */  
    217479  public int getSizeC(String id) throws FormatException, IOException { 
    218     if (!id.equals(currentId)) initFile(id); 
     480    if (!id.equals(currentId)) setId(id);  
    219481    return core.sizeC[series]; 
    220482  } 
    221483 
    222   /* @see IFormatReader#getSizeT(String) */ 
     484  /** @deprecated Replaced by {@link getSizeT()} */  
    223485  public int getSizeT(String id) throws FormatException, IOException { 
    224     if (!id.equals(currentId)) initFile(id); 
     486    if (!id.equals(currentId)) setId(id);  
    225487    return core.sizeT[series]; 
    226488  } 
    227489 
    228   /* @see IFormatReader#getPixelType(String) */ 
     490  /** @deprecated Replaced by {@link getPixelType()} */  
    229491  public int getPixelType(String id) throws FormatException, IOException { 
    230     if (!id.equals(currentId)) initFile(id); 
     492    if (!id.equals(currentId)) setId(id);  
    231493    return core.pixelType[series]; 
    232494  } 
    233495 
    234   /* @see IFormatReader#getEffectiveSizeC(String) */ 
     496  /** @deprecated Replaced by {@link getEffectiveSizeC()} */  
    235497  public int getEffectiveSizeC(String id) throws FormatException, IOException { 
    236498    // NB: by definition, imageCount == effectiveSizeC * sizeZ * sizeT 
     
    238500  } 
    239501 
    240   /* @see IFormatReader#getRGBChannelCount(String) */ 
     502  /** @deprecated Replaced by {@link getRGBChannelCount()} */  
    241503  public int getRGBChannelCount(String id) throws FormatException, IOException { 
    242504    return getSizeC(id) / getEffectiveSizeC(id); 
    243505  } 
    244506 
    245   /* @see IFormatReader#getChannelDimLengths(String) */ 
     507  /** @deprecated Replaced by {@link getChannelDimLengths()} */  
    246508  public int[] getChannelDimLengths(String id) 
    247509    throws FormatException, IOException 
    248510  { 
    249     if (!id.equals(currentId)) initFile(id); 
     511    if (!id.equals(currentId)) setId(id);  
    250512    if (core.cLengths[series] == null) { 
    251513      core.cLengths[series] = new int[] {core.sizeC[series]}; 
     
    254516  } 
    255517 
    256   /* @see IFormatReader#getChannelDimTypes(String) */ 
     518  /** @deprecated Replaced by {@link getChannelDimTypes()} */  
    257519  public String[] getChannelDimTypes(String id) 
    258520    throws FormatException, IOException 
    259521  { 
    260     if (!id.equals(currentId)) initFile(id); 
     522    if (!id.equals(currentId)) setId(id);  
    261523    if (core.cTypes[series] == null) { 
    262524      core.cTypes[series] = new String[] {FormatTools.CHANNEL}; 
     
    265527  } 
    266528 
    267   /* @see IFormatReader#getThumbSizeX(String) */ 
     529  /** @deprecated Replaced by {@link getThumbSizeX()} */  
    268530  public int getThumbSizeX(String id) throws FormatException, IOException { 
    269531    int sx = getSizeX(id); 
     
    272534  } 
    273535 
    274   /* @see IFormatReader#getThumbSizeY(String) */ 
     536  /** @deprecated Replaced by {@link getThumbSizeY()} */  
    275537  public int getThumbSizeY(String id) throws FormatException, IOException { 
    276538    int sx = getSizeX(id); 
     
    279541  } 
    280542 
    281   /* @see IFormatReader.isLittleEndian(String) */ 
    282   public abstract boolean isLittleEndian(String id) 
    283     throws FormatException, IOException; 
    284  
    285   /* @see IFormatReader#getDimensionOrder(String) */ 
    286   public String getDimensionOrder(String id) 
    287     throws FormatException, IOException 
    288   { 
    289     if (!id.equals(currentId)) initFile(id); 
     543  /** @deprecated Replaced by {@link isLittleEndian()} */  
     544  public boolean isLittleEndian(String id) throws FormatException, IOException { 
     545    if (!id.equals(currentId)) setId(id); 
     546    return isLittleEndian(); 
     547  } 
     548 
     549  /** @deprecated Replaced by {@link getDimensionOrder()} */  
     550  public String getDimensionOrder(String id) throws FormatException, IOException 
     551  { 
     552    if (!id.equals(currentId)) setId(id);  
    290553    return core.currentOrder[series]; 
    291554  } 
    292555 
    293   /* @see IFormatReader.isOrderCertain(String) */ 
     556  /** @deprecated Replaced by {@link isOrderCertain()} */  
    294557  public boolean isOrderCertain(String id) throws FormatException, IOException { 
    295     if (!id.equals(currentId)) initFile(id); 
     558    if (!id.equals(currentId)) setId(id);  
    296559    return core.orderCertain[series]; 
    297560  } 
    298561 
    299   /* @see IFormatReader#isInterleaved(String) */ 
     562  /** @deprecated Replaced by {@link isInterleaved()} */  
    300563  public boolean isInterleaved(String id) 
    301564    throws FormatException, IOException 
     
    304567  } 
    305568 
    306   /* @see IFormatReader#isInterleaved(String, int) */ 
    307   public abstract boolean isInterleaved(String id, int subC) 
    308     throws FormatException, IOException; 
    309  
    310   /* @see IFormatReader#openImage(String, int) */ 
    311   public abstract BufferedImage openImage(String id, int no) 
    312     throws FormatException, IOException; 
    313  
    314   /* @see IFormatReader#openBytes(String, int) */ 
    315   public abstract byte[] openBytes(String id, int no) 
    316     throws FormatException, IOException; 
    317  
    318   /* @see IFormatReader#openBytes(String, int, byte[]) */ 
     569  /** @deprecated Replaced by {@link isInterleaved(int)} */  
     570  public boolean isInterleaved(String id, int subC)  
     571    throws FormatException, IOException 
     572  { 
     573    if (!id.equals(currentId)) setId(id); 
     574    return isInterleaved(subC); 
     575  } 
     576 
     577  /** @deprecated Replaced by {@link openImage(int)} */  
     578  public BufferedImage openImage(String id, int no) 
     579    throws FormatException, IOException 
     580  { 
     581    if (!id.equals(currentId)) setId(id); 
     582    return openImage(no); 
     583  } 
     584 
     585  /** @deprecated Replaced by {@link openBytes(int)} */  
     586  public byte[] openBytes(String id, int no) 
     587    throws FormatException, IOException 
     588  { 
     589    if (!id.equals(currentId)) setId(id); 
     590    return openBytes(no); 
     591  } 
     592 
     593  /** @deprecated Replaced by {@link openBytes(int, byte[])} */  
    319594  public byte[] openBytes(String id, int no, byte[] buf) 
    320595    throws FormatException, IOException 
     
    323598  } 
    324599 
    325   /* @see IFormatReader#openThumbImage(String, int) */ 
     600  /** @deprecated Replaced by {@link openThumbImage(int)} */  
    326601  public BufferedImage openThumbImage(String id, int no) 
    327602    throws FormatException, IOException 
     
    331606  } 
    332607 
    333   /* @see IFormatReader#openThumbBytes(String, int) */ 
     608  /** @deprecated Replaced by {@link openThumbBytes(int)} */  
    334609  public byte[] openThumbBytes(String id, int no) 
    335610    throws FormatException, IOException 
     
    345620  } 
    346621 
    347   /* @see IFormatReader#close() */ 
    348   public abstract void close() throws FormatException, IOException; 
    349  
    350   /* @see IFormatReader#getSeriesCount(String) */ 
     622  /** @deprecated Replaced by {@link getSeriesCount()} */  
    351623  public int getSeriesCount(String id) throws FormatException, IOException { 
    352     if (!id.equals(currentId)) initFile(id); 
     624    if (!id.equals(currentId)) setId(id);  
    353625    return 1; 
    354626  } 
    355627 
    356   /* @see IFormatReader#setSeries(String, int) */ 
     628  /** @deprecated Replaced by {@link setSeries(int)} */  
    357629  public void setSeries(String id, int no) throws FormatException, IOException { 
    358630    if (no < 0 || no >= getSeriesCount(id)) { 
     
    362634  } 
    363635 
    364   /* @see IFormatReader#getSeries(String) */ 
     636  /** @deprecated Replaced by {@link getSeries()} */ 
    365637  public int getSeries(String id) throws FormatException, IOException { 
    366     if (!id.equals(currentId)) initFile(id); 
     638    if (!id.equals(currentId)) setId(id);  
    367639    return series; 
    368640  } 
    369641 
    370   /* @see IFormatReader#setNormalized(boolean) */ 
    371   public void setNormalized(boolean normalize) { 
    372     if (currentId != null) { 
    373       String s = "setNormalized called with open file."; 
    374       if (debug && debugLevel >= 2) trace(s); 
    375       else System.err.println("Warning: " + s); 
    376     } 
    377     normalizeData = normalize; 
    378   } 
    379  
    380   /* @see IFormatReader#isNormalized() */ 
    381   public boolean isNormalized() { 
    382     return normalizeData; 
    383   } 
    384  
    385   /* @see IFormatReader#getUsedFiles(String) */ 
     642  /** @deprecated Replaced by {@link getUsedFiles()} */  
    386643  public String[] getUsedFiles(String id) throws FormatException, IOException { 
    387     if (!id.equals(currentId)) initFile(id); 
     644    if (!id.equals(currentId)) setId(id);  
    388645    return new String[] {id}; 
    389646  } 
    390647 
    391   /* @see IFormatReader#getCurrentFile() */ 
    392   public String getCurrentFile() { 
    393     return currentId == null ? "" : currentId; 
    394   } 
    395  
    396   /* @see IFormatReader#getIndex(String, int, int, int) */ 
     648  /** @deprecated Replaced by {@link getIndex(int, int, int)} */  
    397649  public int getIndex(String id, int z, int c, int t) 
    398650    throws FormatException, IOException 
    399651  { 
    400     return FormatTools.getIndex(this, id, z, c, t); 
    401   } 
    402  
    403   /* @see IFormatReader#getZCTCoords(String, int) */ 
     652    if (!id.equals(currentId)) setId(id); 
     653    return FormatTools.getIndex(this, z, c, t); 
     654  } 
     655 
     656  /** @deprecated Replaced by {@link getZCTCoords(int)} */  
    404657  public int[] getZCTCoords(String id, int index) 
    405658    throws FormatException, IOException 
    406659  { 
    407     return FormatTools.getZCTCoords(this, id, index); 
    408   } 
    409  
    410   /* @see IFormatReader#getMetadataValue(String, String) */ 
     660    if (!id.equals(currentId)) setId(id); 
     661    return FormatTools.getZCTCoords(this, index); 
     662  } 
     663 
     664  /** @deprecated Replaced by {@link getMetadataValue(String)} */  
    411665  public Object getMetadataValue(String id, String field) 
    412666    throws FormatException, IOException 
    413667  { 
    414     if (!id.equals(currentId)) initFile(id); 
     668    if (!id.equals(currentId)) setId(id);  
    415669    return getMeta(field); 
    416670  } 
    417671 
    418   /* @see IFormatReader#getMetadata */ 
     672  /** @deprecated Replaced by {@link getMetadata()} */  
    419673  public Hashtable getMetadata(String id) throws FormatException, IOException { 
    420     if (!id.equals(currentId)) initFile(id); 
     674    if (!id.equals(currentId)) setId(id);  
    421675    return metadata; 
    422676  } 
    423677 
    424   /* @see IFormatReader#getCoreMetadata(String) */ 
     678  /** @deprecated Replaced by {@link getCoreMetadata()} */  
    425679  public CoreMetadata getCoreMetadata(String id)  
    426680    throws FormatException, IOException 
    427681  { 
    428     if (!id.equals(currentId)) initFile(id); 
     682    if (!id.equals(currentId)) setId(id);  
    429683    return core; 
    430684  } 
    431685 
    432   /* @see IFormatReader#setMetadataFiltered(boolean) */ 
    433   public void setMetadataFiltered(boolean filter) { 
    434     if (currentId != null) { 
    435       String s = "setMetadataFiltered called with open file."; 
    436       if (debug && debugLevel >= 2) trace(s); 
    437       else System.err.println("Warning: " + s); 
    438     } 
    439     filterMetadata = filter; 
    440   } 
    441  
    442   /* @see IFormatReader#isMetadataFiltered() */ 
    443   public boolean isMetadataFiltered() { 
    444     return filterMetadata; 
    445   } 
    446  
    447   /* @see IFormatReader#setMetadataStore(MetadataStore) */ 
    448   public void setMetadataStore(MetadataStore store) { 
    449     if (currentId != null) { 
    450       String s = "setMetadataStore called with open file."; 
    451       if (debug && debugLevel >= 2) trace(s); 
    452       else System.err.println("Warning: " + s); 
    453     } 
    454     metadataStore = store; 
    455   } 
    456  
    457   /* @see IFormatReader#getMetadataStore(String) */ 
     686  /** @deprecated Replaced by {@link getMetadataStore()} */  
    458687  public MetadataStore getMetadataStore(String id) 
    459688    throws FormatException, IOException 
    460689  { 
    461     if (!id.equals(currentId)) initFile(id); 
     690    if (!id.equals(currentId)) setId(id);  
    462691    return metadataStore; 
    463692  } 
    464693 
    465   /* @see IFormatReader#getMetadataStoreRoot(String) */ 
     694  /** @deprecated Replaced by {@link getMetadataStoreRoot()} */  
    466695  public Object getMetadataStoreRoot(String id) 
    467696    throws FormatException, IOException 
    468697  { 
    469     if (!id.equals(currentId)) initFile(id); 
    470     return getMetadataStore(id).getRoot(); 
    471   } 
    472  
    473   /* @see FormatReader#testRead(String[]) */ 
    474   public boolean testRead(String[] args) throws FormatException, IOException { 
    475     return FormatTools.testRead(this, args); 
     698    if (!id.equals(currentId)) setId(id);  
     699    return getMetadataStore().getRoot(); 
    476700  } 
    477701 
  • trunk/loci/formats/FormatTools.java

    r2572 r2583  
    247247    reader.setNormalized(normalize); 
    248248    reader.setMetadataFiltered(true); 
    249  
    250     if (!normalize && reader.getPixelType(id) == FLOAT) { 
     249    reader.setId(id); 
     250    if (minMaxCalc != null) minMaxCalc.setId(id); 
     251 
     252    if (!normalize && reader.getPixelType() == FLOAT) { 
    251253      throw new FormatException("Sorry, unnormalized floating point " + 
    252254        "data is not supported. Please use the '-normalize' option."); 
     
    259261      "File pattern = " + id : "Filename = " + reader.getCurrentFile()); 
    260262    if (map != null) System.out.println("Mapped filename = " + map); 
    261     String[] used = reader.getUsedFiles(id); 
     263    String[] used = reader.getUsedFiles(); 
    262264    boolean usedValid = used != null && used.length > 0; 
    263265    if (usedValid) { 
     
    286288      System.out.println("Used files = [" + used[0] + "]"); 
    287289    } 
    288     int seriesCount = reader.getSeriesCount(id); 
     290    int seriesCount = reader.getSeriesCount(); 
    289291    System.out.println("Series count = " + seriesCount); 
    290292    for (int j=0; j<seriesCount; j++) { 
    291       reader.setSeries(id, j); 
     293      reader.setSeries(j); 
    292294 
    293295      // read basic metadata for series #i 
    294       int imageCount = reader.getImageCount(id); 
    295       boolean rgb = reader.isRGB(id); 
    296       int sizeX = reader.getSizeX(id); 
    297       int sizeY = reader.getSizeY(id); 
    298       int sizeZ = reader.getSizeZ(id); 
    299       int sizeC = reader.getSizeC(id); 
    300       int sizeT = reader.getSizeT(id); 
    301       int pixelType = reader.getPixelType(id); 
    302       int effSizeC = reader.getEffectiveSizeC(id); 
    303       int rgbChanCount = reader.getRGBChannelCount(id); 
    304       int[] cLengths = reader.getChannelDimLengths(id); 
    305       String[] cTypes = reader.getChannelDimTypes(id); 
    306       int thumbSizeX = reader.getThumbSizeX(id); 
    307       int thumbSizeY = reader.getThumbSizeY(id); 
    308       boolean little = reader.isLittleEndian(id); 
    309       String dimOrder = reader.getDimensionOrder(id); 
    310       boolean orderCertain = reader.isOrderCertain(id); 
    311       boolean interleaved = reader.isInterleaved(id); 
     296      int imageCount = reader.getImageCount(); 
     297      boolean rgb = reader.isRGB(); 
     298      int sizeX = reader.getSizeX(); 
     299      int sizeY = reader.getSizeY(); 
     300      int sizeZ = reader.getSizeZ(); 
     301      int sizeC = reader.getSizeC(); 
     302      int sizeT = reader.getSizeT(); 
     303      int pixelType = reader.getPixelType(); 
     304      int effSizeC = reader.getEffectiveSizeC(); 
     305      int rgbChanCount = reader.getRGBChannelCount(); 
     306      int[] cLengths = reader.getChannelDimLengths(); 
     307      String[] cTypes = reader.getChannelDimTypes(); 
     308      int thumbSizeX = reader.getThumbSizeX(); 
     309      int thumbSizeY = reader.getThumbSizeY(); 
     310      boolean little = reader.isLittleEndian(); 
     311      String dimOrder = reader.getDimensionOrder(); 
     312      boolean orderCertain = reader.isOrderCertain(); 
     313      boolean interleaved = reader.isInterleaved(); 
    312314 
    313315      // output basic metadata for series #i 
     
    362364        int[] indices2 = new int[indices.length]; 
    363365        for (int i=0; i<indices.length; i++) { 
    364           zct[i] = reader.getZCTCoords(id, indices[i]); 
    365           indices2[i] = reader.getIndex(id, zct[i][0], zct[i][1], zct[i][2]); 
     366          zct[i] = reader.getZCTCoords(indices[i]); 
     367          indices2[i] = reader.getIndex(zct[i][0], zct[i][1], zct[i][2]); 
    366368          System.out.print("\tPlane #" + indices[i] + " <=> Z " + zct[i][0] + 
    367369            ", C " + zct[i][1] + ", T " + zct[i][2]); 
     
    373375      } 
    374376    } 
    375     reader.setSeries(id, series); 
     377    reader.setSeries(series); 
    376378    String s = seriesCount > 1 ? (" series #" + series) : ""; 
    377     int pixelType = reader.getPixelType(id); 
    378     int sizeC = reader.getSizeC(id); 
     379    int pixelType = reader.getPixelType(); 
     380    int sizeC = reader.getSizeC(); 
    379381 
    380382    // get a priori min/max values 
     
    389391      preKnownMax = new Double[sizeC]; 
    390392      for (int c=0; c<sizeC; c++) { 
    391         preGlobalMin[c] = minMaxCalc.getChannelGlobalMinimum(id, c); 
    392         preGlobalMax[c] = minMaxCalc.getChannelGlobalMaximum(id, c); 
    393         preKnownMin[c] = minMaxCalc.getChannelKnownMinimum(id, c); 
    394         preKnownMax[c] = minMaxCalc.getChannelKnownMaximum(id, c); 
    395       } 
    396       prePlaneMin = minMaxCalc.getPlaneMinimum(id, 0); 
    397       prePlaneMax = minMaxCalc.getPlaneMaximum(id, 0); 
    398       preIsMinMaxPop = minMaxCalc.isMinMaxPopulated(id); 
     393        preGlobalMin[c] = minMaxCalc.getChannelGlobalMinimum(c); 
     394        preGlobalMax[c] = minMaxCalc.getChannelGlobalMaximum(c); 
     395        preKnownMin[c] = minMaxCalc.getChannelKnownMinimum(c); 
     396        preKnownMax[c] = minMaxCalc.getChannelKnownMaximum(c); 
     397      } 
     398      prePlaneMin = minMaxCalc.getPlaneMinimum(0); 
     399      prePlaneMax = minMaxCalc.getPlaneMaximum(0); 
     400      preIsMinMaxPop = minMaxCalc.isMinMaxPopulated(); 
    399401    } 
    400402 
     
    404406      System.out.print("Reading" + s + " pixel data "); 
    405407      long s1 = System.currentTimeMillis(); 
    406       int num = reader.getImageCount(id); 
     408      int num = reader.getImageCount(); 
    407409      if (start < 0) start = 0; 
    408410      if (start >= num) start = num - 1; 
     
    419421        if (!fastBlit) { 
    420422          images[i - start] = thumbs ? 
    421             reader.openThumbImage(id, i) : reader.openImage(id, i); 
     423            reader.openThumbImage(i) : reader.openImage(i); 
    422424        } 
    423425        else { 
    424           int x = reader.getSizeX(id); 
    425           int y = reader.getSizeY(id); 
    426           byte[] b = thumbs ? reader.openThumbBytes(id, i) : 
    427             reader.openBytes(id, i); 
     426          int x = reader.getSizeX(); 
     427          int y = reader.getSizeY(); 
     428          byte[] b = thumbs ? reader.openThumbBytes(i) : 
     429            reader.openBytes(i); 
    428430          Object pix = DataTools.makeDataArray(b, 
    429             getBytesPerPixel(reader.getPixelType(id)), 
    430             reader.getPixelType(id) == FLOAT, 
    431             reader.isLittleEndian(id)); 
     431            getBytesPerPixel(reader.getPixelType()), 
     432            reader.getPixelType() == FLOAT, 
     433            reader.isLittleEndian()); 
    432434          images[i - start] = 
    433435            ImageTools.makeImage(ImageTools.make24Bits(pix, x, y, 
     
    468470        Double[] knownMax = new Double[sizeC]; 
    469471        for (int c=0; c<sizeC; c++) { 
    470           globalMin[c] = minMaxCalc.getChannelGlobalMinimum(id, c); 
    471           globalMax[c] = minMaxCalc.getChannelGlobalMaximum(id, c); 
    472           knownMin[c] = minMaxCalc.getChannelKnownMinimum(id, c); 
    473           knownMax[c] = minMaxCalc.getChannelKnownMaximum(id, c); 
    474         } 
    475         Double[] planeMin = minMaxCalc.getPlaneMinimum(id, 0); 
    476         Double[] planeMax = minMaxCalc.getPlaneMaximum(id, 0); 
    477         boolean isMinMaxPop = minMaxCalc.isMinMaxPopulated(id); 
     472          globalMin[c] = minMaxCalc.getChannelGlobalMinimum(c); 
     473          globalMax[c] = minMaxCalc.getChannelGlobalMaximum(c); 
     474          knownMin[c] = minMaxCalc.getChannelKnownMinimum(c); 
     475          knownMax[c] = minMaxCalc.getChannelKnownMaximum(c); 
     476        } 
     477        Double[] planeMin = minMaxCalc.getPlaneMinimum(0); 
     478        Double[] planeMax = minMaxCalc.getPlaneMaximum(0); 
     479        boolean isMinMaxPop = minMaxCalc.isMinMaxPopulated(); 
    478480 
    479481        // output min/max results 
     
    531533        r.exec("import loci.formats.gui.ImageViewer"); 
    532534        r.exec("viewer = new ImageViewer()"); 
    533         r.setVar("id", id); 
    534535        r.setVar("reader", reader); 
    535536        r.setVar("images", images); 
    536537        r.setVar("true", true); 
    537         r.exec("viewer.setImages(id, reader, images)"); 
     538        r.exec("viewer.setImages(reader, images)"); 
    538539        r.exec("viewer.setVisible(true)"); 
    539540      } 
     
    547548      System.out.println(); 
    548549      System.out.println("Reading" + s + " metadata"); 
    549       Hashtable meta = reader.getMetadata(id); 
     550      Hashtable meta = reader.getMetadata(); 
    550551      String[] keys = (String[]) meta.keySet().toArray(new String[0]); 
    551552      Arrays.sort(keys); 
    552553      for (int i=0; i<keys.length; i++) { 
    553554        System.out.print(keys[i] + ": "); 
    554         System.out.println(reader.getMetadataValue(id, keys[i])); 
     555        System.out.println(reader.getMetadataValue(keys[i])); 
    555556      } 
    556557    } 
     
    560561      System.out.println(); 
    561562      System.out.println("Generating OME-XML"); 
    562       MetadataStore ms = reader.getMetadataStore(id); 
     563      MetadataStore ms = reader.getMetadataStore(); 
    563564 
    564565      // NB: avoid dependencies on optional loci.formats.ome package 
     
    600601 
    601602    ImageReader reader = new ImageReader(); 
     603    reader.setId(in);  
     604 
    602605    long start = System.currentTimeMillis(); 
    603     int num = reader.getImageCount(in); 
     606    int num = reader.getImageCount(); 
    604607    long mid = System.currentTimeMillis(); 
    605608    long read = 0, write = 0; 
    606609    for (int i=0; i<num; i++) { 
    607610      long s = System.currentTimeMillis(); 
    608       Image image = reader.openImage(in, i); 
     611      Image image = reader.openImage(i); 
    609612      long m = System.currentTimeMillis(); 
    610613      writer.saveImage(out, image, i == num - 1); 
     
    634637   * to the given Z, C and T coordinates. 
    635638   */ 
    636   public static int getIndex(IFormatReader reader, String id, 
    637     int z, int c, int t) throws FormatException, IOException 
     639  public static int getIndex(IFormatReader reader, int z, int c, int t)  
     640    throws FormatException, IOException 
    638641  { 
    639     String order = reader.getDimensionOrder(id); 
    640     int zSize = reader.getSizeZ(id); 
    641     int cSize = reader.getEffectiveSizeC(id); 
    642     int tSize = reader.getSizeT(id); 
    643     int num = reader.getImageCount(id); 
     642    String order = reader.getDimensionOrder(); 
     643    int zSize = reader.getSizeZ(); 
     644    int cSize = reader.getEffectiveSizeC(); 
     645    int tSize = reader.getSizeT(); 
     646    int num = reader.getImageCount(); 
    644647    return getIndex(order, zSize, cSize, tSize, num, z, c, t); 
    645648  } 
     
    709712   * to the given rasterized index value. 
    710713   */ 
    711   public static int[] getZCTCoords(IFormatReader reader, 
    712     String id, int index) throws FormatException, IOException 
     714  public static int[] getZCTCoords(IFormatReader reader, int index)  
     715    throws FormatException, IOException 
    713716  { 
    714     String order = reader.getDimensionOrder(id); 
    715     int zSize = reader.getSizeZ(id); 
    716     int cSize = reader.getEffectiveSizeC(id); 
    717     int tSize = reader.getSizeT(id); 
    718     int num = reader.getImageCount(id); 
     717    String order = reader.getDimensionOrder(); 
     718    int zSize = reader.getSizeZ(); 
     719    int cSize = reader.getEffectiveSizeC(); 
     720    int tSize = reader.getSizeT(); 
     721    int num = reader.getImageCount(); 
    719722    return getZCTCoords(order, zSize, cSize, tSize, num, index); 
    720723  } 
  • trunk/loci/formats/IFormatReader.java

    r2564 r2583  
    3535  boolean isThisType(byte[] block); 
    3636 
    37   /** Determines the number of images in the given file. */ 
    38   int getImageCount(String id) throws FormatException, IOException; 
     37  /** Sets the current file name. */ 
     38  void setId(String id) throws FormatException, IOException; 
     39 
     40  /** Determines the number of images in the current file. */ 
     41  int getImageCount() throws FormatException, IOException; 
    3942 
    4043  /** Checks if the images in the file are RGB. */ 
    41   boolean isRGB(String id) throws FormatException, IOException; 
     44  boolean isRGB() throws FormatException, IOException; 
    4245 
    4346  /** Gets the size of the X dimension. */ 
    44   int getSizeX(String id) throws FormatException, IOException; 
     47  int getSizeX() throws FormatException, IOException; 
    4548 
    4649  /** Gets the size of the Y dimension. */ 
    47   int getSizeY(String id) throws FormatException, IOException; 
     50  int getSizeY() throws FormatException, IOException; 
    4851 
    4952  /** Gets the size of the Z dimension. */ 
    50   int getSizeZ(String id) throws FormatException, IOException; 
     53  int getSizeZ() throws FormatException, IOException; 
    5154 
    5255  /** Gets the size of the C dimension. */ 
    53   int getSizeC(String id) throws FormatException, IOException; 
     56  int getSizeC() throws FormatException, IOException; 
    5457 
    5558  /** Gets the size of the T dimension. */ 
    56   int getSizeT(String id) throws FormatException, IOException; 
     59  int getSizeT() throws FormatException, IOException; 
    5760 
    5861  /** 
    5962   * Gets the pixel type. 
    6063   * @param id the image's filename. 
    61    * @return the pixel type as an enumeration from <code>FormatReader</code> 
     64   * @return the pixel type as an enumeration from <code>FormatTools</code> 
    6265   * <i>static</i> pixel types such as <code>INT8</code>. 
    6366   * @throws FormatException if there was a problem parsing file metadata. 
    6467   * @throws IOException if there was an error reading from the file. 
    6568   */ 
    66   int getPixelType(String id) throws FormatException, IOException; 
     69  int getPixelType() throws FormatException, IOException; 
    6770 
    6871  /** 
     
    7174   * regardless of the result of isRGB(id). 
    7275   */ 
    73   int getEffectiveSizeC(String id) throws FormatException, IOException; 
     76  int getEffectiveSizeC() throws FormatException, IOException; 
    7477 
    7578  /** Gets the number of channels per RGB image (if not RGB, this returns 1). */ 
    76   int getRGBChannelCount(String id) throws FormatException, IOException; 
     79  int getRGBChannelCount() throws FormatException, IOException; 
    7780 
    7881  /** 
     
    8083   * in fastest-to-sloweset rasterization order. 
    8184   */ 
    82   int[] getChannelDimLengths(String id) throws FormatException, IOException; 
     85  int[] getChannelDimLengths() throws FormatException, IOException; 
    8386 
    8487  /** 
     
    8790   * Common subdimensional types are enumerated in {@link FormatTools}. 
    8891   */ 
    89   String[] getChannelDimTypes(String id) throws FormatException, IOException; 
     92  String[] getChannelDimTypes() throws FormatException, IOException; 
    9093 
    9194  /** Get the size of the X dimension for the thumbnail. */ 
    92   int getThumbSizeX(String id) throws FormatException, IOException; 
     95  int getThumbSizeX() throws FormatException, IOException; 
    9396 
    9497  /** Get the size of the Y dimension for the thumbnail. */ 
    95   int getThumbSizeY(String id) throws FormatException, IOException; 
     98  int getThumbSizeY() throws FormatException, IOException; 
    9699 
    97100  /** Gets whether the data is in little-endian format. */ 
    98   boolean isLittleEndian(String id) throws FormatException, IOException; 
     101  boolean isLittleEndian() throws FormatException, IOException; 
    99102 
    100103  /** 
     
    112115   * {@link #isInterleaved(String)} method will return true. 
    113116   */ 
    114   String getDimensionOrder(String id) throws FormatException, IOException; 
     117  String getDimensionOrder() throws FormatException, IOException; 
    115118 
    116119  /** 
    117120   * Gets whether the dimension order and sizes are known, or merely guesses. 
    118121   */ 
    119   boolean isOrderCertain(String id) throws FormatException, IOException; 
     122  boolean isOrderCertain() throws FormatException, IOException; 
    120123 
    121124  /** 
     
    124127   * interleaved data, XYCTZ or XYCZT is used, and this method returns true. 
    125128   */ 
    126   boolean isInterleaved(String id) throws FormatException, IOException; 
     129  boolean isInterleaved() throws FormatException, IOException; 
    127130 
    128131  /** 
     
    133136   * the interleaved lifetime bins and non-interleaved spectral channels. 
    134137   */ 
    135   boolean isInterleaved(String id, int subC) 
    136     throws FormatException, IOException; 
    137  
    138   /** Obtains the specified image from the given file. */ 
    139   BufferedImage openImage(String id, int no) 
    140     throws FormatException, IOException; 
    141  
    142   /** 
    143    * Obtains the specified image from the given file as a byte array. 
    144    */ 
    145   byte[] openBytes(String id, int no) throws FormatException, IOException; 
    146  
    147   /** 
    148    * Obtains the specified image from the given file into a pre-allocated byte 
     138  boolean isInterleaved(int subC) 
     139    throws FormatException, IOException; 
     140 
     141  /** Obtains the specified image from the current file. */ 
     142  BufferedImage openImage(int no) 
     143    throws FormatException, IOException; 
     144 
     145  /** 
     146   * Obtains the specified image from the current file as a byte array. 
     147   */ 
     148  byte[] openBytes(int no) throws FormatException, IOException; 
     149 
     150  /** 
     151   * Obtains the specified image from the current file into a pre-allocated byte 
    149152   * array of (sizeX * sizeY * bytesPerPixel). 
    150153   * @param id the filename of the base image. 
     
    156159   * @throws IOException if there was a problem reading the file. 
    157160   */ 
    158   byte[] openBytes(String id, int no, byte[] buf) 
    159     throws FormatException, IOException; 
    160  
    161   /** Obtains a thumbnail for the specified image from the given file. */ 
    162   BufferedImage openThumbImage(String id, int no) 
    163     throws FormatException, IOException; 
    164  
    165   /** 
    166    * Obtains a thumbnail for the specified image from the given file, 
     161  byte[] openBytes(int no, byte[] buf) 
     162    throws FormatException, IOException; 
     163 
     164  /** Obtains a thumbnail for the specified image from the current file. */ 
     165  BufferedImage openThumbImage(int no) 
     166    throws FormatException, IOException; 
     167 
     168  /** 
     169   * Obtains a thumbnail for the specified image from the current file, 
    167170   * as a byte array. 
    168171   */ 
    169   byte[] openThumbBytes(String id, int no) throws FormatException, IOException; 
     172  byte[] openThumbBytes(int no) throws FormatException, IOException; 
    170173 
    171174  /** 
     
    182185 
    183186  /** Gets the number of series in this file. */ 
    184   int getSeriesCount(String id) throws FormatException, IOException; 
     187  int getSeriesCount() throws FormatException, IOException; 
    185188 
    186189  /** Activates the specified series. */ 
    187   void setSeries(String id, int no) throws FormatException, IOException; 
     190  void setSeries(int no) throws FormatException, IOException; 
    188191 
    189192  /** Gets the currently active series. */ 
    190   int getSeries(String id) throws FormatException, IOException; 
     193  int getSeries() throws FormatException, IOException; 
    191194 
    192195  /** Specifies whether or not to normalize float data. */ 
     
    197200 
    198201  /** Returns an array of filenames needed to open this dataset. */ 
    199   String[] getUsedFiles(String id) throws FormatException, IOException; 
     202  String[] getUsedFiles() throws FormatException, IOException; 
    200203 
    201204  /** Returns the current file. */ 
     
    206209   * to the given Z, C and T coordinates. 
    207210   */ 
    208   int getIndex(String id, int z, int c, int t) 
    209     throws FormatException, IOException; 
     211  int getIndex(int z, int c, int t) throws FormatException, IOException; 
    210212 
    211213  /** 
     
    213215   * to the given rasterized index value. 
    214216   */ 
    215   int[] getZCTCoords(String id, int index) 
    216     throws FormatException, IOException; 
    217  
    218   /** 
    219    * Obtains the specified metadata field's value for the given file. 
     217  int[] getZCTCoords(int index) throws FormatException, IOException; 
     218 
     219  /** 
     220   * Obtains the specified metadata field's value for the current file. 
    220221   * 
    221222   * @param field the name associated with the metadata field 
    222223   * @return the value, or null if the field doesn't exist 
    223224   */ 
    224   Object getMetadataValue(String id, String field) 
    225     throws FormatException, IOException; 
     225  Object getMetadataValue(String field) throws FormatException, IOException; 
    226226 
    227227  /** 
    228228   * Obtains the hashtable containing the metadata field/value pairs from 
    229    * the given file. 
     229   * the current file. 
    230230   * 
    231231   * @param id the filename 
    232232   * @return the hashtable containing all metadata from the file 
    233233   */ 
    234   Hashtable getMetadata(String id) throws FormatException, IOException; 
    235  
    236   /** Obtains the core metadata values for the given file. */ 
    237   CoreMetadata getCoreMetadata(String id) throws FormatException, IOException; 
     234  Hashtable getMetadata() throws FormatException, IOException; 
     235 
     236  /** Obtains the core metadata values for the current file. */ 
     237  CoreMetadata getCoreMetadata() throws FormatException, IOException; 
    238238 
    239239  /** 
     
    262262   * @return a metadata store implementation. 
    263263   */ 
    264   MetadataStore getMetadataStore(String id) throws FormatException, IOException; 
     264  MetadataStore getMetadataStore() throws FormatException, IOException; 
    265265 
    266266  /** 
     
    275275   *   unsupported type. 
    276276   */ 
    277   Object getMetadataStoreRoot(String id) throws FormatException, IOException; 
     277  Object getMetadataStoreRoot() throws FormatException, IOException; 
    278278 
    279279  /** 
     
    283283  boolean testRead(String[] args) throws FormatException, IOException; 
    284284 
     285  // -- Deprecated API methods -- 
     286 
     287  /** @deprecated Replaced by {@link getImageCount()} */  
     288  int getImageCount(String id) throws FormatException, IOException; 
     289 
     290  /** @deprecated Replaced by {@link isRGB()} */  
     291  boolean isRGB(String id) throws FormatException, IOException; 
     292 
     293  /** @deprecated Replaced by {@link getSizeX()} */ 
     294  int getSizeX(String id) throws FormatException, IOException; 
     295 
     296  /** @deprecated Replaced by {@link getSizeY()} */ 
     297  int getSizeY(String id) throws FormatException, IOException; 
     298 
     299  /** @deprecated Replaced by {@link getSizeZ()} */ 
     300  int getSizeZ(String id) throws FormatException, IOException; 
     301 
     302  /** @deprecated Replaced by {@link getSizeC()} */ 
     303  int getSizeC(String id) throws FormatException, IOException; 
     304 
     305  /** @deprecated Replaced by {@link getSizeT()} */ 
     306  int getSizeT(String id) throws FormatException, IOException; 
     307 
     308  /** @deprecated Replaced by {@link getPixelType()} */  
     309  int getPixelType(String id) throws FormatException, IOException; 
     310 
     311  /** @deprecated Replaced by {@link getEffectiveSizeC()} */  
     312  int getEffectiveSizeC(String id) throws FormatException, IOException; 
     313 
     314  /** @deprecated Replaced by {@link getRGBChannelCount()} */  
     315  int getRGBChannelCount(String id) throws FormatException, IOException; 
     316 
     317  /** @deprecated Replaced by {@link getChannelDimLengths()} */  
     318  int[] getChannelDimLengths(String id) throws FormatException, IOException; 
     319 
     320  /** @deprecated Replaced by {@link getChannelDimTypes()} */  
     321  String[] getChannelDimTypes(String id) throws FormatException, IOException; 
     322 
     323  /** @deprecated Replaced by {@link getThumbSizeX()} */  
     324  int getThumbSizeX(String id) throws FormatException, IOException; 
     325 
     326  /** @deprecated Replaced by {@link getThumbSizeY()} */  
     327  int getThumbSizeY(String id) throws FormatException, IOException; 
     328 
     329  /** @deprecated Replaced by {@link isLittleEndian()} */  
     330  boolean isLittleEndian(String id) throws FormatException, IOException; 
     331 
     332  /** @deprecated Replaced by {@link getDimensionOrder()} */  
     333  String getDimensionOrder(String id) throws FormatException, IOException; 
     334 
     335  /** @deprecated Replaced by {@link isOrderCertain()} */  
     336  boolean isOrderCertain(String id) throws FormatException, IOException; 
     337 
     338  /** @deprecated Replaced by {@link isInterleaved()} */  
     339  boolean isInterleaved(String id) throws FormatException, IOException; 
     340 
     341  /** @deprecated Replaced by {@link isInterleaved(int)} */  
     342  boolean isInterleaved(String id, int subC) 
     343    throws FormatException, IOException; 
     344 
     345  /** @deprecated Replaced by {@link openImage(int)} */  
     346  BufferedImage openImage(String id, int no) 
     347    throws FormatException, IOException; 
     348 
     349  /** @deprecated Replaced by {@link openBytes(int)} */  
     350  byte[] openBytes(String id, int no) throws FormatException, IOException; 
     351 
     352  /** @deprecated Replaced by {@link openBytes(int, byte[])} */  
     353  byte[] openBytes(String id, int no, byte[] buf) 
     354    throws FormatException, IOException; 
     355 
     356  /** @deprecated Replaced by {@link openThumbImage(int)} */  
     357  BufferedImage openThumbImage(String id, int no) 
     358    throws FormatException, IOException; 
     359 
     360  /** @deprecated Replaced by {@link openThumbBytes(int)} */  
     361  byte[] openThumbBytes(String id, int no) throws FormatException, IOException; 
     362 
     363  /** @deprecated Replaced by {@link getSeriesCount()} */  
     364  int getSeriesCount(String id) throws FormatException, IOException; 
     365 
     366  /** @deprecated Replaced by {@link setSeries(int)} */  
     367  void setSeries(String id, int no) throws FormatException, IOException; 
     368 
     369  /** @deprecated Replaced by {@link getSeries()} */  
     370  int getSeries(String id) throws FormatException, IOException; 
     371 
     372  /** @deprecated Replaced by {@link getUsedFiles()} */  
     373  String[] getUsedFiles(String id) throws FormatException, IOException; 
     374 
     375  /** @deprecated Replaced by {@link getIndex(int, int, int)} */  
     376  int getIndex(String id, int z, int c, int t) 
     377    throws FormatException, IOException; 
     378 
     379  /** @deprecated Replaced by {@link getZCTCoords(int)} */  
     380  int[] getZCTCoords(String id, int index) 
     381    throws FormatException, IOException; 
     382 
     383  /** @deprecated Replaced by {@link getMetadataValue(String)} */  
     384  Object getMetadataValue(String id, String field) 
     385    throws FormatException, IOException; 
     386 
     387  /** @deprecated Replaced by {@link getMetadata()} */  
     388  Hashtable getMetadata(String id) throws FormatException, IOException; 
     389 
     390  /** @deprecated Replaced by {@link getCoreMetadata()} */  
     391  CoreMetadata getCoreMetadata(String id) throws FormatException, IOException; 
     392 
     393  /** @deprecated Replaced by {@link getMetadataStore()} */  
     394  MetadataStore getMetadataStore(String id) throws FormatException, IOException; 
     395 
     396  /** @deprecated Replaced by {@link getMetadataStoreRoot()} */  
     397  Object getMetadataStoreRoot(String id) throws FormatException, IOException; 
     398 
    285399} 
  • trunk/loci/formats/ImageReader.java

    r2564 r2583  
    133133  } 
    134134 
     135  /** Gets the reader used to open the current file. */ 
     136  public IFormatReader getReader() throws FormatException, IOException { 
     137    return readers[current]; 
     138  } 
     139 
    135140  /** Gets the file format reader instance matching the given class. */ 
    136141  public IFormatReader getReader(Class c) { 
     
    158163  } 
    159164 
    160   /* @see IFormatReader.getImageCount(String) */ 
    161   public int getImageCount(String id) throws FormatException, IOException { 
    162     return getReader(id).getImageCount(id); 
    163   } 
    164  
    165   /* @see IFormatReader.isRGB(String) */ 
    166   public boolean isRGB(String id) throws FormatException, IOException { 
    167     return getReader(id).isRGB(id); 
    168   } 
    169  
    170   /* @see IFormatReader.getSizeX(String) */ 
    171   public int getSizeX(String id) throws FormatException, IOException { 
    172     return getReader(id).getSizeX(id); 
    173   } 
    174  
    175   /* @see IFormatReader.getSizeY(String) */ 
    176   public int getSizeY(String id) throws FormatException, IOException { 
    177     return getReader(id).getSizeY(id); 
    178   } 
    179  
    180   /* @see IFormatReader.getSizeZ(String) */ 
    181   public int getSizeZ(String id) throws FormatException, IOException { 
    182     return getReader(id).getSizeZ(id); 
    183   } 
    184  
    185   /* @see IFormatReader.getSizeC(String) */ 
    186   public int getSizeC(String id) throws FormatException, IOException { 
    187     return getReader(id).getSizeC(id); 
    188   } 
    189  
    190   /* @see IFormatReader.getSizeT(String) */ 
    191   public int getSizeT(String id) throws FormatException, IOException { 
    192     return getReader(id).getSizeT(id); 
    193   } 
    194  
    195   /* @see IFormatReader#getPixelType(String) */ 
    196   public int getPixelType(String id) throws FormatException, IOException { 
    197     return getReader(id).getPixelType(id); 
    198   } 
    199  
    200   /* @see IFormatReader#getEffectiveSizeC(String) */ 
    201   public int getEffectiveSizeC(String id) throws FormatException, IOException { 
    202     return getReader(id).getEffectiveSizeC(id); 
    203   } 
    204  
    205   /* @see IFormatReader#getRGBChannelCount(String) */ 
    206   public int getRGBChannelCount(String id) throws FormatException, IOException { 
    207     return getReader(id).getRGBChannelCount(id); 
    208   } 
    209  
    210   /* @see IFormatReader#getChannelDimLengths(String) */ 
    211   public int[] getChannelDimLengths(String id) 
    212     throws FormatException, IOException 
    213   { 
    214     return getReader(id).getChannelDimLengths(id); 
    215   } 
    216  
    217   /* @see IFormatReader#getChannelDimTypes(String) */ 
    218   public String[] getChannelDimTypes(String id) 
    219     throws FormatException, IOException 
    220   { 
    221     return getReader(id).getChannelDimTypes(id); 
    222   } 
    223  
    224   /* @see IFormatReader#getThumbSizeX(String) */ 
    225   public int getThumbSizeX(String id) throws FormatException, IOException { 
    226     return getReader(id).getThumbSizeX(id); 
    227   } 
    228  
    229   /* @see IFormatReader#getThumbSizeY(String) */ 
    230   public int getThumbSizeY(String id) throws FormatException, IOException { 
    231     return getReader(id).getThumbSizeY(id); 
    232   } 
    233  
    234   /* @see IFormatReader#isLittleEndian(String) */ 
    235   public boolean isLittleEndian(String id) throws FormatException, IOException { 
    236     return getReader(id).isLittleEndian(id); 
    237   } 
    238  
    239   /* @see IFormatReader#getDimensionOrder(String) */ 
    240   public String getDimensionOrder(String id) 
    241     throws FormatException, IOException 
    242   { 
    243     return getReader(id).getDimensionOrder(id); 
    244   } 
    245  
    246   /* @see IFormatReader#isOrderCertain(String) */ 
    247   public boolean isOrderCertain(String id) throws FormatException, IOException { 
    248     return getReader(id).isOrderCertain(id); 
    249   } 
    250  
    251   /* @see IFormatReader#isInterleaved(String) */ 
    252   public boolean isInterleaved(String id) throws FormatException, IOException { 
    253     return getReader(id).isInterleaved(id); 
    254   } 
    255  
    256   /* @see IFormatReader#isInterleaved(String, int) */ 
    257   public boolean isInterleaved(String id, int subC) 
    258     throws FormatException, IOException 
    259   { 
    260     return getReader(id).isInterleaved(id, subC); 
    261   } 
    262  
    263   /* @see IFormatReader#openImage(String, int) */ 
    264   public BufferedImage openImage(String id, int no) 
    265     throws FormatException, IOException 
    266   { 
    267     return getReader(id).openImage(id, no); 
    268   } 
    269  
    270   /* @see IFormatReader#openBytes(String, int) */ 
    271   public byte[] openBytes(String id, int no) 
    272     throws FormatException, IOException 
    273   { 
    274     return getReader(id).openBytes(id, no); 
    275   } 
    276  
    277   /* @see IFormatReader#openBytes(String, int, byte[]) */ 
    278   public byte[] openBytes(String id, int no, byte[] buf) 
    279     throws FormatException, IOException 
    280   { 
    281     return getReader(id).openBytes(id, no, buf); 
    282   } 
    283  
    284   /* @see IFormatReader#openThumbImage(String, int) */ 
    285   public BufferedImage openThumbImage(String id, int no) 
    286     throws FormatException, IOException 
    287   { 
    288     return getReader(id).openThumbImage(id, no); 
    289   } 
    290  
    291   /* @see IFormatReader#openThumbBytes(String, int) */ 
    292   public byte[] openThumbBytes(String id, int no) 
    293     throws FormatException, IOException 
    294   { 
    295     return getReader(id).openThumbBytes(id, no); 
     165  /* @see IFormatReader#setId(String) */ 
     166  public void setId(String id) throws FormatException, IOException { 
     167    getReader(id).setId(id);  
     168  } 
     169 
     170  /* @see IFormatReader#getImageCount() */ 
     171  public int getImageCount() throws FormatException, IOException { 
     172    return getReader().getImageCount(); 
     173  } 
     174 
     175  /* @see IFormatReader#isRGB() */ 
     176  public boolean isRGB() throws FormatException, IOException { 
     177    return getReader().isRGB(); 
     178  } 
     179 
     180  /* @see IFormatReader#getSizeX() */ 
     181  public int getSizeX() throws FormatException, IOException { 
     182    return getReader().getSizeX(); 
     183  }  
     184 
     185  /* @see IFormatReader#getSizeY() */ 
     186  public int getSizeY() throws FormatException, IOException { 
     187    return getReader().getSizeY(); 
     188  }  
     189 
     190  /* @see IFormatReader#getSizeC() */ 
     191  public int getSizeC() throws FormatException, IOException { 
     192    return getReader().getSizeC(); 
     193  }  
     194 
     195  /* @see IFormatReader#getSizeZ() */ 
     196  public int getSizeZ() throws FormatException, IOException { 
     197    return getReader().getSizeZ(); 
     198  }  
     199 
     200  /* @see IFormatReader#getSizeT() */ 
     201  public int getSizeT() throws FormatException, IOException { 
     202    return getReader().getSizeT(); 
     203  }  
     204 
     205  /* @see IFormatReader#getPixelType() */ 
     206  public int getPixelType() throws FormatException, IOException { 
     207    return getReader().getPixelType(); 
     208  } 
     209 
     210  /* @see IFormatReader#getEffectiveSizeC() */ 
     211  public int getEffectiveSizeC() throws FormatException, IOException { 
     212    return getReader().getEffectiveSizeC(); 
     213  } 
     214 
     215  /* @see IFormatReader#getRGBChannelCount() */ 
     216  public int getRGBChannelCount() throws FormatException, IOException { 
     217    return getReader().getRGBChannelCount(); 
     218  } 
     219 
     220  /* @see IFormatReader#getChannelDimLengths() */ 
     221  public int[] getChannelDimLengths() throws FormatException, IOException { 
     222    return getReader().getChannelDimLengths(); 
     223  } 
     224 
     225  /* @see IFormatReader#getChannelDimTypes() */ 
     226  public String[] getChannelDimTypes() throws FormatException, IOException { 
     227    return getReader().getChannelDimTypes(); 
     228  } 
     229 
     230  /* @see IFormatReader#getThumbSizeX() */ 
     231  public int getThumbSizeX() throws FormatException, IOException { 
     232    return getReader().getThumbSizeX(); 
     233  } 
     234 
     235  /* @see IFormatReader#getThumbSizeY() */ 
     236  public int getThumbSizeY() throws FormatException, IOException { 
     237    return getReader().getThumbSizeY(); 
     238  } 
     239 
     240  /* @see IFormatReader#isLittleEndian() */ 
     241  public boolean isLittleEndian() throws FormatException, IOException { 
     242    return getReader().isLittleEndian(); 
     243  } 
     244 
     245  /* @see IFormatReader#getDimensionOrder() */ 
     246  public String getDimensionOrder() throws FormatException, IOException { 
     247    return getReader().getDimensionOrder(); 
     248  } 
     249 
     250  /* @see IFormatReader#isOrderCertain() */ 
     251  public boolean isOrderCertain() throws FormatException, IOException { 
     252    return getReader().isOrderCertain(); 
     253  } 
     254 
     255  /* @see IFormatReader#isInterleaved() */ 
     256  public boolean isInterleaved() throws FormatException, IOException { 
     257    return getReader().isInterleaved(); 
     258  } 
     259 
     260  /* @see IFormatReader#isInterleaved(int) */ 
     261  public boolean isInterleaved(int subC) throws FormatException, IOException { 
     262    return getReader().isInterleaved(subC); 
     263  } 
     264 
     265  /* @see IFormatReader#openImage(int) */ 
     266  public BufferedImage openImage(int no) throws FormatException, IOException { 
     267    return getReader().openImage(no); 
     268  } 
     269 
     270  /* @see IFormatReader#openBytes(int) */ 
     271  public byte[] openBytes(int no) throws FormatException, IOException { 
     272    return getReader().openBytes(no); 
     273  } 
     274 
     275  /* @see IFormatReader#openBytes(int, byte[]) */ 
     276  public byte[] openBytes(int no, byte[] buf) 
     277    throws FormatException, IOException 
     278  { 
     279    return getReader().openBytes(no, buf); 
     280  } 
     281 
     282  /* @see IFormatReader#openThumbImage(int) */ 
     283  public BufferedImage openThumbImage(int no) 
     284    throws FormatException, IOException 
     285  { 
     286    return getReader().openThumbImage(no); 
     287  } 
     288 
     289  /* @see IFormatReader#openThumbBytes(int) */ 
     290  public byte[] openThumbBytes(int no) throws FormatException, IOException { 
     291    return getReader().openThumbBytes(no); 
     292  } 
     293 
     294  /* @see IFormatReader#getSeriesCount() */ 
     295  public int getSeriesCount() throws FormatException, IOException { 
     296    return getReader().getSeriesCount(); 
     297  } 
     298 
     299  /* @see IFormatReader#setSeries(int) */ 
     300  public void setSeries(int no) throws FormatException, IOException { 
     301    getReader().setSeries(no); 
     302  } 
     303 
     304  /* @see IFormatReader#getSeries() */ 
     305  public int getSeries() throws FormatException, IOException { 
     306    return getReader().getSeries(); 
     307  } 
     308 
     309  /* @see IFormatReader#getUsedFiles() */ 
     310  public String[] getUsedFiles() throws FormatException, IOException { 
     311    return getReader().getUsedFiles(); 
     312  } 
     313 
     314  /* @see IFormatReader#getIndex(int, int, int) */ 
     315  public int getIndex(int z, int c, int t) throws FormatException, IOException 
     316  { 
     317    return getReader().getIndex(z, c, t); 
     318  } 
     319 
     320  /* @see IFormatReader#getZCTCoords(int) */ 
     321  public int[] getZCTCoords(int index) throws FormatException, IOException { 
     322    return getReader().getZCTCoords(index); 
     323  } 
     324 
     325  /* @see IFormatReader#getMetadataValue(String) */ 
     326  public Object getMetadataValue(String field) 
     327    throws FormatException, IOException 
     328  { 
     329    return getReader().getMetadataValue(field); 
     330  } 
     331 
     332  /* @see IFormatReader#getMetadata() */ 
     333  public Hashtable getMetadata() throws FormatException, IOException { 
     334    return getReader().getMetadata(); 
     335  } 
     336 
     337  /* @see IFormatReader#getCoreMetadata() */ 
     338  public CoreMetadata getCoreMetadata() throws FormatException, IOException { 
     339    return getReader().getCoreMetadata(); 
     340  } 
     341 
     342  /* @see IFormatReader#getMetadataStore() */ 
     343  public MetadataStore getMetadataStore() throws FormatException, IOException { 
     344    return getReader().getMetadataStore(); 
     345  } 
     346 
     347  /* @see IFormatReader#getMetadataStoreRoot() */ 
     348  public Object getMetadataStoreRoot() throws FormatException, IOException { 
     349    return getReader().getMetadataStoreRoot(); 
    296350  } 
    297351 
     
    306360  } 
    307361 
    308   /* @see IFormatReader#getSeriesCount(String) */ 
    309   public int getSeriesCount(String id) throws FormatException, IOException { 
    310     return getReader(id).getSeriesCount(id); 
    311   } 
    312  
    313   /* @see IFormatReader#setSeries(String, int) */ 
    314   public void setSeries(String id, int no) throws FormatException, IOException { 
    315     getReader(id).setSeries(id, no); 
    316   } 
    317  
    318   /* @see IFormatReader#getSeries(String) */ 
    319   public int getSeries(String id) throws FormatException, IOException { 
    320     return getReader(id).getSeries(id); 
    321   } 
    322  
    323362  /* @see IFormatReader#setNormalized(boolean) */ 
    324363  public void setNormalized(boolean normalize) { 
    325364    for (int i=0; i<readers.length; i++) readers[i].setNormalized(normalize); 
    326365  } 
    327  
     366   
    328367  /* @see IFormatReader#isNormalized() */ 
    329368  public boolean isNormalized() { 
    330369    // NB: all readers should have the same normalization setting 
    331370    return readers[0].isNormalized(); 
    332   } 
    333  
    334   /* @see IFormatReader#getUsedFiles(String) */ 
    335   public String[] getUsedFiles(String id) throws FormatException, IOException { 
    336     return getReader(id).getUsedFiles(id); 
    337   } 
     371  }  
    338372 
    339373  /* @see IFormatReader#getCurrentFile() */ 
    340374  public String getCurrentFile() { 
    341375    try { 
    342       return getReader(currentId).getCurrentFile(); 
     376      return getReader().getCurrentFile(); 
    343377    } 
    344378    catch (FormatException e) { e.printStackTrace(); } 
     
    347381  } 
    348382 
    349   /* @see IFormatReader#getIndex(String, int, int, int) */ 
    350   public int getIndex(String id, int z, int c, int t) 
    351     throws FormatException, IOException 
    352   { 
    353     return getReader(id).getIndex(id, z, c, t); 
    354   } 
    355  
    356   /* @see IFormatReader#getZCTCoords(String, int) */ 
    357   public int[] getZCTCoords(String id, int index) 
    358     throws FormatException, IOException 
    359   { 
    360     return getReader(id).getZCTCoords(id, index); 
    361   } 
    362  
    363   /* @see IFormatReader#getMetadataValue(String, String) */ 
    364   public Object getMetadataValue(String id, String field) 
    365     throws FormatException, IOException 
    366   { 
    367     return getReader(id).getMetadataValue(id, field); 
    368   } 
    369  
    370   /* @see IFormatReader#getMetadata(String) */ 
    371   public Hashtable getMetadata(String id) throws FormatException, IOException { 
    372     return getReader(id).getMetadata(id); 
    373   } 
    374  
    375   /* @see IFormatReader#getCoreMetadata(String) */ 
    376   public CoreMetadata getCoreMetadata(String id) 
    377     throws FormatException, IOException 
    378   { 
    379     return getReader(id).getCoreMetadata(id); 
    380   } 
    381  
    382383  /* @see IFormatReader#setMetadataFiltered(boolean) */ 
    383384  public void setMetadataFiltered(boolean filter) { 
     
    388389  public boolean isMetadataFiltered() { 
    389390    // NB: all readers should have the same metadata filtering setting 
    390     return readers[0].isNormalized(); 
    391   } 
    392  
    393   /* @see FormatReader#setMetadataStore(MetadataStore) */ 
     391    return readers[0].isMetadataFiltered(); 
     392  } 
     393 
     394  /* @see IFormatReader#setMetadataStore(MetadataStore) */ 
    394395  public void setMetadataStore(MetadataStore store) { 
    395     for (int i=0; i<readers.length; i++) { 
    396       readers[i].setMetadataStore(store); 
    397     } 
    398   } 
    399  
    400   /* @see IFormatReader#getMetadataStore(String) */ 
    401   public MetadataStore getMetadataStore(String id) 
    402     throws FormatException, IOException 
    403   { 
    404     return getReader(id).getMetadataStore(id); 
    405   } 
    406  
    407   /* @see IFormatReader#getMetadataStoreRoot(String) */ 
    408   public Object getMetadataStoreRoot(String id) 
    409     throws FormatException, IOException 
    410   { 
    411     return getReader(id).getMetadataStoreRoot(id); 
     396    for (int i=0; i<readers.length; i++) readers[i].setMetadataStore(store); 
    412397  } 
    413398 
     
    415400  public boolean testRead(String[] args) throws FormatException, IOException { 
    416401    return FormatTools.testRead(this, args); 
     402  } 
     403 
     404  // -- Deprecated IFormatReader API methods -- 
     405 
     406  /** @deprecated Replaced by {@link getImageCount()} */ 
     407  public int getImageCount(String id) throws FormatException, IOException { 
     408    setId(id); 
     409    return getReader().getImageCount(); 
     410  } 
     411 
     412  /** @deprecated Replaced by {@link isRGB()} */ 
     413  public boolean isRGB(String id) throws FormatException, IOException { 
     414    setId(id); 
     415    return getReader().isRGB(); 
     416  } 
     417 
     418  /** @deprecated Replaced by {@link getSizeX()} */ 
     419  public int getSizeX(String id) throws FormatException, IOException { 
     420    setId(id); 
     421    return getReader().getSizeX(); 
     422  } 
     423 
     424  /** @deprecated Replaced by {@link getSizeY()} */ 
     425  public int getSizeY(String id) throws FormatException, IOException { 
     426    setId(id); 
     427    return getReader().getSizeY(); 
     428  } 
     429 
     430  /** @deprecated Replaced by {@link getSizeZ()} */ 
     431  public int getSizeZ(String id) throws FormatException, IOException { 
     432    setId(id); 
     433    return getReader().getSizeZ(); 
     434  } 
     435 
     436  /** @deprecated Replaced by {@link getSizeC()} */ 
     437  public int getSizeC(String id) throws FormatException, IOException { 
     438    setId(id); 
     439    return getReader().getSizeC(); 
     440  } 
     441 
     442  /** @deprecated Replaced by {@link getSizeT()} */ 
     443  public int getSizeT(String id) throws FormatException, IOException { 
     444    setId(id); 
     445    return getReader().getSizeT(); 
     446  } 
     447 
     448  /** @deprecated Replaced by {@link getPixelType()} */ 
     449  public int getPixelType(String id) throws FormatException, IOException { 
     450    setId(id); 
     451    return getReader().getPixelType(); 
     452  } 
     453 
     454  /** @deprecated Replaced by {@link getEffectiveSizeC()} */ 
     455  public int getEffectiveSizeC(String id) throws FormatException, IOException { 
     456    setId(id); 
     457    return getReader().getEffectiveSizeC(); 
     458  } 
     459 
     460  /** @deprecated Replaced by {@link getRGBChannelCount()} */ 
     461  public int getRGBChannelCount(String id) throws FormatException, IOException { 
     462    setId(id); 
     463    return getReader().getRGBChannelCount(); 
     464  } 
     465 
     466  /** @deprecated Replaced by {@link getChannelDimLengths()} */ 
     467  public int[] getChannelDimLengths(String id) 
     468    throws FormatException, IOException 
     469  { 
     470    setId(id); 
     471    return getReader().getChannelDimLengths(); 
     472  } 
     473 
     474  /** @deprecated Replaced by {@link getChannelDimTypes()} */ 
     475  public String[] getChannelDimTypes(String id) 
     476    throws FormatException, IOException 
     477  { 
     478    setId(id); 
     479    return getReader().getChannelDimTypes(); 
     480  } 
     481 
     482  /** @deprecated Replaced by {@link getThumbSizeX()} */ 
     483  public int getThumbSizeX(String id) throws FormatException, IOException { 
     484    setId(id); 
     485    return getReader().getThumbSizeX(); 
     486  } 
     487 
     488  /** @deprecated Replaced by {@link getThumbSizeY()} */ 
     489  public int getThumbSizeY(String id) throws FormatException, IOException { 
     490    setId(id); 
     491    return getReader().getThumbSizeY(); 
     492  } 
     493 
     494  /** @deprecated Replaced by {@link isLittleEndian()} */ 
     495  public boolean isLittleEndian(String id) throws FormatException, IOException { 
     496    setId(id); 
     497    return getReader().isLittleEndian(); 
     498  } 
     499 
     500  /** @deprecated Replaced by {@link getDimensionOrder()} */ 
     501  public String getDimensionOrder(String id) 
     502    throws FormatException, IOException 
     503  { 
     504    setId(id); 
     505    return getReader().getDimensionOrder(); 
     506  } 
     507 
     508  /** @deprecated Replaced by {@link isOrderCertain()} */ 
     509  public boolean isOrderCertain(String id) throws FormatException, IOException { 
     510    setId(id); 
     511    return getReader().isOrderCertain(); 
     512  } 
     513 
     514  /** @deprecated Replaced by {@link isInterleaved()} */ 
     515  public boolean isInterleaved(String id) throws FormatException, IOException { 
     516    setId(id); 
     517    return getReader().isInterleaved(); 
     518  } 
     519 
     520  /** @deprecated Replaced by {@link isInterleaved(int)} */ 
     521  public boolean isInterleaved(String id, int subC) 
     522    throws FormatException, IOException 
     523  { 
     524    setId(id); 
     525    return getReader().isInterleaved(subC); 
     526  } 
     527 
     528  /** @deprecated Replaced by {@link openImage(int)} */ 
     529  public BufferedImage openImage(String id, int no) 
     530    throws FormatException, IOException 
     531  { 
     532    setId(id); 
     533    return getReader().openImage(no); 
     534  } 
     535 
     536  /** @deprecated Replaced by {@link openBytes(int)} */ 
     537  public byte[] openBytes(String id, int no) 
     538    throws FormatException, IOException 
     539  { 
     540    setId(id); 
     541    return getReader().openBytes(no); 
     542  } 
     543 
     544  /** @deprecated Replaced by {@link openBytes(int, byte[])} */ 
     545  public byte[] openBytes(String id, int no, byte[] buf) 
     546    throws FormatException, IOException 
     547  { 
     548    setId(id); 
     549    return getReader().openBytes(no, buf); 
     550  } 
     551 
     552  /** @deprecated Replaced by {@link openThumbImage(int)} */ 
     553  public BufferedImage openThumbImage(String id, int no) 
     554    throws FormatException, IOException 
     555  { 
     556    setId(id); 
     557    return getReader().openThumbImage(no); 
     558  } 
     559 
     560  /** @deprecated Replaced by {@link openThumbBytes(int)} */ 
     561  public byte[] openThumbBytes(String id, int no) 
     562    throws FormatException, IOException 
     563  { 
     564    setId(id); 
     565    return getReader().openThumbBytes(no); 
     566  } 
     567 
     568  /** @deprecated Replaced by {@link getSeriesCount()} */ 
     569  public int getSeriesCount(String id) throws FormatException, IOException { 
     570    setId(id); 
     571    return getReader().getSeriesCount(); 
     572  } 
     573 
     574  /** @deprecated Replaced by {@link setSeries(int)} */ 
     575  public void setSeries(String id, int no) throws FormatException, IOException { 
     576    setId(id); 
     577    getReader().setSeries(no); 
     578  } 
     579 
     580  /** @deprecated Replaced by {@link getSeries()} */ 
     581  public int getSeries(String id) throws FormatException, IOException { 
     582    setId(id); 
     583    return getReader().getSeries(); 
     584  } 
     585 
     586  /** @deprecated Replaced by {@link getUsedFiles()} */ 
     587  public String[] getUsedFiles(String id) throws FormatException, IOException { 
     588    setId(id); 
     589    return getReader().getUsedFiles(); 
     590  } 
     591 
     592  /** @deprecated Replaced by {@link getIndex(int, int, int)} */ 
     593  public int getIndex(String id, int z, int c, int t) 
     594    throws FormatException, IOException 
     595  { 
     596    setId(id); 
     597    return getReader().getIndex(z, c, t); 
     598  } 
     599 
     600  /** @deprecated Replaced by {@link getZCTCoords(int)} */ 
     601  public int[] getZCTCoords(String id, int index) 
     602    throws FormatException, IOException 
     603  { 
     604    setId(id); 
     605    return getReader().getZCTCoords(index); 
     606  } 
     607 
     608  /** @deprecated Replaced by {@link getMetadataValue(String)} */ 
     609  public Object getMetadataValue(String id, String field) 
     610    throws FormatException, IOException 
     611  { 
     612    setId(id); 
     613    return getReader().getMetadataValue(field); 
     614  } 
     615 
     616  /** @deprecated Replaced by {@link getMetadata()} */ 
     617  public Hashtable getMetadata(String id) throws FormatException, IOException { 
     618    setId(id); 
     619    return getReader().getMetadata(); 
     620  } 
     621 
     622  /** @deprecated Replaced by {@link getCoreMetadata()} */ 
     623  public CoreMetadata getCoreMetadata(String id) 
     624    throws FormatException, IOException 
     625  { 
     626    setId(id); 
     627    return getReader().getCoreMetadata(); 
     628  } 
     629 
     630  /** @deprecated Replaced by {@link getMetadataStore()} */ 
     631  public MetadataStore getMetadataStore(String id) 
     632    throws FormatException, IOException 
     633  { 
     634    setId(id); 
     635    return getReader().getMetadataStore(); 
     636  } 
     637 
     638  /** @deprecated Replaced by {@link getMetadataStoreRoot()} */ 
     639  public Object getMetadataStoreRoot(String id) 
     640    throws FormatException, IOException 
     641  { 
     642    setId(id); 
     643    return getReader().getMetadataStoreRoot(); 
    417644  } 
    418645 
  • trunk/loci/formats/MinMaxCalculator.java

    r2556 r2583  
    6363   * Returns null if some of the image planes have not been read. 
    6464   */ 
    65   public Double getChannelGlobalMinimum(String id, int theC) 
    66     throws FormatException, IOException 
    67   { 
    68     if (theC < 0 || theC >= getSizeC(id)) { 
     65  public Double getChannelGlobalMinimum(int theC) 
     66    throws FormatException, IOException 
     67  { 
     68    if (theC < 0 || theC >= getSizeC()) { 
    6969      throw new FormatException("Invalid channel index: " + theC); 
    7070    } 
    7171   
    7272    // check that all planes have been reade  
    73     if (minMaxDone == null || minMaxDone[getSeries(id)] < getImageCount(id)) { 
     73    if (minMaxDone == null || minMaxDone[getSeries()] < getImageCount()) { 
    7474      return null; 
    7575    } 
    76     return new Double(chanMin[getSeries(id)][theC]); 
     76    return new Double(chanMin[getSeries()][theC]); 
    7777  } 
    7878 
     
    8181   * Returns null if some of the image planes have not been read. 
    8282   */ 
    83   public Double getChannelGlobalMaximum(String id, int theC) 
    84     throws FormatException, IOException 
    85   { 
    86     if (theC < 0 || theC >= getSizeC(id)) { 
     83  public Double getChannelGlobalMaximum(int theC) 
     84    throws FormatException, IOException 
     85  { 
     86    if (theC < 0 || theC >= getSizeC()) { 
    8787      throw new FormatException("Invalid channel index: " + theC); 
    8888    } 
    8989   
    9090    // check that all planes have been reade 
    91     if (minMaxDone == null || minMaxDone[getSeries(id)] < getImageCount(id)) { 
     91    if (minMaxDone == null || minMaxDone[getSeries()] < getImageCount()) { 
    9292      return null; 
    9393    } 
    94     return new Double(chanMax[getSeries(id)][theC]);  
     94    return new Double(chanMax[getSeries()][theC]);  
    9595  } 
    9696 
     
    9999   * been read.  Returns null if no image planes have been read yet. 
    100100   */ 
    101   public Double getChannelKnownMinimum(String id, int theC) 
    102     throws FormatException, IOException 
    103   { 
    104     return chanMin == null ? null : new Double(chanMin[getSeries(id)][theC]); 
     101  public Double getChannelKnownMinimum(int theC) 
     102    throws FormatException, IOException 
     103  { 
     104    return chanMin == null ? null : new Double(chanMin[getSeries()][theC]); 
    105105  } 
    106106 
     
    109109   * have been read.  Returns null if no image planes have been read yet. 
    110110   */ 
    111   public Double getChannelKnownMaximum(String id, int theC) 
    112     throws FormatException, IOException 
    113   { 
    114     return chanMax == null ? null : new Double(chanMax[getSeries(id)][theC]); 
     111  public Double getChannelKnownMaximum(int theC) 
     112    throws FormatException, IOException 
     113  { 
     114    return chanMax == null ? null : new Double(chanMax[getSeries()][theC]); 
    115115  } 
    116116 
     
    121121   * embedded channel.  Returns null if the plane has not already been read. 
    122122   */ 
    123   public Double[] getPlaneMinimum(String id, int no) 
    124     throws FormatException, IOException 
    125   { 
     123  public Double[] getPlaneMinimum(int no) throws FormatException, IOException { 
    126124    if (planeMin == null) return null; 
    127125 
    128     int numRGB = getRGBChannelCount(id); 
     126    int numRGB = getRGBChannelCount(); 
    129127    int pBase = no * numRGB; 
    130     if (planeMin[getSeries(id)][pBase] != planeMin[getSeries(id)][pBase]) { 
     128    if (planeMin[getSeries()][pBase] != planeMin[getSeries()][pBase]) { 
    131129      return null; 
    132130    }  
     
    134132    Double[] min = new Double[numRGB]; 
    135133    for (int c=0; c<numRGB; c++) { 
    136       min[c] = new Double(planeMin[getSeries(id)][pBase + c]); 
     134      min[c] = new Double(planeMin[getSeries()][pBase + c]); 
    137135    } 
    138136    return min;  
     
    145143   * embedded channel.  Returns null if the plane has not already been read. 
    146144   */ 
    147   public Double[] getPlaneMaximum(String id, int no) 
    148     throws FormatException, IOException 
    149   { 
     145  public Double[] getPlaneMaximum(int no) throws FormatException, IOException { 
    150146    if (planeMax == null) return null; 
    151147 
    152     int numRGB = getRGBChannelCount(id); 
     148    int numRGB = getRGBChannelCount(); 
    153149    int pBase = no * numRGB; 
    154     if (planeMax[getSeries(id)][pBase] != planeMax[getSeries(id)][pBase]) { 
     150    if (planeMax[getSeries()][pBase] != planeMax[getSeries()][pBase]) { 
    155151      return null; 
    156152    }  
     
    158154    Double[] max = new Double[numRGB]; 
    159155    for (int c=0; c<numRGB; c++) { 
    160       max[c] = new Double(planeMax[getSeries(id)][pBase + c]); 
     156      max[c] = new Double(planeMax[getSeries()][pBase + c]); 
    161157    } 
    162158    return max;  
     
    167163   * getChannelGlobalMinimum/Maximum can be trusted. 
    168164   */ 
    169   public boolean isMinMaxPopulated(String id)  
    170     throws FormatException, IOException 
    171   { 
    172     return minMaxDone != null && minMaxDone[getSeries(id)] == getImageCount(id); 
     165  public boolean isMinMaxPopulated() throws FormatException, IOException { 
     166    return minMaxDone != null && minMaxDone[getSeries()] == getImageCount(); 
    173167  } 
    174168 
    175169  // -- IFormatReader API methods --  
    176170 
    177   /* @see IFormatReader#openImage(String, int) */ 
    178   public BufferedImage openImage(String id, int no) 
    179     throws FormatException, IOException 
    180   { 
    181     BufferedImage b = super.openImage(id, no); 
     171  /* @see IFormatReader#openImage(int) */ 
     172  public BufferedImage openImage(int no) throws FormatException, IOException { 
     173    BufferedImage b = super.openImage(no); 
    182174    updateMinMax(b, no); 
    183175    return b; 
    184176  } 
    185177 
    186   /* @see IFormatReader#openBytes(String, int) */ 
    187   public byte[] openBytes(String id, int no) throws FormatException, IOException 
    188   { 
    189     byte[] b = super.openBytes(id, no); 
     178  /* @see IFormatReader#openBytes(int) */ 
     179  public byte[] openBytes(int no) throws FormatException, IOException { 
     180    byte[] b = super.openBytes(no); 
    190181    updateMinMax(b, no); 
    191182    return b; 
    192183  } 
    193184 
    194   /* @see IFormatReader#openBytes(String, int, byte[]) */ 
    195   public byte[] openBytes(String id, int no, byte[] buf) 
    196     throws FormatException, IOException 
    197   { 
    198     byte[] b = super.openBytes(id, no, buf); 
     185  /* @see IFormatReader#openBytes(int, byte[]) */ 
     186  public byte[] openBytes(int no, byte[] buf) 
     187    throws FormatException, IOException 
     188  { 
     189    super.openBytes(no, buf); 
     190    updateMinMax(buf, no); 
     191    return buf; 
     192  } 
     193 
     194  // -- Deprecated IFormatReader API methods -- 
     195 
     196  /** @deprecated Replaced by {@link openImage(int)} */ 
     197  public BufferedImage openImage(String id, int no) 
     198    throws FormatException, IOException 
     199  { 
     200    setId(id); 
     201    BufferedImage b = super.openImage(no); 
    199202    updateMinMax(b, no); 
    200203    return b; 
     204  } 
     205 
     206  /** @deprecated Replaced by {@link openBytes(int)} */ 
     207  public byte[] openBytes(String id, int no) throws FormatException, IOException 
     208  { 
     209    setId(id); 
     210    byte[] b = super.openBytes(no); 
     211    updateMinMax(b, no); 
     212    return b; 
     213  } 
     214 
     215  /** @deprecated Replaced by {@link openBytes(int, byte[])} */ 
     216  public byte[] openBytes(String id, int no, byte[] buf) 
     217    throws FormatException, IOException 
     218  { 
     219    setId(id); 
     220    super.openBytes(no, buf); 
     221    updateMinMax(buf, no); 
     222    return buf; 
    201223  } 
    202224 
  • trunk/loci/formats/ReaderWrapper.java

    r2564 r2583  
    6464  } 
    6565 
    66   public int getImageCount(String id) throws FormatException, IOException { 
    67     return reader.getImageCount(id); 
    68   } 
    69  
    70   public boolean isRGB(String id) throws FormatException, IOException { 
    71     return reader.isRGB(id); 
    72   } 
    73  
    74   public int getSizeX(String id) throws FormatException, IOException { 
    75     return reader.getSizeX(id); 
    76   } 
    77  
    78   public int getSizeY(String id) throws FormatException, IOException { 
    79     return reader.getSizeY(id); 
    80   } 
    81  
    82   public int getSizeZ(String id) throws FormatException, IOException { 
    83     return reader.getSizeZ(id); 
    84   } 
    85  
    86   public int getSizeC(String id) throws FormatException, IOException { 
    87     return reader.getSizeC(id); 
    88   } 
    89  
    90   public int getSizeT(String id) throws FormatException, IOException { 
    91     return reader.getSizeT(id); 
    92   } 
    93  
    94   public int getPixelType(String id) throws FormatException, IOException { 
    95     return reader.getPixelType(id); 
    96   } 
    97  
    98   public int getEffectiveSizeC(String id) throws FormatException, IOException { 
    99     return getImageCount(id) / (getSizeZ(id) * getSizeT(id)); 
    100   } 
    101  
    102   public int getRGBChannelCount(String id) throws FormatException, IOException { 
    103     return getSizeC(id) / getEffectiveSizeC(id); 
    104   } 
    105  
    106   public int[] getChannelDimLengths(String id) 
    107     throws FormatException, IOException 
    108   { 
    109     return reader.getChannelDimLengths(id); 
    110   } 
    111  
    112   public String[] getChannelDimTypes(String id) 
    113     throws FormatException, IOException 
    114   { 
    115     return reader.getChannelDimTypes(id); 
    116   } 
    117  
    118   public int getThumbSizeX(String id) throws FormatException, IOException { 
    119     return reader.getThumbSizeX(id); 
    120   } 
    121  
    122   public int getThumbSizeY(String id) throws FormatException, IOException { 
    123     return reader.getThumbSizeY(id); 
    124   } 
    125  
    126   public boolean isLittleEndian(String id) throws FormatException, IOException { 
    127     return reader.isLittleEndian(id); 
    128   } 
    129  
    130   public String getDimensionOrder(String id) 
    131     throws FormatException, IOException 
    132   { 
    133     return reader.getDimensionOrder(id); 
    134   } 
    135  
    136   public boolean isOrderCertain(String id) throws FormatException, IOException { 
    137     return reader.isOrderCertain(id); 
    138   } 
    139  
    140   public boolean isInterleaved(String id) throws FormatException, IOException { 
    141     return reader.isInterleaved(id); 
    142   } 
    143  
    144   public boolean isInterleaved(String id, int subC) 
    145     throws FormatException, IOException 
    146   { 
    147     return reader.isInterleaved(id, subC); 
    148   } 
    149  
    150   public BufferedImage openImage(String id, int no) 
    151     throws FormatException, IOException 
    152   { 
    153     return reader.openImage(id, no); 
    154   } 
    155  
    156   public byte[] openBytes(String id, int no) 
    157     throws FormatException, IOException 
    158   { 
    159     return reader.openBytes(id, no); 
    160   } 
    161  
    162   public byte[] openBytes(String id, int no, byte[] buf) 
    163     throws FormatException, IOException 
    164   { 
    165     return reader.openBytes(id, no, buf); 
    166   } 
    167  
    168   public BufferedImage openThumbImage(String id, int no) 
    169     throws FormatException, IOException 
    170   { 
    171     return reader.openThumbImage(id, no); 
    172   } 
    173  
    174   public byte[] openThumbBytes(String id, int no) 
    175     throws FormatException, IOException 
    176   { 
    177     return reader.openThumbBytes(id, no); 
     66  public void setId(String id) throws FormatException, IOException { 
     67    reader.setId(id); 
     68  } 
     69 
     70  public int getImageCount() throws FormatException, IOException { 
     71    return reader.getImageCount(); 
     72  } 
     73 
     74  public boolean isRGB() throws FormatException, IOException { 
     75    return reader.isRGB(); 
     76  } 
     77 
     78  public int getSizeX() throws FormatException, IOException { 
     79    return reader.getSizeX(); 
     80  } 
     81 
     82  public int getSizeY() throws FormatException, IOException { 
     83    return reader.getSizeY(); 
     84  } 
     85 
     86  public int getSizeZ() throws FormatException, IOException { 
     87    return reader.getSizeZ(); 
     88  } 
     89 
     90  public int getSizeC() throws FormatException, IOException { 
     91    return reader.getSizeC(); 
     92  } 
     93 
     94  public int getSizeT() throws FormatException, IOException { 
     95    return reader.getSizeT(); 
     96  } 
     97 
     98  public int getPixelType() throws FormatException, IOException { 
     99    return reader.getPixelType(); 
     100  } 
     101 
     102  public int getEffectiveSizeC() throws FormatException, IOException { 
     103    return getImageCount() / (getSizeZ() * getSizeT()); 
     104  } 
     105 
     106  public int getRGBChannelCount() throws FormatException, IOException { 
     107    return getSizeC() / getEffectiveSizeC(); 
     108  } 
     109 
     110  public int[] getChannelDimLengths() throws FormatException, IOException { 
     111    return reader.getChannelDimLengths(); 
     112  } 
     113 
     114  public String[] getChannelDimTypes() throws FormatException, IOException { 
     115    return reader.getChannelDimTypes(); 
     116  } 
     117 
     118  public int getThumbSizeX() throws FormatException, IOException { 
     119    return reader.getThumbSizeX(); 
     120  } 
     121 
     122  public int getThumbSizeY() throws FormatException, IOException { 
     123    return reader.getThumbSizeY(); 
     124  } 
     125 
     126  public boolean isLittleEndian() throws FormatException, IOException { 
     127    return reader.isLittleEndian(); 
     128  } 
     129 
     130  public String getDimensionOrder() throws FormatException, IOException { 
     131    return reader.getDimensionOrder(); 
     132  } 
     133 
     134  public boolean isOrderCertain() throws FormatException, IOException { 
     135    return reader.isOrderCertain(); 
     136  } 
     137 
     138  public boolean isInterleaved() throws FormatException, IOException { 
     139    return reader.isInterleaved(); 
     140  } 
     141 
     142  public boolean isInterleaved(int subC) throws FormatException, IOException { 
     143    return reader.isInterleaved(subC); 
     144  } 
     145 
     146  public BufferedImage openImage(int no) throws FormatException, IOException { 
     147    return reader.openImage(no); 
     148  } 
     149 
     150  public byte[] openBytes(int no) throws FormatException, IOException { 
     151    return reader.openBytes(no); 
     152  } 
     153 
     154  public byte[] openBytes(int no, byte[] buf) 
     155    throws FormatException, IOException 
     156  { 
     157    return reader.openBytes(no, buf); 
     158  } 
     159 
     160  public BufferedImage openThumbImage(int no) 
     161    throws FormatException, IOException 
     162  { 
     163    return reader.openThumbImage(no); 
     164  } 
     165 
     166  public byte[] openThumbBytes(int no) throws FormatException, IOException { 
     167    return reader.openThumbBytes(no); 
    178168  } 
    179169 
     
    186176  } 
    187177 
    188   public int getSeriesCount(String id) throws FormatException, IOException { 
    189     return reader.getSeriesCount(id); 
    190   } 
    191  
    192   public void setSeries(String id, int no) throws FormatException, IOException { 
    193     reader.setSeries(id, no); 
    194   } 
    195  
    196   public int getSeries(String id) throws FormatException, IOException { 
    197     return reader.getSeries(id); 
     178  public int getSeriesCount() throws FormatException, IOException { 
     179    return reader.getSeriesCount(); 
     180  } 
     181 
     182  public void setSeries(int no) throws FormatException, IOException { 
     183    reader.setSeries(no); 
     184  } 
     185 
     186  public int getSeries() throws FormatException, IOException { 
     187    return reader.getSeries(); 
    198188  } 
    199189 
     
    204194  public boolean isNormalized() { return reader.isNormalized(); } 
    205195 
    206   public String[] getUsedFiles(String id) throws FormatException, IOException { 
    207     return reader.getUsedFiles(id); 
     196  public String[] getUsedFiles() throws FormatException, IOException { 
     197    return reader.getUsedFiles(); 
    208198  } 
    209199 
    210200  public String getCurrentFile() { return reader.getCurrentFile(); } 
    211201 
    212   public int getIndex(String id, int z, int c, int t) 
    213     throws FormatException, IOException 
    214   { 
    215     return reader.getIndex(id, z, c, t); 
    216   } 
    217  
    218   public int[] getZCTCoords(String id, int index) 
    219     throws FormatException, IOException 
    220   { 
    221     return reader.getZCTCoords(id, index); 
    222   } 
    223  
    224   public Object getMetadataValue(String id, String field) 
    225     throws FormatException, IOException 
    226   { 
    227     return reader.getMetadataValue(id, field); 
    228   } 
    229  
    230   public Hashtable getMetadata(String id) throws FormatException, IOException { 
    231     return reader.getMetadata(id); 
    232   } 
    233  
    234   public CoreMetadata getCoreMetadata(String id) 
    235     throws FormatException, IOException 
    236   { 
    237     return reader.getCoreMetadata(id); 
     202  public int getIndex(int z, int c, int t) throws FormatException, IOException { 
     203    return reader.getIndex(z, c, t); 
     204  } 
     205 
     206  public int[] getZCTCoords(int index) throws FormatException, IOException { 
     207    return reader.getZCTCoords(index); 
     208  } 
     209 
     210  public Object getMetadataValue(String field) 
     211    throws FormatException, IOException 
     212  { 
     213    return reader.getMetadataValue(field); 
     214  } 
     215 
     216  public Hashtable getMetadata() throws FormatException, IOException { 
     217    return reader.getMetadata(); 
     218  } 
     219 
     220  public CoreMetadata getCoreMetadata() throws FormatException, IOException { 
     221    return reader.getCoreMetadata(); 
    238222  } 
    239223 
     
    248232  } 
    249233 
    250   public MetadataStore getMetadataStore(String id) 
    251     throws FormatException, IOException 
    252   { 
    253     return reader.getMetadataStore(id); 
    254   } 
    255  
    256   public Object getMetadataStoreRoot(String id) 
    257     throws FormatException, IOException 
    258   { 
    259     return reader.getMetadataStoreRoot(id); 
     234  public MetadataStore getMetadataStore() throws FormatException, IOException { 
     235    return reader.getMetadataStore(); 
     236  } 
     237 
     238  public Object getMetadataStoreRoot() throws FormatException, IOException { 
     239    return reader.getMetadataStoreRoot(); 
    260240  } 
    261241 
     
    264244  } 
    265245 
     246  // -- Deprecated IFormatReader API methods -- 
     247 
     248  public int getImageCount(String id) throws FormatException, IOException { 
     249    reader.setId(id);  
     250    return reader.getImageCount(); 
     251  } 
     252 
     253  public boolean isRGB(String id) throws FormatException, IOException { 
     254    reader.setId(id);  
     255    return reader.isRGB(); 
     256  } 
     257 
     258  public int getSizeX(String id) throws FormatException, IOException { 
     259    reader.setId(id);  
     260    return reader.getSizeX(); 
     261  } 
     262 
     263  public int getSizeY(String id) throws FormatException, IOException { 
     264    reader.setId(id);  
     265    return reader.getSizeY(); 
     266  } 
     267 
     268  public int getSizeZ(String id) throws FormatException, IOException { 
     269    reader.setId(id);  
     270    return reader.getSizeZ(); 
     271  } 
     272 
     273  public int getSizeC(String id) throws FormatException, IOException { 
     274    reader.setId(id);  
     275    return reader.getSizeC(); 
     276  } 
     277 
     278  public int getSizeT(String id) throws FormatException, IOException { 
     279    reader.setId(id);  
     280    return reader.getSizeT(); 
     281  } 
     282 
     283  public int getPixelType(String id) throws FormatException, IOException { 
     284    reader.setId(id);  
     285    return reader.getPixelType(); 
     286  } 
     287 
     288  public int getEffectiveSizeC(String id) throws FormatException, IOException { 
     289    reader.setId(id);  
     290    return getImageCount() / (getSizeZ() * getSizeT()); 
     291  } 
     292 
     293  public int getRGBChannelCount(String id) throws FormatException, IOException { 
     294    reader.setId(id);  
     295    return getSizeC() / getEffectiveSizeC(); 
     296  } 
     297 
     298  public int[] getChannelDimLengths(String id) 
     299    throws FormatException, IOException 
     300  { 
     301    reader.setId(id);  
     302    return reader.getChannelDimLengths(); 
     303  } 
     304 
     305  public String[] getChannelDimTypes(String id) 
     306    throws FormatException, IOException 
     307  { 
     308    reader.setId(id);  
     309    return reader.getChannelDimTypes(); 
     310  } 
     311 
     312  public int getThumbSizeX(String id) throws FormatException, IOException { 
     313    reader.setId(id);  
     314    return reader.getThumbSizeX(); 
     315  } 
     316 
     317  public int getThumbSizeY(String id) throws FormatException, IOException { 
     318    reader.setId(id);  
     319    return reader.getThumbSizeY(); 
     320  } 
     321 
     322  public boolean isLittleEndian(String id) throws FormatException, IOException { 
     323    reader.setId(id);  
     324    return reader.isLittleEndian(); 
     325  } 
     326 
     327  public String getDimensionOrder(String id) 
     328    throws FormatException, IOException 
     329  { 
     330    reader.setId(id);  
     331    return reader.getDimensionOrder(); 
     332  } 
     333 
     334  public boolean isOrderCertain(String id) throws FormatException, IOException { 
     335    reader.setId(id);  
     336    return reader.isOrderCertain(); 
     337  } 
     338 
     339  public boolean isInterleaved(String id) throws FormatException, IOException { 
     340    reader.setId(id);  
     341    return reader.isInterleaved(); 
     342  } 
     343 
     344  public boolean isInterleaved(String id, int subC) 
     345    throws FormatException, IOException 
     346  { 
     347    reader.setId(id);  
     348    return reader.isInterleaved(subC); 
     349  } 
     350 
     351  public BufferedImage openImage(String id, int no) 
     352    throws FormatException, IOException 
     353  { 
     354    reader.setId(id);  
     355    return reader.openImage(no); 
     356  } 
     357 
     358  public byte[] openBytes(String id, int no) 
     359    throws FormatException, IOException 
     360  { 
     361    reader.setId(id);  
     362    return reader.openBytes(no); 
     363  } 
     364 
     365  public byte[] openBytes(String id, int no, byte[] buf) 
     366    throws FormatException, IOException 
     367  { 
     368    reader.setId(id);  
     369    return reader.openBytes(no, buf); 
     370  } 
     371 
     372  public BufferedImage openThumbImage(String id, int no) 
     373    throws FormatException, IOException 
     374  { 
     375    reader.setId(id);  
     376    return reader.openThumbImage(no); 
     377  } 
     378 
     379  public byte[] openThumbBytes(String id, int no) 
     380    throws FormatException, IOException 
     381  { 
     382    reader.setId(id);  
     383    return reader.openThumbBytes(no); 
     384  } 
     385 
     386  public int getSeriesCount(String id) throws FormatException, IOException { 
     387    reader.setId(id);  
     388    return reader.getSeriesCount(); 
     389  } 
     390 
     391  public void setSeries(String id, int no) throws FormatException, IOException { 
     392    reader.setId(id);  
     393    reader.setSeries(no); 
     394  } 
     395 
     396  public int getSeries(String id) throws FormatException, IOException { 
     397    reader.setId(id);  
     398    return reader.getSeries(); 
     399  } 
     400 
     401  public String[] getUsedFiles(String id) throws FormatException, IOException { 
     402    reader.setId(id);  
     403    return reader.getUsedFiles(); 
     404  } 
     405 
     406  public int getIndex(String id, int z, int c, int t) 
     407    throws FormatException, IOException 
     408  { 
     409    reader.setId(id);  
     410    return reader.getIndex(z, c, t); 
     411  } 
     412 
     413  public int[] getZCTCoords(String id, int index) 
     414    throws FormatException, IOException 
     415  { 
     416    reader.setId(id);  
     417    return reader.getZCTCoords(index); 
     418  } 
     419 
     420  public Object getMetadataValue(String id, String field) 
     421    throws FormatException, IOException 
     422  { 
     423    reader.setId(id);  
     424    return reader.getMetadataValue(field); 
     425  } 
     426 
     427  public Hashtable getMetadata(String id) throws FormatException, IOException { 
     428    reader.setId(id);  
     429    return reader.getMetadata(); 
     430  } 
     431 
     432  public CoreMetadata getCoreMetadata(String id) 
     433    throws FormatException, IOException 
     434  { 
     435    reader.setId(id);  
     436    return reader.getCoreMetadata(); 
     437  } 
     438 
     439  public MetadataStore getMetadataStore(String id) 
     440    throws FormatException, IOException 
     441  { 
     442    reader.setId(id);  
     443    return reader.getMetadataStore(); 
     444  } 
     445 
     446  public Object getMetadataStoreRoot(String id) 
     447    throws FormatException, IOException 
     448  { 
     449    reader.setId(id);  
     450    return reader.getMetadataStoreRoot(); 
     451  } 
     452 
    266453  // -- IFormatHandler API methods -- 
    267454 
  • trunk/loci/formats/gui/ImageViewer.java

    r2576 r2583  
    203203      Location f = new Location(id); 
    204204      id = f.getAbsolutePath(); 
    205       int num = myReader.getImageCount(id); 
     205      myReader.setId(id);  
     206      int num = myReader.getImageCount(); 
    206207      ProgressMonitor progress = new ProgressMonitor(this, 
    207208        "Reading " + id, null, 0, num + 1); 
    208       sizeZ = myReader.getSizeZ(id); 
    209       sizeT = myReader.getSizeT(id); 
    210       sizeC = myReader.getEffectiveSizeC(id); 
     209      sizeZ = myReader.getSizeZ(); 
     210      sizeT = myReader.getSizeT(); 
     211      sizeC = myReader.getEffectiveSizeC(); 
    211212      //if (myReader.isRGB(id)) sizeC = (sizeC + 2) / 3; // adjust for RGB 
    212213      progress.setProgress(1); 
     
    214215      for (int i=0; i<num; i++) { 
    215216        if (progress.isCanceled()) break; 
    216         img[i] = myReader.openImage(id, i); 
    217         if (i == 0) setImages(id, myReader, img); 
     217        img[i] = myReader.openImage(i); 
     218        if (i == 0) setImages(myReader, img); 
    218219        progress.setProgress(i + 2); 
    219220      } 
     
    258259 
    259260  /** Sets the viewer to display the given images. */ 
    260   public void setImages(String id, IFormatReader reader, BufferedImage[] img) { 
    261     filename = id; 
     261  public void setImages(IFormatReader reader, BufferedImage[] img) { 
     262    filename = reader.getCurrentFile(); 
    262263    in = reader; 
    263264    images = img; 
    264265 
    265266    try { 
    266       sizeZ = reader.getSizeZ(id); 
    267       sizeT = reader.getSizeT(id); 
    268       sizeC = reader.getEffectiveSizeC(id); 
     267      sizeZ = reader.getSizeZ(); 
     268      sizeT = reader.getSizeT(); 
     269      sizeC = reader.getEffectiveSizeC(); 
    269270      //if (reader.isRGB(id)) sizeC = (sizeC + 2) / 3; // adjust for RGB 
    270271    } 
     
    296297    updateLabel(-1, -1); 
    297298    sb.setLength(0); 
    298     if (id != null) { 
     299    if (filename != null) { 
    299300      sb.append(reader.getCurrentFile()); 
    300301      sb.append(" "); 
     
    307308      sb.append(" "); 
    308309    } 
    309     if (id != null || format != null) sb.append("- "); 
     310    if (filename != null || format != null) sb.append("- "); 
    310311    sb.append(TITLE); 
    311312    setTitle(sb.toString()); 
     
    399400      int ndx = getImageIndex(); 
    400401      int[] zct = {-1, -1, -1}; 
    401       try { zct = in.getZCTCoords(filename, ndx); } 
     402      try { zct = in.getZCTCoords(ndx); } 
    402403      catch (Exception exc) { exc.printStackTrace(); } 
    403404      if (zct[0] >= 0) { 
     
    420421      // update N slider 
    421422      int ndx = -1; 
    422       try { ndx = in.getIndex(filename, getZ(), getC(), getT()); } 
     423      try { ndx = in.getIndex(getZ(), getC(), getT()); } 
    423424      catch (Exception exc) { exc.printStackTrace(); } 
    424425      if (ndx >= 0) { 
  • trunk/loci/formats/in/AVIReader.java

    r2557 r2583  
    8484  } 
    8585 
    86   /* @see loci.formats.IFormatReader#getImageCount(String) */  
    87   public int getImageCount(String id) throws FormatException, IOException { 
    88     if (!id.equals(currentId)) initFile(id); 
     86  /* @see loci.formats.IFormatReader#getImageCount() */  
     87  public int getImageCount() throws FormatException, IOException { 
    8988    return numImages; 
    9089  } 
    9190 
    92   /* @see loci.formats.IFormatReader#isRGB(String) */ 
    93   public boolean isRGB(String id) throws FormatException, IOException { 
    94     if (!id.equals(currentId)) initFile(id); 
     91  /* @see loci.formats.IFormatReader#isRGB() */ 
     92  public boolean isRGB() throws FormatException, IOException { 
    9593    return bmpBitsPerPixel > 8; 
    9694  } 
    9795 
    98   /* @see loci.formats.IFormatReader#isLittleEndian(String) */  
    99   public boolean isLittleEndian(String id) throws FormatException, IOException { 
    100     if (!id.equals(currentId)) initFile(id); 
     96  /* @see loci.formats.IFormatReader#isLittleEndian() */  
     97  public boolean isLittleEndian() throws FormatException, IOException { 
    10198    return little; 
    10299  } 
    103100 
    104   /* @see loci.formats.IFormatReader#isInterleaved(String, int) */  
    105   public boolean isInterleaved(String id, int subC) 
     101  /* @see loci.formats.IFormatReader#isInterleaved(int) */  
     102  public boolean isInterleaved(int subC) throws FormatException, IOException { 
     103    return false; 
     104  } 
     105 
     106  /* @see loci.formats.IFormatReader#openBytes(int) */  
     107  public byte[] openBytes(int no) throws FormatException, IOException { 
     108    byte[] buf =  
     109      new byte[core.sizeX[0] * bmpScanLineSize * (bmpBitsPerPixel / 8)]; 
     110    return openBytes(no, buf); 
     111  } 
     112 
     113  /* @see loci.formats.IFormatReader#openBytes(int, byte[]) */ 
     114  public byte[] openBytes(int no, byte[] buf) 
    106115    throws FormatException, IOException 
    107116  { 
    108     return false; 
    109   } 
    110  
    111   /* @see loci.formats.IFormatReader#openBytes(String, int) */  
    112   public byte[] openBytes(String id, int no) 
    113     throws FormatException, IOException 
    114   { 
    115     if (!id.equals(currentId)) initFile(id); 
    116     byte[] buf =  
    117       new byte[core.sizeX[0] * bmpScanLineSize * (bmpBitsPerPixel / 8)]; 
    118     return openBytes(id, no, buf); 
    119   } 
    120  
    121   /* @see loci.formats.IFormatReader#openBytes(String, int, byte[]) */ 
    122   public byte[] openBytes(String id, int no, byte[] buf) 
    123     throws FormatException, IOException 
    124   { 
    125     if (!id.equals(currentId)) initFile(id); 
    126     if (no < 0 || no >= getImageCount(id)) { 
     117    if (no < 0 || no >= getImageCount()) { 
    127118      throw new FormatException("Invalid image number: " + no); 
    128119    } 
     
    152143  } 
    153144 
    154   /* @see loci.formats.IFormatReader#openImage(String, int) */  
    155   public BufferedImage openImage(String id, int no) 
    156     throws FormatException, IOException 
    157   { 
    158     return ImageTools.makeImage(openBytes(id, no), 
     145  /* @see loci.formats.IFormatReader#openImage(int) */  
     146  public BufferedImage openImage(int no) throws FormatException, IOException { 
     147    return ImageTools.makeImage(openBytes(no), 
    159148      core.sizeX[0], core.sizeY[0], core.sizeC[0], true); 
    160149  } 
     
    461450 
    462451    core.sizeZ[0] = 1; 
    463     core.sizeC[0] = isRGB(id) ? 3 : 1; 
     452    core.sizeC[0] = isRGB() ? 3 : 1; 
    464453    core.sizeT[0] = numImages; 
    465454    core.currentOrder[0] = core.sizeC[0] == 3 ? "XYCTZ" : "XYTCZ"; 
     
    476465          "Unknown matching for pixel bit width of: " + bitsPerPixel); 
    477466 
    478     MetadataStore store = getMetadataStore(currentId); 
     467    MetadataStore store = getMetadataStore(); 
    479468    store.setPixels(new Integer(core.sizeX[0]), new Integer(core.sizeY[0]), 
    480469      new Integer(core.sizeZ[0]), // SizeZ 
  • trunk/loci/formats/in/AliconaReader.java

    r2557 r2583  
    5959  } 
    6060  
    61   /* @see loci.formats.IFormatReader#getImageCount(String) */ 
    62   public int getImageCount(String id) throws FormatException, IOException { 
    63     if (!id.equals(currentId)) initFile(id); 
     61  /* @see loci.formats.IFormatReader#getImageCount() */ 
     62  public int getImageCount() throws FormatException, IOException { 
    6463    return numImages; 
    6564  } 
    6665 
    67   /* @see loci.formats.IFormatReader#isRGB(String) */ 
    68   public boolean isRGB(String id) throws FormatException, IOException { 
     66  /* @see loci.formats.IFormatReader#isRGB() */ 
     67  public boolean isRGB() throws FormatException, IOException { 
    6968    return false; 
    7069  } 
    7170 
    72   /* @see loci.formats.IFormatReader#isLittleEndian(String) */  
    73   public boolean isLittleEndian(String id) throws FormatException, IOException { 
     71  /* @see loci.formats.IFormatReader#isLittleEndian() */  
     72  public boolean isLittleEndian() throws FormatException, IOException { 
    7473    return true; 
    7574  } 
    7675 
    77   /* @see loci.formats.IFormatReader#isInterleaved(String, int) */  
    78   public boolean isInterleaved(String id, int subC) 
     76  /* @see loci.formats.IFormatReader#isInterleaved(, int) */  
     77  public boolean isInterleaved(int subC) throws FormatException, IOException { 
     78    return false; 
     79  } 
     80 
     81  /* @see loci.formats.IFormatReader#openBytes(int) */  
     82  public byte[] openBytes(int no) throws FormatException, IOException { 
     83    byte[] buf = new byte[core.sizeX[0] * core.sizeY[0] * numBytes]; 
     84    return openBytes(no, buf); 
     85  } 
     86 
     87  /* @see loci.formats.IFormatReader#openBytes(int, byte[]) */ 
     88  public byte[] openBytes(int no, byte[] buf)  
    7989    throws FormatException, IOException 
    8090  { 
    81     return false; 
    82   } 
    83  
    84   /* @see loci.formats.IFormatReader#openBytes(String, int) */  
    85   public byte[] openBytes(String id, int no) 
    86     throws FormatException, IOException 
    87   { 
    88     if (!id.equals(currentId)) initFile(id); 
    89     byte[] buf = new byte[core.sizeX[0] * core.sizeY[0] * numBytes]; 
    90     return openBytes(id, no, buf); 
    91   } 
    92  
    93   /* @see loci.formats.IFormatReader#openBytes(String, int, byte[]) */ 
    94   public byte[] openBytes(String id, int no, byte[] buf) 
    95     throws FormatException, IOException 
    96   { 
    97     if (!id.equals(currentId)) initFile(id); 
    98     if (no < 0 || no >= getImageCount(id)) { 
     91    if (no < 0 || no >= getImageCount()) { 
    9992      throw new FormatException("Invalid image number: " + no); 
    10093    } 
     
    117110  } 
    118111 
    119   /* @see loci.formats.IFormatReader#openImage(String, int) */  
    120   public BufferedImage openImage(String id, int no) 
    121     throws FormatException, IOException 
    122   { 
    123     return ImageTools.makeImage(openBytes(id, no), core.sizeX[0], core.sizeY[0], 
     112  /* @see loci.formats.IFormatReader#openImage(int) */  
     113  public BufferedImage openImage(int no) throws FormatException, IOException { 
     114    return ImageTools.makeImage(openBytes( no), core.sizeX[0], core.sizeY[0], 
    124115      1, false, numBytes, true); 
    125116  } 
     
    201192    core.currentOrder[0] = "XYCTZ"; 
    202193 
    203     MetadataStore store = getMetadataStore(id); 
     194    MetadataStore store = getMetadataStore(); 
    204195    store.setPixels( 
    205196      new Integer(core.sizeX[0]), 
  • trunk/loci/formats/in/BMPReader.java

    r2563 r2583  
    8080  } 
    8181 
    82   /* @see loci.formats.IFormatReader#getImageCount(String) */  
    83   public int getImageCount(String id) throws FormatException, IOException { 
     82  /* @see loci.formats.IFormatReader#getImageCount() */  
     83  public int getImageCount() throws FormatException, IOException { 
    8484    return 1; 
    8585  } 
    8686 
    87   /* @see loci.formats.IFormatReader#isRGB(String) */ 
    88   public boolean isRGB(String id) throws FormatException, IOException { 
    89     if (!id.equals(currentId)) initFile(id); 
     87  /* @see loci.formats.IFormatReader#isRGB() */ 
     88  public boolean isRGB() throws FormatException, IOException { 
    9089    return bpp > 8; 
    9190  } 
    9291 
    93   /* @see loci.formats.IFormatReader#isLittleEndian(String) */  
    94   public boolean isLittleEndian(String id) throws FormatException, IOException { 
     92  /* @see loci.formats.IFormatReader#isLittleEndian() */  
     93  public boolean isLittleEndian() throws FormatException, IOException { 
    9594    return true; 
    9695  } 
    9796 
    98   /* @see loci.formats.IFormatReader#isInterleaved(String, int) */  
    99   public boolean isInterleaved(String id, int subC) 
     97  /* @see loci.formats.IFormatReader#isInterleaved(int) */  
     98  public boolean isInterleaved(int subC) 
    10099    throws FormatException, IOException 
    101100  { 
     
    103102  } 
    104103 
    105   /* @see loci.formats.IFormatReader#openBytes(String, int, byte[]) */ 
    106   public byte[] openBytes(String id, int no, byte[] buf) 
     104  /* @see loci.formats.IFormatReader#openBytes(int, byte[]) */ 
     105  public byte[] openBytes(int no, byte[] buf) 
    107106    throws FormatException, IOException 
    108107  { 
    109     if (!id.equals(currentId)) initFile(id); 
    110     if (no < 0 || no >= getImageCount(id)) { 
     108    if (no < 0 || no >= getImageCount()) { 
    111109      throw new FormatException("Invalid image number: " + no); 
    112110    } 
     
    158156  } 
    159157 
    160   /* @see loci.formats.IFormatReader#openBytes(String, int) */  
    161   public byte[] openBytes(String id, int no) 
    162     throws FormatException, IOException 
    163   { 
    164     if (!id.equals(currentId)) initFile(id); 
     158  /* @see loci.formats.IFormatReader#openBytes(int) */  
     159  public byte[] openBytes(int no) throws FormatException, IOException { 
    165160    byte[] buf = new byte[core.sizeX[0] * core.sizeY[0] * (bpp / 8)]; 
    166     return openBytes(id, no, buf); 
    167   } 
    168  
    169   /* @see loci.formats.IFormatReader#openImage(String, int) */  
    170   public BufferedImage openImage(String id, int no) 
    171     throws FormatException, IOException 
    172   { 
    173     return ImageTools.makeImage(openBytes(id, no), core.sizeX[0], core.sizeY[0],  
     161    return openBytes(no, buf); 
     162  } 
     163 
     164  /* @see loci.formats.IFormatReader#openImage(int) */  
     165  public BufferedImage openImage(int no) throws FormatException, IOException { 
     166    return ImageTools.makeImage(openBytes(no), core.sizeX[0], core.sizeY[0],  
    174167      core.sizeC[0], false); 
    175168  } 
     
    292285    if (core.sizeX[0] % 2 == 1) core.sizeX[0]++;  
    293286    core.sizeZ[0] = 1; 
    294     core.sizeC[0] = isRGB(id) ? 3 : 1; 
     287    core.sizeC[0] = isRGB() ? 3 : 1; 
    295288    core.sizeT[0] = 1; 
    296289    core.currentOrder[0] = "XYCTZ"; 
     
    299292 
    300293    // The metadata store we're working with. 
    301     MetadataStore store = getMetadataStore(id); 
     294    MetadataStore store = getMetadataStore(); 
    302295 
    303296    store.setPixels( 
  • trunk/loci/formats/in/BaseTiffReader.java

    r2563 r2583  
    6666 
    6767  /** Gets the dimensions of the given (possibly multi-page) TIFF file. */ 
    68   public int[] getTiffDimensions(String id) 
    69     throws FormatException, IOException 
    70   { 
    71     if (!id.equals(currentId)) initFile(id); 
     68  public int[] getTiffDimensions() throws FormatException, IOException { 
    7269    if (ifds == null || ifds.length == 0) return null; 
    7370    return new int[] { 
     
    455452 
    456453    try { 
    457       core.sizeC[0] = isRGB(currentId) ? 3 : 1; 
     454      core.sizeC[0] = isRGB() ? 3 : 1; 
    458455    } 
    459456    catch (IOException e) { 
     
    517514    try { 
    518515      // the metadata store we're working with 
    519       MetadataStore store = getMetadataStore(currentId); 
     516      MetadataStore store = getMetadataStore(); 
    520517 
    521518      // set the pixel values in the metadata store 
    522       store.setPixels(new Integer(getSizeX(currentId)), 
    523         new Integer(getSizeY(currentId)), new Integer(getSizeZ(currentId)), 
    524         new Integer(getSizeC(currentId)), new Integer(getSizeT(currentId)), 
    525         new Integer(getPixelType(currentId)), 
    526         new Boolean(!isLittleEndian(currentId)), 
    527         getDimensionOrder(currentId), null, null); 
     519      store.setPixels(new Integer(getSizeX()), 
     520        new Integer(getSizeY()), new Integer(getSizeZ()), 
     521        new Integer(getSizeC()), new Integer(getSizeT()), 
     522        new Integer(getPixelType()), 
     523        new Boolean(!isLittleEndian()), 
     524        getDimensionOrder(), null, null); 
    528525 
    529526      // populate Experimenter element 
     
    563560 
    564561      // populate Logical Channel elements 
    565       for (int i=0; i<getSizeC(currentId); i++) { 
     562      for (int i=0; i<getSizeC(); i++) { 
    566563        try { 
    567564          setLogicalChannel(i); 
     
    666663    if (bitsPerSample == 8 || bitsPerSample == 32) return byteArray; 
    667664 
    668     if (isLittleEndian(currentId)) { 
     665    if (isLittleEndian()) { 
    669666      if (bitsPerSample == 16) { // short 
    670667        ShortBuffer buf = ByteBuffer.wrap(byteArray).asShortBuffer(); 
     
    689686  } 
    690687 
    691   /* @see loci.formats.IFormatReader#getImageCount(String) */  
    692   public int getImageCount(String id) throws FormatException, IOException { 
    693     if (!id.equals(currentId)) initFile(id); 
     688  /* @see loci.formats.IFormatReader#getImageCount() */  
     689  public int getImageCount() throws FormatException, IOException { 
    694690    return numImages; 
    695691  } 
    696692 
    697   /* @see loci.formats.IFormatReader#isRGB(String) */ 
    698   public boolean isRGB(String id) throws FormatException, IOException { 
    699     if (!id.equals(currentId)) initFile(id); 
     693  /* @see loci.formats.IFormatReader#isRGB() */ 
     694  public boolean isRGB() throws FormatException, IOException { 
    700695    if (TiffTools.getIFDIntValue(ifds[0], 
    701696      TiffTools.SAMPLES_PER_PIXEL, false, 1) > 1) 
     
    709704  } 
    710705 
    711   /* @see loci.formats.IFormatReader#getMetadataValue(String, String) */  
    712   public Object getMetadataValue(String id, String field) 
     706  /* @see loci.formats.IFormatReader#getMetadataValue(String) */  
     707  public Object getMetadataValue(String field) 
    713708    throws FormatException, IOException 
    714709  { 
    715     if (!id.equals(currentId) && !DataTools.samePrefix(id, currentId)) { 
    716       initFile(id); 
    717     } 
    718710    return getMeta(field); 
    719711  } 
    720712 
    721   /* @see loci.formats.IFormatReader#isLittleEndian(String) */  
    722   public boolean isLittleEndian(String id) throws FormatException, IOException { 
    723     if (!id.equals(currentId)) initFile(id); 
     713  /* @see loci.formats.IFormatReader#isLittleEndian() */  
     714  public boolean isLittleEndian() throws FormatException, IOException { 
    724715    return TiffTools.isLittleEndian(ifds[0]); 
    725716  } 
    726717 
    727   /* @see loci.formats.IFormatReader#isInterleaved(String, int) */  
    728   public boolean isInterleaved(String id, int subC) 
     718  /* @see loci.formats.IFormatReader#isInterleaved(int) */  
     719  public boolean isInterleaved(int subC) throws FormatException, IOException { 
     720    return TiffTools.getSamplesPerPixel(ifds[0]) > 1;  
     721  } 
     722 
     723  /* @see loci.formats.FormatReader#openBytes(int, byte[]) */ 
     724  public byte[] openBytes(int no, byte[] buf)  
    729725    throws FormatException, IOException 
    730726  { 
    731     if (!id.equals(currentId)) initFile(id); 
    732     return TiffTools.getSamplesPerPixel(ifds[0]) > 1;  
    733   } 
    734  
    735   /* @see loci.formats.FormatReader#openBytes(String, int, byte[]) */ 
    736   public byte[] openBytes(String id, int no, byte[] buf) 
    737     throws FormatException, IOException 
    738   { 
    739     if (!id.equals(currentId)) initFile(id); 
    740  
    741     if (no < 0 || no >= getImageCount(id)) { 
     727    if (no < 0 || no >= getImageCount()) { 
    742728      throw new FormatException("Invalid image number: " + no); 
    743729    } 
     
    747733  } 
    748734 
    749   /* @see loci.formats.FormatReader#openBytes(String, int) */ 
    750   public byte[] openBytes(String id, int no) 
    751     throws FormatException, IOException 
    752   { 
    753     if (!id.equals(currentId)) initFile(id); 
    754  
    755     if (no < 0 || no >= getImageCount(id)) { 
     735  /* @see loci.formats.FormatReader#openBytes(int) */ 
     736  public byte[] openBytes(int no) throws FormatException, IOException { 
     737    if (no < 0 || no >= getImageCount()) { 
    756738      throw new FormatException("Invalid image number: " + no); 
    757739    } 
    758740 
    759     int bytesPerPixel = FormatTools.getBytesPerPixel(getPixelType(id)); 
    760     byte[] buf = new byte[getSizeX(id) * getSizeY(id) * bytesPerPixel * 
    761       getRGBChannelCount(id)]; 
    762     return openBytes(id, no, buf); 
    763   } 
    764  
    765   /* @see loci.formats.IFormatReader#openImage(String, int) */  
    766   public BufferedImage openImage(String id, int no) 
    767     throws FormatException, IOException 
    768   { 
    769     if (!id.equals(currentId) && !DataTools.samePrefix(id, currentId)) { 
    770       initFile(id); 
    771     } 
    772  
    773     if (no < 0 || no >= getImageCount(id)) { 
     741    int bytesPerPixel = FormatTools.getBytesPerPixel(getPixelType()); 
     742    byte[] buf = new byte[getSizeX() * getSizeY() * bytesPerPixel * 
     743      getRGBChannelCount()]; 
     744    return openBytes(no, buf); 
     745  } 
     746 
     747  /* @see loci.formats.IFormatReader#openImage(int) */  
     748  public BufferedImage openImage(int no) throws FormatException, IOException { 
     749    if (no < 0 || no >= getImageCount()) { 
    774750      throw new FormatException("Invalid image number: " + no); 
    775751    } 
     
    818794   */ 
    819795  private void setLogicalChannel(int i) throws FormatException, IOException { 
    820     getMetadataStore(currentId).setLogicalChannel( 
     796    getMetadataStore().setLogicalChannel( 
    821797      i, 
    822798      getChannelName(i), 
     
    840816    throws FormatException, IOException 
    841817  { 
    842     return (String) getMetadataValue(currentId, 
    843       "metaDataPhotometricInterpretation"); 
     818    return (String) getMetadataValue("metaDataPhotometricInterpretation"); 
    844819  } 
    845820 
  • trunk/loci/formats/in/BioRadReader.java

    r2557 r2583  
    8787  } 
    8888 
    89   /* @see loci.formats.IFormatReader#getImageCount(String) */  
    90   public int getImageCount(String id) throws FormatException, IOException { 
    91     if (!id.equals(currentId)) initFile(id); 
     89  /* @see loci.formats.IFormatReader#getImageCount() */  
     90  public int getImageCount() throws FormatException, IOException { 
    9291    return npic; 
    9392  } 
    9493 
    95   /* @see loci.formats.IFormatReader#isRGB(String) */ 
    96   public boolean isRGB(String id) throws FormatException, IOException { 
     94  /* @see loci.formats.IFormatReader#isRGB() */ 
     95  public boolean isRGB() throws FormatException, IOException { 
    9796    return false; 
    9897  } 
    9998 
    100   /* @see loci.formats.IFormatReader#isLittleEndian(String) */  
    101   public boolean isLittleEndian(String id) throws FormatException, IOException { 
     99  /* @see loci.formats.IFormatReader#isLittleEndian() */  
     100  public boolean isLittleEndian() throws FormatException, IOException { 
    102101    return LITTLE_ENDIAN; 
    103102  } 
    104103 
    105   /* @see loci.formats.IFormatReader#isInterleaved(String, int) */  
    106   public boolean isInterleaved(String id, int subC) 
     104  /* @see loci.formats.IFormatReader#isInterleaved(int) */  
     105  public boolean isInterleaved(int subC) throws FormatException, IOException { 
     106    return false; 
     107  } 
     108 
     109  /* @see loci.formats.IFormatReader#openBytes(int) */  
     110  public byte[] openBytes(int no) throws FormatException, IOException { 
     111    byte[] buf = new byte[core.sizeX[0] * core.sizeY[0] * (byteFormat ? 1 : 2)]; 
     112    return openBytes(no, buf); 
     113  } 
     114 
     115  /* @see loci.formats.IFormatReader#openBytes(int, byte[]) */ 
     116  public byte[] openBytes(int no, byte[] buf)  
    107117    throws FormatException, IOException 
    108118  { 
    109     return false; 
    110   } 
    111  
    112   /* @see loci.formats.IFormatReader#openBytes(String, int) */  
    113   public byte[] openBytes(String id, int no) 
    114     throws FormatException, IOException 
    115   { 
    116     if (!id.equals(currentId)) initFile(id); 
    117     byte[] buf = new byte[core.sizeX[0] * core.sizeY[0] * (byteFormat ? 1 : 2)]; 
    118     return openBytes(id, no, buf); 
    119   } 
    120  
    121   /* @see loci.formats.IFormatReader#openBytes(String, int, byte[]) */ 
    122   public byte[] openBytes(String id, int no, byte[] buf) 
    123     throws FormatException, IOException 
    124   { 
    125     if (!id.equals(currentId)) initFile(id); 
    126119    if (no < 0 || no >= npic) { 
    127120      throw new FormatException("Invalid image number: " + no); 
     
    137130  } 
    138131 
    139   /* @see loci.formats.IFormatReader#openImage(String, int) */  
    140   public BufferedImage openImage(String id, int no) 
    141     throws FormatException, IOException 
    142   { 
    143     BufferedImage b = ImageTools.makeImage(openBytes(id, no), core.sizeX[0],  
     132  /* @see loci.formats.IFormatReader#openImage(int) */  
     133  public BufferedImage openImage(int no) throws FormatException, IOException { 
     134    BufferedImage b = ImageTools.makeImage(openBytes(no), core.sizeX[0],  
    144135      core.sizeY[0], 1, false, byteFormat ? 1 : 2, LITTLE_ENDIAN); 
    145136    return b; 
     
    616607 
    617608    // The metadata store we're working with. 
    618     MetadataStore store = getMetadataStore(id); 
     609    MetadataStore store = getMetadataStore(); 
    619610 
    620611    // populate Image element 
  • trunk/loci/formats/in/DeltavisionReader.java

    r2557 r2583  
    9696  } 
    9797 
    98   /* @see loci.formats.IFormatReader#getImageCount(String) */  
    99   public int getImageCount(String id) throws FormatException, IOException { 
    100     if (!id.equals(currentId)) initFile(id); 
     98  /* @see loci.formats.IFormatReader#getImageCount() */  
     99  public int getImageCount() throws FormatException, IOException { 
    101100    return numImages; 
    102101  } 
    103102 
    104   /* @see loci.formats.IFormatReader#isRGB(String) */ 
    105   public boolean isRGB(String id) throws FormatException, IOException { 
     103  /* @see loci.formats.IFormatReader#isRGB() */ 
     104  public boolean isRGB() throws FormatException, IOException { 
    106105    return false; 
    107106  } 
    108107 
    109   /* @see loci.formats.IFormatReader#isLittleEndian(String) */  
    110   public boolean isLittleEndian(String id) throws FormatException, IOException { 
    111     if (!id.equals(currentId)) initFile(id); 
     108  /* @see loci.formats.IFormatReader#isLittleEndian() */  
     109  public boolean isLittleEndian() throws FormatException, IOException { 
    112110    return little; 
    113111  } 
    114112 
    115   /* @see loci.formats.IFormatReader#isInterleaved(String, int) */  
    116   public boolean isInterleaved(String id, int subC) 
     113  /* @see loci.formats.IFormatReader#isInterleaved(int) */  
     114  public boolean isInterleaved(int subC) throws FormatException, IOException { 
     115    return false; 
     116  } 
     117 
     118  /* @see loci.formats.IFormatReader#openBytes(int) */  
     119  public byte[] openBytes(int no) 
    117120    throws FormatException, IOException 
    118121  { 
    119     return false; 
    120   } 
    121  
    122   /* @see loci.formats.IFormatReader#openBytes(String, int) */  
    123   public byte[] openBytes(String id, int no) 
     122    byte[] buf = new byte[core.sizeX[0] * core.sizeY[0] * bytesPerPixel]; 
     123    return openBytes(no, buf); 
     124  } 
     125 
     126  /* @see loci.formats.IFormatReader#openBytes(int, byte[]) */ 
     127  public byte[] openBytes(int no, byte[] buf) 
    124128    throws FormatException, IOException 
    125129  { 
    126     if (!id.equals(currentId)) initFile(id); 
    127     byte[] buf = new byte[core.sizeX[0] * core.sizeY[0] * bytesPerPixel]; 
    128     return openBytes(id, no, buf); 
    129   } 
    130  
    131   /* @see loci.formats.IFormatReader#openBytes(String, int, byte[]) */ 
    132   public byte[] openBytes(String id, int no, byte[] buf) 
    133     throws FormatException, IOException 
    134   { 
    135     if (!id.equals(currentId)) initFile(id); 
    136  
    137130    if (no < 0 || no >= numImages) { 
    138131      throw new FormatException("Invalid image number: " + no); 
     
    148141  } 
    149142 
    150   /* @see loci.formats.IFormatReader#openImage(String, int) */  
    151   public BufferedImage openImage(String id, int no) 
     143  /* @see loci.formats.IFormatReader#openImage(int) */  
     144  public BufferedImage openImage(int no) 
    152145    throws FormatException, IOException 
    153146  { 
    154     return ImageTools.makeImage(openBytes(id, no), core.sizeX[0],  
     147    return ImageTools.makeImage(openBytes(no), core.sizeX[0],  
    155148      core.sizeY[0], 1, false, bytesPerPixel, little); 
    156149  } 
     
    393386 
    394387    // The metadata store we're working with. 
    395     MetadataStore store = getMetadataStore(id); 
     388    MetadataStore store = getMetadataStore(); 
    396389 
    397390    String title; 
  • trunk/loci/formats/in/DicomReader.java

    r2557 r2583  
    112112  } 
    113113 
    114   /* @see loci.formats.IFormatReader#getImageCount(String) */  
    115   public int getImageCount(String id) throws FormatException, IOException { 
    116     if (!id.equals(currentId)) initFile(id); 
     114  /* @see loci.formats.IFormatReader#getImageCount() */  
     115  public int getImageCount() throws FormatException, IOException { 
    117116    return numImages; 
    118117  } 
    119118 
    120   /* @see loci.formats.IFormatReader#isRGB(String) */  
    121   public boolean isRGB(String id) throws FormatException, IOException { 
     119  /* @see loci.formats.IFormatReader#isRGB() */  
     120  public boolean isRGB() throws FormatException, IOException { 
    122121    return false; 
    123122  } 
    124123 
    125   /* @see loci.formats.IFormatReader#isLittleEndian(String) */  
    126   public boolean isLittleEndian(String id) throws FormatException, IOException { 
    127     if (!id.equals(currentId)) initFile(id); 
     124  /* @see loci.formats.IFormatReader#isLittleEndian() */  
     125  public boolean isLittleEndian() throws FormatException, IOException { 
    128126    return little; 
    129127  } 
    130128 
    131   /* @see loci.formats.IFormatReader#isInterleaved(String, int) */  
    132   public boolean isInterleaved(String id, int subC) 
     129  /* @see loci.formats.IFormatReader#isInterleaved(int) */  
     130  public boolean isInterleaved(int subC) throws FormatException, IOException { 
     131    return false; 
     132  } 
     133 
     134  /* @see loci.formats.IFormatReader#openBytes(int) */  
     135  public byte[] openBytes(int no) throws FormatException, IOException { 
     136    byte[] buf = new byte[core.sizeX[0] * core.sizeY[0] * (bitsPerPixel / 8)]; 
     137    return openBytes(no, buf); 
     138  } 
     139 
     140  /* @see loci.formats.IFormatReader#openBytes(int, byte[]) */ 
     141  public byte[] openBytes(int no, byte[] buf) 
    133142    throws FormatException, IOException 
    134143  { 
    135     return false; 
    136   } 
    137  
    138   /* @see loci.formats.IFormatReader#openBytes(String, int) */  
    139   public byte[] openBytes(String id, int no) 
    140     throws FormatException, IOException 
    141   { 
    142     if (!id.equals(currentId)) initFile(id); 
    143     byte[] buf = new byte[core.sizeX[0] * core.sizeY[0] * (bitsPerPixel / 8)]; 
    144     return openBytes(id, no, buf); 
    145   } 
    146  
    147   /* @see loci.formats.IFormatReader#openBytes(String, int, byte[]) */ 
    148   public byte[] openBytes(String id, int no, byte[] buf) 
    149     throws FormatException, IOException 
    150   { 
    151     if (!id.equals(currentId)) initFile(id); 
    152     if (no < 0 || no >= getImageCount(id)) { 
     144    if (no < 0 || no >= getImageCount()) { 
    153145      throw new FormatException("Invalid image number: " + no); 
    154146    } 
     
    165157  } 
    166158 
    167   /* @see loci.formats.IFormatReader#openImage(String, int) */  
    168   public BufferedImage openImage(String id, int no) 
    169     throws FormatException, IOException 
    170   { 
    171     return ImageTools.makeImage(openBytes(id, no), core.sizeX[0], core.sizeY[0], 
     159  /* @see loci.formats.IFormatReader#openImage(int) */  
     160  public BufferedImage openImage(int no) throws FormatException, IOException { 
     161    return ImageTools.makeImage(openBytes(no), core.sizeX[0], core.sizeY[0], 
    172162      1, false, bitsPerPixel / 8, little); 
    173163  } 
     
    336326 
    337327    // The metadata store we're working with. 
    338     MetadataStore store = getMetadataStore(id); 
     328    MetadataStore store = getMetadataStore(); 
    339329 
    340330    while (bitsPerPixel % 8 != 0) bitsPerPixel++; 
  • trunk/loci/formats/in/EPSReader.java

    r2557 r2583  
    6666  } 
    6767 
    68   /* @see loci.formats.IFormatReader#getImageCount(String) */  
    69   public int getImageCount(String id) throws FormatException, IOException { 
     68  /* @see loci.formats.IFormatReader#getImageCount() */  
     69  public int getImageCount() throws FormatException, IOException { 
    7070    return 1; 
    7171  } 
    7272 
    73   /* @see loci.formats.IFormatReader#isRGB(String) */  
    74   public boolean isRGB(String id) throws FormatException, IOException { 
    75     if (!id.equals(currentId)) initFile(id); 
     73  /* @see loci.formats.IFormatReader#isRGB() */  
     74  public boolean isRGB() throws FormatException, IOException { 
    7675    return core.sizeC[0] == 3; 
    7776  } 
    7877 
    79   /* @see loci.formats.IFormatReader#isLittleEndian(String) */  
    80   public boolean isLittleEndian(String id) throws FormatException, IOException { 
     78  /* @see loci.formats.IFormatReader#isLittleEndian() */  
     79  public boolean isLittleEndian() throws FormatException, IOException { 
    8180    return true; 
    8281  } 
    8382 
    84   /* @see loci.formats.IFormatReader#isInterleaved(String, int) */  
    85   public boolean isInterleaved(String id, int subC) 
     83  /* @see loci.formats.IFormatReader#isInterleaved(int) */  
     84  public boolean isInterleaved(int subC) throws FormatException, IOException { 
     85    return true; 
     86  } 
     87 
     88  /* @see loci.formats.IFormatRaeder#openBytes(int) */  
     89  public byte[] openBytes(int no) throws FormatException, IOException { 
     90    byte[] buf =  
     91      new byte[core.sizeX[0] * core.sizeY[0] * core.sizeC[0] * (bps / 8)]; 
     92    return openBytes(no, buf); 
     93  } 
     94 
     95  /* @see loci.formats.IFormatReader#openBytes(int, byte[]) */ 
     96  public byte[] openBytes(int no, byte[] buf) 
    8697    throws FormatException, IOException 
    8798  { 
    88     return true; 
    89   } 
    90  
    91   /* @see loci.formats.IFormatRaeder#openBytes(String, int) */  
    92   public byte[] openBytes(String id, int no) 
    93     throws FormatException, IOException 
    94   { 
    95     if (!id.equals(currentId)) initFile(id); 
    96     byte[] buf =  
    97       new byte[core.sizeX[0] * core.sizeY[0] * core.sizeC[0] * (bps / 8)]; 
    98     return openBytes(id, no, buf); 
    99   } 
    100  
    101   /* @see loci.formats.IFormatReader#openBytes(String, int, byte[]) */ 
    102   public byte[] openBytes(String id, int no, byte[] buf) 
    103     throws FormatException, IOException 
    104   { 
    105     if (!id.equals(currentId)) initFile(id); 
    106     if (no < 0 || no >= getImageCount(id)) { 
     99    if (no < 0 || no >= getImageCount()) { 
    107100      throw new FormatException("Invalid image number: " + no); 
    108101    } 
    109     if (buf.length < core.sizeX[0] * core.sizeY[0] * core.sizeC[0] * (bps / 8)) { 
     102    if (buf.length < core.sizeX[0]*core.sizeY[0] * core.sizeC[0] * (bps / 8)) { 
    110103      throw new FormatException("Buffer too small."); 
    111104    } 
    112105 
    113     RandomAccessStream ras = new RandomAccessStream(id); 
     106    RandomAccessStream ras = new RandomAccessStream(currentId); 
    114107    int line = 0; 
    115108 
     
    143136  } 
    144137 
    145   /* @see loci.formats.IFormatReader#openImage(String, int) */  
    146   public BufferedImage openImage(String id, int no) 
    147     throws FormatException, IOException 
    148   { 
    149     return ImageTools.makeImage(openBytes(id, no), core.sizeX[0], core.sizeY[0],  
    150       isRGB(id) ? 3 : 1, true); 
     138  /* @see loci.formats.IFormatReader#openImage(int) */  
     139  public BufferedImage openImage(int no) throws FormatException, IOException { 
     140    return ImageTools.makeImage(openBytes(no), core.sizeX[0], core.sizeY[0], 
     141      isRGB() ? 3 : 1, true); 
    151142  } 
    152143 
     
    262253 
    263254    // The metadata store we're working with. 
    264     MetadataStore store = getMetadataStore(id); 
     255    MetadataStore store = getMetadataStore(); 
    265256 
    266257    store.setPixels( 
  • trunk/loci/formats/in/FluoviewReader.java

    r2557 r2583  
    133133 
    134134    RandomAccessStream ras = new RandomAccessStream(mmheader); 
    135     ras.order(isLittleEndian(currentId)); 
     135    ras.order(isLittleEndian()); 
    136136 
    137137    put("Header Flag", ras.readShort()); 
     
    236236      else if (name.equals("z") || name.equals("event")) { 
    237237        core.sizeZ[0] *= size.intValue(); 
    238         if (core.currentOrder[0].indexOf("Z") == -1) core.currentOrder[0] += "Z"; 
     238        if (core.currentOrder[0].indexOf("Z") == -1) { 
     239          core.currentOrder[0] += "Z"; 
     240        }  
    239241        if (voxel != null) voxelZ = voxel.floatValue(); 
    240242      } 
    241243      else if (name.equals("ch") || name.equals("wavelength")) { 
    242244        core.sizeC[0] *= size.intValue(); 
    243         if (core.currentOrder[0].indexOf("C") == -1) core.currentOrder[0] += "C"; 
     245        if (core.currentOrder[0].indexOf("C") == -1) { 
     246          core.currentOrder[0] += "C"; 
     247        }  
    244248        if (voxel != null) voxelC = voxel.floatValue(); 
    245249      } 
    246250      else { 
    247251        core.sizeT[0] *= size.intValue(); 
    248         if (core.currentOrder[0].indexOf("T") == -1) core.currentOrder[0] += "T"; 
     252        if (core.currentOrder[0].indexOf("T") == -1) { 
     253          core.currentOrder[0] += "T"; 
     254        }  
    249255        if (voxel != null) voxelT = voxel.floatValue(); 
    250256      } 
     
    298304    super.initMetadataStore(); 
    299305    try { 
    300       MetadataStore store = getMetadataStore(currentId); 
     306      MetadataStore store = getMetadataStore(); 
    301307      store.setDimensions(new Float(voxelX), new Float(voxelY), 
    302308        new Float(voxelZ), new Float(voxelC), new Float(voxelT), null); 
  • trunk/loci/formats/in/GIFReader.java

    r2563 r2583  
    141141  public boolean isThisType(byte[] block) { return false; } 
    142142 
    143   /* @see loci.formats.IFormatReader#getImageCount(String) */  
    144   public int getImageCount(String id) throws FormatException, IOException { 
    145     if (!id.equals(currentId)) initFile(id); 
     143  /* @see loci.formats.IFormatReader#getImageCount() */  
     144  public int getImageCount() throws FormatException, IOException { 
    146145    return numFrames; 
    147146  } 
    148147 
    149   /* @see loci.formats.IFormatReader#isRGB(String) */  
    150   public boolean isRGB(String id) throws FormatException, IOException { 
    151     if (!id.equals(currentId)) initFile(id);  
     148  /* @see loci.formats.IFormatReader#isRGB() */  
     149  public boolean isRGB() throws FormatException, IOException { 
    152150    return true; 
    153151  } 
    154152 
    155   /* @see loci.formats.IFormatReader#isLittleEndian(String) */  
    156   public boolean isLittleEndian(String id) throws FormatException, IOException { 
     153  /* @see loci.formats.IFormatReader#isLittleEndian() */  
     154  public boolean isLittleEndian() throws FormatException, IOException { 
    157155    return true; 
    158156  } 
    159157 
    160   /* @see loci.formats.IFormatReader#isInterleaved(String, int) */  
    161   public boolean isInterleaved(String id, int subC) 
     158  /* @see loci.formats.IFormatReader#isInterleaved(int) */  
     159  public boolean isInterleaved(int subC) throws FormatException, IOException { 
     160    return true; 
     161  } 
     162 
     163  /* @see loci.formats.IFormatReader#openBytes(int) */  
     164  public byte[] openBytes(int no) throws FormatException, IOException { 
     165    byte[] buf = new byte[core.sizeX[0] * core.sizeY[0] * core.sizeC[0]]; 
     166    return openBytes(no, buf); 
     167  } 
     168 
     169  /* @see loci.formats.IFormatReader#openBytes(int, byte[]) */ 
     170  public byte[] openBytes(int no, byte[] buf) 
    162171    throws FormatException, IOException 
    163172  { 
    164     return true; 
    165   } 
    166  
    167   /* @see loci.formats.IFormatReader#openBytes(String, int) */  
    168   public byte[] openBytes(String id, int no) throws FormatException, IOException 
    169   { 
    170     if (!id.equals(currentId)) initFile(id); 
    171     byte[] buf = new byte[core.sizeX[0] * core.sizeY[0] * core.sizeC[0]]; 
    172     return openBytes(id, no, buf); 
    173   } 
    174  
    175   /* @see loci.formats.IFormatReader#openBytes(String, int, byte[]) */ 
    176   public byte[] openBytes(String id, int no, byte[] buf) 
    177     throws FormatException, IOException 
    178   { 
    179     if (!id.equals(currentId)) initFile(id); 
    180     if (no < 0 || no >= getImageCount(id)) { 
     173    if (no < 0 || no >= getImageCount()) { 
    181174      throw new FormatException("Invalid image number: " + no); 
    182175    } 
     
    195188  } 
    196189 
    197   /* @see loci.formats.IFormatReader#openImage(String, int) */  
    198   public BufferedImage openImage(String id, int no) 
     190  /* @see loci.formats.IFormatReader#openImage(int) */  
     191  public BufferedImage openImage(int no) 
    199192    throws FormatException, IOException 
    200193  { 
    201     byte[] bytes = openBytes(id, no); 
     194    byte[] bytes = openBytes(no); 
    202195    return ImageTools.makeImage(bytes, core.sizeX[0], core.sizeY[0], 
    203196      bytes.length / (core.sizeX[0] * core.sizeY[0]), false, 1, true); 
     
    397390    // populate metadata store 
    398391 
    399     MetadataStore store = getMetadataStore(id); 
     392    MetadataStore store = getMetadataStore(); 
    400393 
    401394    core.pixelType[0] = FormatTools.UINT8; 
  • trunk/loci/formats/in/GatanReader.java

    r2557 r2583  
    7676  } 
    7777 
    78   /* @see loci.formats.IFormatReader#getImageCount(String) */  
    79   public int getImageCount(String id) throws FormatException, IOException { 
    80     // every Gatan file has only one image 
     78  /* @see loci.formats.IFormatReader#getImageCount() */  
     79  public int getImageCount() throws FormatException, IOException { 
    8180    return 1; 
    8281  } 
    8382 
    84   /* @see loci.formats.IFormatReader#isRGB(String) */  
    85   public boolean isRGB(String id) throws FormatException, IOException { 
     83  /* @see loci.formats.IFormatReader#isRGB() */  
     84  public boolean isRGB() throws FormatException, IOException { 
    8685    return false; 
    8786  } 
    8887 
    89   /* @see loci.formats.IFormatReader#isLittleEndian(String) */   
    90   public boolean isLittleEndian(String id) throws FormatException, IOException { 
    91     if (!id.equals(currentId)) initFile(id); 
     88  /* @see loci.formats.IFormatReader#isLittleEndian() */   
     89  public boolean isLittleEndian() throws FormatException, IOException { 
    9290    return littleEndian; 
    9391  } 
    9492 
    95   /* @see loci.formats.IFormatReader#isInterleaved(String, int) */ 
    96   public boolean isInterleaved(String id, int subC) 
     93  /* @see loci.formats.IFormatReader#isInterleaved(int) */ 
     94  public boolean isInterleaved(int subC) throws FormatException, IOException { 
     95    return false; 
     96  } 
     97 
     98  /* @see loci.formats.IFormatReader#openBytes(int) */  
     99  public byte[] openBytes(int no) throws FormatException, IOException { 
     100    byte[] buf = new byte[core.sizeX[0] * core.sizeY[0] * bytesPerPixel]; 
     101    return openBytes(no, buf); 
     102  } 
     103 
     104  /* @see loci.formats.IFormatReader#openBytes(int, byte[]) */ 
     105  public byte[] openBytes(int no, byte[] buf) 
    97106    throws FormatException, IOException 
    98107  { 
    99     return false; 
    100   } 
    101  
    102   /* @see loci.formats.IFormatReader#openBytes(String, int) */  
    103   public byte[] openBytes(String id, int no) 
    104     throws FormatException, IOException 
    105   { 
    106     if (!id.equals(currentId)) initFile(id); 
    107     byte[] buf = new byte[core.sizeX[0] * core.sizeY[0] * bytesPerPixel]; 
    108     return openBytes(id, no, buf); 
    109   } 
    110  
    111   /* @see loci.formats.IFormatReader#openBytes(String, int, byte[]) */ 
    112   public byte[] openBytes(String id, int no, byte[] buf) 
    113     throws FormatException, IOException 
    114   { 
    115     if (!id.equals(currentId)) initFile(id); 
    116108    if (no != 0) { 
    117109      throw new FormatException("Invalid image number: " + no); 
     
    126118  } 
    127119 
    128   /* @see loci.formats.IFormatReader#openImage(String, int) */  
    129   public BufferedImage openImage(String id, int no) 
    130     throws FormatException, IOException 
    131   { 
    132     if (!id.equals(currentId)) initFile(id); 
    133  
    134     if (no < 0 || no >= getImageCount(id)) { 
     120  /* @see loci.formats.IFormatReader#openImage(int) */  
     121  public BufferedImage openImage(int no) throws FormatException, IOException { 
     122    if (no < 0 || no >= getImageCount()) { 
    135123      throw new FormatException("Invalid image number: " + no); 
    136124    } 
    137125 
    138     return ImageTools.makeImage(openBytes(id, no), core.sizeX[0], core.sizeY[0], 
     126    return ImageTools.makeImage(openBytes( no), core.sizeX[0], core.sizeY[0], 
    139127      1, false, bytesPerPixel, littleEndian); 
    140128  } 
     
    241229 
    242230    // The metadata store we're working with. 
    243     MetadataStore store = getMetadataStore(id); 
     231    MetadataStore store = getMetadataStore(); 
    244232 
    245233    store.setPixels( 
  • trunk/loci/formats/in/GelReader.java

    r2557 r2583  
    9898    core.sizeT[series] = numImages; 
    9999 
    100     MetadataStore store = getMetadataStore(currentId); 
     100    MetadataStore store = getMetadataStore(); 
    101101    store.setDimensions(new Float(scale.floatValue()), 
    102102      new Float(scale.floatValue()), null, null, null, null); 
  • trunk/loci/formats/in/ICSReader.java

    r2557 r2583  
    105105  } 
    106106 
    107   /* @see loci.formats.IFormatReader#getImageCount(String) */  
    108   public int getImageCount(String id) throws FormatException, IOException { 
    109     if (!id.equals(currentIdsId) && !id.equals(currentIcsId)) initFile(id); 
     107  /* @see loci.formats.IFormatReader#getImageCount() */  
     108  public int getImageCount() throws FormatException, IOException { 
    110109    if (numImages == 1) return 1; 
    111110    return numImages / (rgb ? core.sizeC[0] : 1); 
    112111  } 
    113112 
    114   /* @see loci.formats.IFormatReader#isRGB(String) */  
    115   public boolean isRGB(String id) throws FormatException, IOException { 
    116     if (!id.equals(currentIdsId) && !id.equals(currentIcsId)) initFile(id); 
     113  /* @see loci.formats.IFormatReader#isRGB() */  
     114  public boolean isRGB() throws FormatException, IOException { 
    117115    return rgb && core.sizeC[0] > 1; 
    118116  } 
    119117 
    120   /* @see loci.formats.IFormatReader#isLittleEndian(String) */  
    121   public boolean isLittleEndian(String id) throws FormatException, IOException { 
    122     if (!id.equals(currentIdsId) && !id.equals(currentIcsId)) initFile(id); 
     118  /* @see loci.formats.IFormatReader#isLittleEndian() */  
     119  public boolean isLittleEndian() throws FormatException, IOException { 
    123120    return littleEndian; 
    124121  } 
    125122 
    126   /* @see loci.formats.IFormatReader#isInterleaved(String, int) */ 
    127   public boolean isInterleaved(String id, int subC) 
     123  /* @see loci.formats.IFormatReader#isInterleaved(int) */ 
     124  public boolean isInterleaved(int subC) throws FormatException, IOException { 
     125    return !rgb; 
     126  } 
     127 
     128  /* @see loci.formats.IFormatReader#openBytes(int) */ 
     129  public byte[] openBytes(int no) throws FormatException, IOException { 
     130    byte[] buf = new byte[core.sizeX[0] * core.sizeY[0] * (bitsPerPixel / 8) * 
     131      getRGBChannelCount()]; 
     132    return openBytes(no, buf); 
     133  } 
     134 
     135  /* @see loci.formats.IFormatReader#openBytes(int, byte[]) */ 
     136  public byte[] openBytes(int no, byte[] buf) 
    128137    throws FormatException, IOException 
    129138  { 
    130     if (!id.equals(currentIdsId) && !id.equals(currentIcsId)) initFile(id); 
    131     return !rgb; 
    132   } 
    133  
    134   /* @see loci.formats.IFormatReader#openBytes(String, int) */ 
    135   public byte[] openBytes(String id, int no) 
    136     throws FormatException, IOException 
    137   { 
    138     if (!id.equals(currentId)) initFile(id); 
    139     byte[] buf = new byte[core.sizeX[0] * core.sizeY[0] * (bitsPerPixel / 8) * 
    140       getRGBChannelCount(id)]; 
    141     return openBytes(id, no, buf); 
    142   } 
    143  
    144   /* @see loci.formats.IFormatReader#openBytes(String, int, byte[]) */ 
    145   public byte[] openBytes(String id, int no, byte[] buf) 
    146     throws FormatException, IOException 
    147   { 
    148     if (!id.equals(currentIdsId) && !id.equals(currentIcsId)) initFile(id); 
    149     if (no < 0 || no >= getImageCount(currentId)) { 
     139    if (no < 0 || no >= getImageCount()) { 
    150140      throw new FormatException("Invalid image number: " + no); 
    151141    } 
    152142    if (buf.length < core.sizeX[0] * core.sizeY[0] * (bitsPerPixel / 8) * 
    153       getRGBChannelCount(id)) 
     143      getRGBChannelCount()) 
    154144    { 
    155145      throw new FormatException("Buffer too small."); 
     
    158148    int bpp = bitsPerPixel / 8; 
    159149 
    160     int len = core.sizeX[0] * core.sizeY[0] * bpp * getRGBChannelCount(id); 
     150    int len = core.sizeX[0] * core.sizeY[0] * bpp * getRGBChannelCount(); 
    161151    int offset = len * no; 
    162152    if (!rgb && core.sizeC[0] > 4) { 
     
    183173  } 
    184174 
    185   /* @see loci.formats.IFormatReader#openImage(String, int) */  
    186   public BufferedImage openImage(String id, int no) 
    187     throws FormatException, IOException 
    188   { 
    189     if (!id.equals(currentIdsId) && !id.equals(currentIcsId)) initFile(id); 
    190  
    191     byte[] plane = openBytes(id, no); 
     175  /* @see loci.formats.IFormatReader#openImage(int) */  
     176  public BufferedImage openImage(int no) throws FormatException, IOException { 
     177    byte[] plane = openBytes(no); 
    192178    int channels = rgb ? core.sizeC[0] : 1; 
    193179 
     
    212198  } 
    213199 
    214   /* @see loci.formats.IFormatReader#getUsedFiles(String) */ 
    215   public String[] getUsedFiles(String id) throws FormatException, IOException { 
    216     if (!id.equals(currentIdsId) && !id.equals(currentIcsId)) initFile(id); 
     200  /* @see loci.formats.IFormatReader#getUsedFiles() */ 
     201  public String[] getUsedFiles() throws FormatException, IOException { 
    217202    if (versionTwo) { 
    218       return new String[] {currentIdsId == null ? id : currentIdsId}; 
     203      return new String[] {currentIdsId == null ? "" : currentIdsId}; 
    219204    } 
    220205    return new String[] {currentIdsId, currentIcsId}; 
     
    424409 
    425410    // The metadata store we're working with. 
    426     MetadataStore store = getMetadataStore(id); 
     411    MetadataStore store = getMetadataStore(); 
    427412 
    428413    store.setImage((String) getMeta("filename"), null, null, null); 
  • trunk/loci/formats/in/IPLabReader.java

    r2557 r2583  
    7575  } 
    7676 
    77   /* @see loci.formats.IFormatReader#getImageCount(String) */  
    78   public int getImageCount(String id) throws FormatException, IOException { 
    79     if (!id.equals(currentId)) initFile(id); 
     77  /* @see loci.formats.IFormatReader#getImageCount() */  
     78  public int getImageCount() throws FormatException, IOException { 
    8079    return numImages; 
    8180  } 
    8281 
    83   /* @see loci.formats.IFormatReader#isRGB(String) */  
    84   public boolean isRGB(String id) throws FormatException, IOException { 
    85     if (!id.equals(currentId)) initFile(id); 
     82  /* @see loci.formats.IFormatReader#isRGB() */  
     83  public boolean isRGB() throws FormatException, IOException { 
    8684    return core.sizeC[0] > 1; 
    8785  } 
    8886 
    89   /* @see loci.formats.IFormatReader#isLittleEndian(String) */  
    90   public boolean isLittleEndian(String id) throws FormatException, IOException { 
    91     if (!id.equals(currentId)) initFile(id); 
     87  /* @see loci.formats.IFormatReader#isLittleEndian() */  
     88  public boolean isLittleEndian() throws FormatException, IOException { 
    9289    return littleEndian; 
    9390  } 
    9491 
    95   /* @see loci.formats.IFormatReader#isInterleaved(String, int) */  
    96   public boolean isInterleaved(String id, int subC) 
     92  /* @see loci.formats.IFormatReader#isInterleaved(int) */  
     93  public boolean isInterleaved(int subC) throws FormatException, IOException { 
     94    return true; 
     95  } 
     96 
     97  /* @see loci.formats.IFormatReader#openBytes(int) */  
     98  public byte[] openBytes(int no) throws FormatException, IOException { 
     99    byte[] buf = new byte[core.sizeX[0] * core.sizeY[0] * bps * core.sizeC[0]]; 
     100    return openBytes(no, buf); 
     101  } 
     102 
     103  /* @see loci.formats.IFormatReader#openBytes(int, byte[]) */ 
     104  public byte[] openBytes(int no, byte[] buf)  
    97105    throws FormatException, IOException 
    98106  { 
    99     return true; 
    100   } 
    101  
    102   /* @see loci.formats.IFormatReader#openBytes(String, int) */  
    103   public byte[] openBytes(String id, int no) 
    104     throws FormatException, IOException 
    105   { 
    106     if (!id.equals(currentId)) initFile(id); 
    107     byte[] buf = new byte[core.sizeX[0] * core.sizeY[0] * bps * core.sizeC[0]]; 
    108     return openBytes(id, no, buf); 
    109   } 
    110  
    111   /* @see loci.formats.IFormatReader#openBytes(String, int, byte[]) */ 
    112   public byte[] openBytes(String id, int no, byte[] buf) 
    113     throws FormatException, IOException 
    114   { 
    115     if (!id.equals(currentId)) initFile(id); 
    116     if (no < 0 || no >= getImageCount(id)) { 
     107    if (no < 0 || no >= getImageCount()) { 
    117108      throw new FormatException("Invalid image number: " + no); 
    118109    } 
     
    128119  } 
    129120 
    130   /* @see loci.formats.IFormatReader#openImage(String, int) */  
    131   public BufferedImage openImage(String id, int no) 
    132     throws FormatException, IOException 
    133   { 
    134     return ImageTools.makeImage(openBytes(id, no), core.sizeX[0], core.sizeY[0], 
    135       isRGB(id) ? core.sizeC[0] : 1, false, bps, littleEndian); 
     121  /* @see loci.formats.IFormatReader#openImage(int) */  
     122  public BufferedImage openImage(int no) throws FormatException, IOException { 
     123    return ImageTools.makeImage(openBytes(no), core.sizeX[0], core.sizeY[0], 
     124      isRGB() ? core.sizeC[0] : 1, false, bps, littleEndian); 
    136125  } 
    137126 
     
    237226 
    238227    // The metadata store we're working with. 
    239     MetadataStore store = getMetadataStore(id); 
     228    MetadataStore store = getMetadataStore(); 
    240229 
    241230    store.setPixels( 
     
    367356          addMeta("NormalizationWhite" + i, new Double(white)); 
    368357 
    369           store = getMetadataStore(currentId); 
     358          store = getMetadataStore(); 
    370359          store.setChannelGlobalMinMax(i, new Double(min), 
    371360            new Double(max), null); 
     
    456445        addMeta("Notes", notes); 
    457446 
    458         store.setImage(id, null, notes, null); 
     447        store.setImage(currentId, null, notes, null); 
    459448      } 
    460449 
  • trunk/loci/formats/in/IPWReader.java

    r2563 r2583  
    8787  } 
    8888 
    89   /* @see loci.formats.IFormatReader#getImageCount(String) */  
    90   public int getImageCount(String id) throws FormatException, IOException { 
    91     if (!id.equals(currentId)) initFile(id); 
     89  /* @see loci.formats.IFormatReader#getImageCount() */  
     90  public int getImageCount() throws FormatException, IOException { 
    9291    return numImages; 
    9392  } 
    9493 
    95   /* @see loci.formats.IFormatReader#isRGB(String) */  
    96   public boolean isRGB(String id) throws FormatException, IOException { 
    97     if (!id.equals(currentId)) initFile(id); 
     94  /* @see loci.formats.IFormatReader#isRGB() */  
     95  public boolean isRGB() throws FormatException, IOException { 
    9896    return rgb; 
    9997  } 
    10098 
    101   /* @see loci.formats.IFormatReader#isLittleEndian(String) */  
    102   public boolean isLittleEndian(String id) throws FormatException, IOException { 
    103     if (!id.equals(currentId)) initFile(id); 
     99  /* @see loci.formats.IFormatReader#isLittleEndian() */  
     100  public boolean isLittleEndian() throws FormatException, IOException { 
    104101    return little; 
    105102  } 
    106103 
    107   /* @see loci.formats.IFormatReader#openBytes(String, int) */  
    108   public byte[] openBytes(String id, int no) 
    109     throws FormatException, IOException 
    110   { 
    111     if (!id.equals(currentId)) initFile(id); 
    112     int c = getRGBChannelCount(id); 
     104  /* @see loci.formats.IFormatReader#openBytes(int) */  
     105  public byte[] openBytes(int no) throws FormatException, IOException { 
     106    int c = getRGBChannelCount(); 
    113107    if (c == 2) c++; 
    114108    byte[] buf = new byte[core.sizeX[0] * core.sizeY[0] * c * 
    115109      FormatTools.getBytesPerPixel(core.pixelType[0])]; 
    116     return openBytes(id, no, buf); 
    117   } 
    118  
    119   /* @see loci.formats.IFormatReader#openBytes(String, int, byte[]) */ 
    120   public byte[] openBytes(String id, int no, byte[] buf) 
     110    return openBytes(no, buf); 
     111  } 
     112 
     113  /* @see loci.formats.IFormatReader#openBytes(int, byte[]) */ 
     114  public byte[] openBytes(int no, byte[] buf) 
    121115    throws FormatException, IOException 
    122116  { 
    123     if (!id.equals(currentId)) initFile(id); 
    124     if (no < 0 || no >= getImageCount(id)) { 
     117    if (no < 0 || no >= getImageCount()) { 
    125118      throw new FormatException("Invalid image number: " + no); 
    126119    } 
     
    163156  } 
    164157 
    165   /* @see loci.formats.IFormatReader#openImage(String, int) */  
    166   public BufferedImage openImage(String id, int no) 
    167     throws FormatException, IOException 
    168   { 
    169     if (!id.equals(currentId)) initFile(id); 
    170     if (no < 0 || no >= getImageCount(id)) { 
     158  /* @see loci.formats.IFormatReader#openImage(int) */  
     159  public BufferedImage openImage(int no) throws FormatException, IOException { 
     160    if (no < 0 || no >= getImageCount()) { 
    171161      throw new FormatException("Invalid image number: " + no); 
    172162    } 
    173163 
    174     byte[] b = openBytes(id, no); 
     164    byte[] b = openBytes(no); 
    175165    int bytes = b.length / (core.sizeX[0] * core.sizeY[0]); 
    176166    return ImageTools.makeImage(b, core.sizeX[0], core.sizeY[0], 
     
    219209      parseDir(0, r.getVar("dir")); 
    220210      status("Populating metadata");  
    221       initMetadata(id); 
     211      initMetadata(); 
    222212    } 
    223213    catch (Throwable t) { 
     
    229219  // -- Internal BaseTiffReader API methods -- 
    230220 
    231   /* @see loci.formats.in.BaseTiffReader#initMetadata(String) */  
    232   public void initMetadata(String id) 
    233     throws FormatException, IOException 
    234   { 
     221  /* @see BaseTiffReader#initMetadata() */  
     222  public void initMetadata() throws FormatException, IOException { 
    235223    String directory = (String) pixels.get(new Integer(0)); 
    236224    String name = (String) names.get(new Integer(0)); 
     
    280268    addMeta("slices", "1"); 
    281269    addMeta("channels", "1"); 
    282     addMeta("frames", new Integer(getImageCount(id))); 
     270    addMeta("frames", new Integer(getImageCount())); 
    283271 
    284272    // parse the description to get channels/slices/times where applicable 
     
    379367 
    380368    // The metadata store we're working with. 
    381     MetadataStore store = getMetadataStore(id); 
     369    MetadataStore store = getMetadataStore(); 
    382370 
    383371    store.setPixels(null, null, new Integer(core.sizeZ[0]),  
    384372      new Integer(core.sizeC[0]), new Integer(core.sizeT[0]),  
    385       new Integer(core.pixelType[0]), new Boolean(!isLittleEndian(id)),  
     373      new Integer(core.pixelType[0]), new Boolean(!isLittleEndian()),  
    386374      core.currentOrder[0], null, null); 
    387375    store.setImage(null, null, (String) getMeta("Version"), null); 
  • trunk/loci/formats/in/ImageIOReader.java

    r2557 r2583  
    6060  public boolean isThisType(byte[] block) { return false; } 
    6161 
    62   /* @see loci.formats.IFormatReader#getImageCount(String) */  
    63   public int getImageCount(String id) throws FormatException, IOException { 
     62  /* @see loci.formats.IFormatReader#getImageCount() */  
     63  public int getImageCount() throws FormatException, IOException { 
    6464    return 1; 
    6565  } 
    6666 
    67   /* @see loci.formats.IFormatReader#isRGB(String) */  
    68   public boolean isRGB(String id) throws FormatException, IOException { 
    69     if (!id.equals(currentId)) initFile(id); 
     67  /* @see loci.formats.IFormatReader#isRGB() */  
     68  public boolean isRGB() throws FormatException, IOException { 
    7069    return rgb; 
    7170  } 
    7271 
    73   /* @see loci.formats.IFormatReader#isLittleEndian(String) */  
    74   public boolean isLittleEndian(String id) throws FormatException, IOException { 
     72  /* @see loci.formats.IFormatReader#isLittleEndian() */  
     73  public boolean isLittleEndian() throws FormatException, IOException { 
    7574    return false; 
    7675  } 
    7776 
    78   /* @see loci.formats.IFormatReader#isInterleaved(String, int) */  
    79   public boolean isInterleaved(String id, int subC) 
    80     throws FormatException, IOException 
    81   { 
     77  /* @see loci.formats.IFormatReader#isInterleaved(int) */  
     78  public boolean isInterleaved(int subC) throws FormatException, IOException { 
    8279    return true; 
    8380  } 
    8481 
    85   /* @see loci.formats.IFormatReader#openBytes(String, int) */  
    86   public byte[] openBytes(String id, int no) 
     82  /* @see loci.formats.IFormatReader#openBytes(int) */  
     83  public byte[] openBytes(int no) 
    8784    throws FormatException, IOException 
    8885  { 
    89     byte[] b = ImageTools.getBytes(openImage(id, no), false, no); 
     86    byte[] b = ImageTools.getBytes(openImage(no), false, no); 
    9087    int bytesPerChannel = core.sizeX[0] * core.sizeY[0]; 
    9188    if (b.length > bytesPerChannel) { 
     
    10097  } 
    10198 
    102   /* @see loci.formats.IFormatReader#openImage(String, int) */  
    103   public BufferedImage openImage(String id, int no) 
    104     throws FormatException, IOException 
    105   { 
    106     if (no < 0 || no >= getImageCount(id)) { 
     99  /* @see loci.formats.IFormatReader#openImage(int) */  
     100  public BufferedImage openImage(int no) throws FormatException, IOException { 
     101    if (no < 0 || no >= getImageCount()) { 
    107102      throw new FormatException("Invalid image number: " + no); 
    108103    } 
    109104 
    110     RandomAccessStream ras = new RandomAccessStream(id); 
     105    RandomAccessStream ras = new RandomAccessStream(currentId); 
    111106    DataInputStream dis = 
    112107      new DataInputStream(new BufferedInputStream(ras, 4096)); 
     
    129124 
    130125    status("Populating metadata"); 
    131     BufferedImage img = openImage(id, 0); 
     126    BufferedImage img = openImage(0); 
    132127 
    133128    core.sizeX[0] = img.getWidth(); 
     
    144139    // populate the metadata store 
    145140 
    146     MetadataStore store = getMetadataStore(id); 
     141    MetadataStore store = getMetadataStore(); 
    147142 
    148143    store.setPixels( 
  • trunk/loci/formats/in/ImarisReader.java

    r2557 r2583  
    136136 
    137137    // The metadata store we're working with. 
    138     MetadataStore store = getMetadataStore(id); 
     138    MetadataStore store = getMetadataStore(); 
    139139 
    140140    core.pixelType[0] = FormatTools.UINT8;