Changeset 1945


Ignore:
Timestamp:
12/19/06 13:48:13 (13 years ago)
Author:
curtis
Message:
  • Fix bugs in -range command line parameter.
  • Change behavior so that end value is inclusive rather than exclusive.
  • Print range of image planes being read in "Reading pixels" output.
File:
1 edited

Legend:

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

    r1944 r1945  
    486486    boolean fastBlit = false; 
    487487    int start = 0; 
    488     int end = 0; 
     488    int end = Integer.MAX_VALUE; 
    489489    int series = 0; 
    490490    String map = null; 
     
    546546        "     -fast: paint RGB images as quickly as possible*", 
    547547        "    -debug: turn on debugging output", 
    548         "    -range: specify range of planes to read", 
     548        "    -range: specify range of planes to read (inclusive)", 
    549549        "   -series: specify which image series to read", 
    550550        "      -map: specify file on disk to which name should be mapped", 
     
    684684      long s1 = System.currentTimeMillis(); 
    685685      int num = reader.getImageCount(id); 
    686       if (end == 0 || end > num) end = num; 
    687       if (end < 0) end = 0; 
    688686      if (start < 0) start = 0; 
    689687      if (start >= num) start = num - 1; 
    690  
    691       System.out.print("(" + (end - start) + ") "); 
     688      if (end < 0) end = 0; 
     689      if (end >= num) end = num - 1; 
     690      if (end < start) end = start; 
     691 
     692      System.out.print("(" + start + "-" + end + ") "); 
    692693      long e1 = System.currentTimeMillis(); 
    693       BufferedImage[] images = new BufferedImage[end - start]; 
     694      BufferedImage[] images = new BufferedImage[end - start + 1]; 
    694695      long s2 = System.currentTimeMillis(); 
    695696      boolean mismatch = false; 
    696       for (int i=start; i<end; i++) { 
     697      for (int i=start; i<=end; i++) { 
    697698        if (!fastBlit) { 
    698699          images[i - start] = thumbs ? 
     
    734735      // output timing results 
    735736      float sec = (e2 - s1) / 1000f; 
    736       float avg = (float) (e2 - s2) / (end - start); 
     737      float avg = (float) (e2 - s2) / images.length; 
    737738      long initial = e1 - s1; 
    738739      System.out.println(sec + "s elapsed (" + 
Note: See TracChangeset for help on using the changeset viewer.