Changeset 2430


Ignore:
Timestamp:
03/13/07 17:03:01 (13 years ago)
Author:
curtis
Message:

Move static FormatReader methods to new FormatTools class.
The rationale for this is that FormatReader was performing two distinct
functions: superclass of concrete format readers; and bag of utility methods
for format reading and writing. Now it is only the superclass, and the utility
methods are in a dedicated class. This solution seems more appropriate, since
there were calls to FormatReader constants in places like FormatWriter
subclasses, which seems counterintuitive and confusing. Also makes FormatReader
more readable by cutting down on bloat (the utility constants and methods were
over 600 lines of code all by themselves).

Location:
trunk/loci
Files:
1 added
58 edited

Legend:

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

    r2327 r2430  
    508508      else if (!force && !writer.isSupportedType(out, type)) { 
    509509        throw new FormatException("Unsupported pixel type: " +  
    510           FormatReader.getPixelTypeString(type) + 
     510          FormatTools.getPixelTypeString(type) + 
    511511          "\nTo write to this format, the \"force\" box must be checked.\n" + 
    512512          "This may result in a loss of precision; for best results, " + 
     
    575575                    int pixelType = 0; 
    576576                    switch (type) { 
    577                       case FormatReader.INT8: 
    578                       case FormatReader.UINT8:  
     577                      case FormatTools.INT8: 
     578                      case FormatTools.UINT8:  
    579579                        pixelType = DataBuffer.TYPE_BYTE; 
    580580                        break; 
    581                       case FormatReader.INT16:  
     581                      case FormatTools.INT16:  
    582582                        pixelType = DataBuffer.TYPE_USHORT; 
    583583                        break; 
    584                       case FormatReader.UINT16:  
     584                      case FormatTools.UINT16:  
    585585                        pixelType = DataBuffer.TYPE_SHORT; 
    586586                        break; 
    587                       case FormatReader.INT32: 
    588                       case FormatReader.UINT32:  
     587                      case FormatTools.INT32: 
     588                      case FormatTools.UINT32:  
    589589                        pixelType = DataBuffer.TYPE_INT; 
    590590                        break; 
    591                       case FormatReader.FLOAT:  
     591                      case FormatTools.FLOAT:  
    592592                        pixelType = DataBuffer.TYPE_FLOAT; 
    593593                        break; 
    594                       case FormatReader.DOUBLE: 
     594                      case FormatTools.DOUBLE: 
    595595                        pixelType = DataBuffer.TYPE_DOUBLE; 
    596596                        break;  
  • trunk/loci/formats/ChannelMerger.java

    r2320 r2430  
    137137    throws FormatException, IOException 
    138138  { 
    139     return FormatReader.getIndex(this, id, z, c, t); 
     139    return FormatTools.getIndex(this, id, z, c, t); 
    140140  } 
    141141 
     
    143143    throws FormatException, IOException 
    144144  { 
    145     return FormatReader.getZCTCoords(this, id, index); 
     145    return FormatTools.getZCTCoords(this, id, index); 
    146146  } 
    147147 
    148148  public boolean testRead(String[] args) throws FormatException, IOException { 
    149     return FormatReader.testRead(this, args); 
     149    return FormatTools.testRead(this, args); 
    150150  } 
    151151 
  • trunk/loci/formats/ChannelSeparator.java

    r2399 r2430  
    111111    byte[] b = openBytes(id, no); 
    112112 
    113     if (getPixelType(id) == FormatReader.FLOAT) { 
     113    if (getPixelType(id) == FormatTools.FLOAT) { 
    114114      float[] f = new float[b.length / 4]; 
    115115      for (int i=0; i<b.length; i+=4) { 
     
    168168    throws FormatException, IOException 
    169169  { 
    170     return FormatReader.getIndex(this, id, z, c, t); 
     170    return FormatTools.getIndex(this, id, z, c, t); 
    171171  } 
    172172 
     
    174174    throws FormatException, IOException 
    175175  { 
    176     return FormatReader.getZCTCoords(this, id, index); 
     176    return FormatTools.getZCTCoords(this, id, index); 
    177177  } 
    178178 
    179179  public boolean testRead(String[] args) throws FormatException, IOException { 
    180     return FormatReader.testRead(this, args); 
     180    return FormatTools.testRead(this, args); 
    181181  } 
    182182 
  • trunk/loci/formats/FileStitcher.java

    r2418 r2430  
    452452    int sno = getSeries(id); 
    453453    if (blankBytes[sno] == null) { 
    454       int bytes = FormatReader.getBytesPerPixel(getPixelType(currentId)); 
     454      int bytes = FormatTools.getBytesPerPixel(getPixelType(currentId)); 
    455455      blankBytes[sno] = new byte[width[sno] * height[sno] * 
    456456        bytes * getRGBChannelCount(id)]; 
     
    482482    if (blankThumb[sno] == null) { 
    483483      blankThumb[sno] = ImageTools.blankImage(getThumbSizeX(id), 
    484         getThumbSizeY(id), sizeC[sno], FormatReader.UINT8); 
     484        getThumbSizeY(id), sizeC[sno], FormatTools.UINT8); 
    485485    } 
    486486    return blankThumb[sno]; 
     
    629629    throws FormatException, IOException 
    630630  { 
    631     return FormatReader.getIndex(this, id, z, c, t); 
     631    return FormatTools.getIndex(this, id, z, c, t); 
    632632  } 
    633633 
     
    636636    throws FormatException, IOException 
    637637  { 
    638     return FormatReader.getZCTCoords(this, id, index); 
     638    return FormatTools.getZCTCoords(this, id, index); 
    639639  } 
    640640 
     
    686686  /* @see IFormatReader#testRead(String[]) */ 
    687687  public boolean testRead(String[] args) throws FormatException, IOException { 
    688     return FormatReader.testRead(this, args); 
     688    return FormatTools.testRead(this, args); 
    689689  } 
    690690 
     
    933933    } 
    934934    int fno = positionToRaster(count, pos); 
    935     int ino = FormatReader.getIndex(order[sno], sizeZ[sno], 
     935    int ino = FormatTools.getIndex(order[sno], sizeZ[sno], 
    936936      reader.getEffectiveSizeC(files[0]), sizeT[sno], imagesPerFile[sno], 
    937937      posZ[0], posC[0], posT[0]); 
  • trunk/loci/formats/FormatReader.java

    r2418 r2430  
    2727import java.awt.image.BufferedImage; 
    2828import java.awt.image.WritableRaster; 
    29 import java.io.*; 
    30 import java.lang.reflect.Method; 
     29import java.io.IOException; 
    3130import java.util.*; 
    3231import javax.swing.filechooser.FileFilter; 
     
    4544  /** Default thumbnail width and height. */ 
    4645  protected static final int THUMBNAIL_DIMENSION = 128; 
    47  
    48   /** Identifies the <i>INT8</i> data type used to store pixel values. */ 
    49   public static final int INT8 = 0; 
    50  
    51   /** Identifies the <i>UINT8</i> data type used to store pixel values. */ 
    52   public static final int UINT8 = 1; 
    53  
    54   /** Identifies the <i>INT16</i> data type used to store pixel values. */ 
    55   public static final int INT16 = 2; 
    56  
    57   /** Identifies the <i>UINT16</i> data type used to store pixel values. */ 
    58   public static final int UINT16 = 3; 
    59  
    60   /** Identifies the <i>INT32</i> data type used to store pixel values. */ 
    61   public static final int INT32 = 4; 
    62  
    63   /** Identifies the <i>UINT32</i> data type used to store pixel values. */ 
    64   public static final int UINT32 = 5; 
    65  
    66   /** Identifies the <i>FLOAT</i> data type used to store pixel values. */ 
    67   public static final int FLOAT = 6; 
    68  
    69   /** Identifies the <i>DOUBLE</i> data type used to store pixel values. */ 
    70   public static final int DOUBLE = 7; 
    71  
    72   /** Human readable pixel type. */ 
    73   private static String[] pixelTypes; 
    74   static { 
    75     pixelTypes = new String[8]; 
    76     pixelTypes[FormatReader.INT8] = "int8"; 
    77     pixelTypes[FormatReader.UINT8] = "uint8"; 
    78     pixelTypes[FormatReader.INT16] = "int16"; 
    79     pixelTypes[FormatReader.UINT16] = "uint16"; 
    80     pixelTypes[FormatReader.INT32] = "int32"; 
    81     pixelTypes[FormatReader.UINT32] = "uint32"; 
    82     pixelTypes[FormatReader.FLOAT] = "float"; 
    83     pixelTypes[FormatReader.DOUBLE] = "double"; 
    84   } 
    8546 
    8647  // -- Static fields -- 
     
    595556    throws FormatException, IOException 
    596557  { 
    597     return getIndex(this, id, z, c, t); 
     558    return FormatTools.getIndex(this, id, z, c, t); 
    598559  } 
    599560 
     
    602563    throws FormatException, IOException 
    603564  { 
    604     return getZCTCoords(this, id, index); 
     565    return FormatTools.getZCTCoords(this, id, index); 
    605566  } 
    606567 
     
    658619  /* @see FormatReader#testRead(String[]) */ 
    659620  public boolean testRead(String[] args) throws FormatException, IOException { 
    660     return testRead(this, args); 
     621    return FormatTools.testRead(this, args); 
    661622  } 
    662623 
     
    673634  // -- Utility methods -- 
    674635 
     636  /** Toggles debug mode (more verbose output and error messages). */ 
     637  public static void setDebug(boolean debug) { 
     638    FormatReader.debug = debug; 
     639  } 
     640 
    675641  /** 
    676    * A utility method for test reading a file from the command line, 
    677    * and displaying the results in a simple display. 
     642   * Toggles debug mode verbosity (which kinds of output are produced). 
     643   * @param debugLevel 1=basic, 2=extended, 3=everything. 
    678644   */ 
    679   public static boolean testRead(IFormatReader reader, String[] args) 
    680     throws FormatException, IOException 
    681   { 
    682     String id = null; 
    683     boolean pixels = true; 
    684     boolean doMeta = true; 
    685     boolean thumbs = false; 
    686     boolean merge = false; 
    687     boolean stitch = false; 
    688     boolean separate = false; 
    689     boolean omexml = false; 
    690     boolean ignoreColors = false; 
    691     boolean normalize = false; 
    692     boolean fastBlit = false; 
    693     int start = 0; 
    694     int end = Integer.MAX_VALUE; 
    695     int series = 0; 
    696     String map = null; 
    697     if (args != null) { 
    698       for (int i=0; i<args.length; i++) { 
    699         if (args[i].startsWith("-") && args.length > 1) { 
    700           if (args[i].equals("-nopix")) pixels = false; 
    701           else if (args[i].equals("-nometa")) doMeta = false; 
    702           else if (args[i].equals("-thumbs")) thumbs = true; 
    703           else if (args[i].equals("-merge")) merge = true; 
    704           else if (args[i].equals("-stitch")) stitch = true; 
    705           else if (args[i].equals("-separate")) separate = true; 
    706           else if (args[i].equals("-nocolors")) ignoreColors = true; 
    707           else if (args[i].equals("-omexml")) omexml = true; 
    708           else if (args[i].equals("-normalize")) normalize = true; 
    709           else if (args[i].equals("-fast")) fastBlit = true; 
    710           else if (args[i].equals("-debug")) debug = true; 
    711           else if (args[i].equals("-level")) { 
    712             try { 
    713               debugLevel = Integer.parseInt(args[++i]); 
    714             } 
    715             catch (Exception exc) { } 
    716           } 
    717           else if (args[i].equals("-range")) { 
    718             try { 
    719               start = Integer.parseInt(args[++i]); 
    720               end = Integer.parseInt(args[++i]); 
    721             } 
    722             catch (Exception exc) { } 
    723           } 
    724           else if (args[i].equals("-series")) { 
    725             try { 
    726               series = Integer.parseInt(args[++i]); 
    727             } 
    728             catch (Exception exc) { } 
    729           } 
    730           else if (args[i].equals("-map")) map = args[++i]; 
    731           else System.out.println("Ignoring unknown command flag: " + args[i]); 
    732         } 
    733         else { 
    734           if (id == null) id = args[i]; 
    735           else System.out.println("Ignoring unknown argument: " + args[i]); 
    736         } 
    737       } 
    738     } 
    739     if (debug) System.out.println("Debugging at level " + debugLevel); 
    740     if (id == null) { 
    741       String className = reader.getClass().getName(); 
    742       String format = reader.getFormat(); 
    743       String[] s = { 
    744         "To test read a file in " + format + " format, run:", 
    745         "  java " + className + " [-nopix] [-nometa] [-thumbs] [-merge]", 
    746         "    [-stitch] [-separate] [-nocolors] [-omexml] [-normalize] [-fast]", 
    747         "    [-debug] [-range start end] [-series num] [-map id] file", 
    748         "", 
    749         "      file: the image file to read", 
    750         "    -nopix: read metadata only, not pixels", 
    751         "   -nometa: output only core metadata", 
    752         "   -thumbs: read thumbnails instead of normal pixels", 
    753         "    -merge: combine separate channels into RGB image", 
    754         "   -stitch: stitch files with similar names", 
    755         " -separate: split RGB image into separate channels", 
    756         " -nocolors: ignore color lookup tables, if present", 
    757         "   -omexml: populate OME-XML metadata", 
    758         "-normalize: normalize floating point images*", 
    759         "     -fast: paint RGB images as quickly as possible*", 
    760         "    -debug: turn on debugging output", 
    761         "    -range: specify range of planes to read (inclusive)", 
    762         "   -series: specify which image series to read", 
    763         "      -map: specify file on disk to which name should be mapped", 
    764         "", 
    765         "* = may result in loss of precision", 
    766         "" 
    767       }; 
    768       for (int i=0; i<s.length; i++) System.out.println(s[i]); 
    769       return false; 
    770     } 
    771     if (map != null) Location.mapId(id, map); 
    772     if (omexml) { 
    773       try { 
    774         Class c = Class.forName("loci.formats.ome.OMEXMLMetadataStore"); 
    775         MetadataStore ms = (MetadataStore) c.newInstance(); 
    776         reader.setMetadataStore(ms); 
    777       } 
    778       catch (Throwable t) { 
    779         // NB: error messages for missing OME-Java are printed later 
    780       } 
    781     } 
    782  
    783     // check file format 
    784     if (reader instanceof ImageReader) { 
    785       // determine format 
    786       ImageReader ir = (ImageReader) reader; 
    787       System.out.print("Checking file format "); 
    788       System.out.println("[" + ir.getFormat(id) + "]"); 
    789     } 
    790     else { 
    791       // verify format 
    792       System.out.print("Checking " + reader.getFormat() + " format "); 
    793       System.out.println(reader.isThisType(id) ? "[yes]" : "[no]"); 
    794     } 
    795  
    796     if (stitch) { 
    797       reader = new FileStitcher(reader, true); 
    798       String pat = FilePattern.findPattern(new Location(id)); 
    799       if (pat != null) id = pat; 
    800     } 
    801     if (separate) reader = new ChannelSeparator(reader); 
    802     if (merge) reader = new ChannelMerger(reader); 
    803  
    804     reader.setColorTableIgnored(ignoreColors); 
    805     reader.setNormalized(normalize); 
    806     reader.setMetadataFiltered(true); 
    807  
    808     if (!normalize && reader.getPixelType(id) == FLOAT) { 
    809       throw new FormatException("Sorry, unnormalized floating point " + 
    810         "data is not supported. Please use the '-normalize' option."); 
    811     } 
    812  
    813     // read basic metadata 
    814     System.out.println(); 
    815     System.out.println("Reading core metadata"); 
    816     System.out.println(stitch ? 
    817       "File pattern = " + id : "Filename = " + reader.getCurrentFile()); 
    818     if (map != null) System.out.println("Mapped filename = " + map); 
    819     String[] used = reader.getUsedFiles(id); 
    820     boolean usedValid = used != null && used.length > 0; 
    821     if (usedValid) { 
    822       for (int u=0; u<used.length; u++) { 
    823         if (used[u] == null) { 
    824           usedValid = false; 
    825           break; 
    826         } 
    827       } 
    828     } 
    829     if (!usedValid) { 
    830       System.out.println( 
    831         "************ Warning: invalid used files list ************"); 
    832     } 
    833     if (used == null) { 
    834       System.out.println("Used files = null"); 
    835     } 
    836     else if (used.length == 0) { 
    837       System.out.println("Used files = []"); 
    838     } 
    839     else if (used.length > 1) { 
    840       System.out.println("Used files:"); 
    841       for (int u=0; u<used.length; u++) System.out.println("\t" + used[u]); 
    842     } 
    843     else if (!id.equals(used[0])) { 
    844       System.out.println("Used files = [" + used[0] + "]"); 
    845     } 
    846     int seriesCount = reader.getSeriesCount(id); 
    847     System.out.println("Series count = " + seriesCount); 
    848     for (int j=0; j<seriesCount; j++) { 
    849       reader.setSeries(id, j); 
    850  
    851       // read basic metadata for series #i 
    852       int imageCount = reader.getImageCount(id); 
    853       boolean rgb = reader.isRGB(id); 
    854       int rgbChanCount = reader.getRGBChannelCount(id); 
    855       boolean interleaved = reader.isInterleaved(id); 
    856       int sizeX = reader.getSizeX(id); 
    857       int sizeY = reader.getSizeY(id); 
    858       int sizeZ = reader.getSizeZ(id); 
    859       int sizeC = reader.getSizeC(id); 
    860       int effSizeC = reader.getEffectiveSizeC(id); 
    861       int sizeT = reader.getSizeT(id); 
    862       int thumbSizeX = reader.getThumbSizeX(id); 
    863       int thumbSizeY = reader.getThumbSizeY(id); 
    864       boolean little = reader.isLittleEndian(id); 
    865       String dimOrder = reader.getDimensionOrder(id); 
    866       boolean orderCertain = reader.isOrderCertain(id); 
    867       int pixelType = reader.getPixelType(id); 
    868  
    869       // output basic metadata for series #i 
    870       System.out.println("Series #" + j + ":"); 
    871       System.out.println("\tImage count = " + imageCount); 
    872       System.out.print("\tRGB = " + rgb + " (" + rgbChanCount + ")"); 
    873       if (merge) System.out.print(" (merged)"); 
    874       else if (separate) System.out.print(" (separated)"); 
    875       if (rgb != (rgbChanCount != 1)) { 
    876         System.out.println("\t************ Warning: RGB mismatch ************"); 
    877       } 
    878       System.out.println(); 
    879       System.out.println("\tInterleaved = " + interleaved); 
    880       System.out.println("\tWidth = " + sizeX); 
    881       System.out.println("\tHeight = " + sizeY); 
    882       System.out.println("\tSizeZ = " + sizeZ); 
    883       System.out.print("\tSizeC = " + sizeC); 
    884       if (sizeC != effSizeC) { 
    885         System.out.print(" (effectively " + effSizeC + ")"); 
    886       } 
    887       System.out.println(); 
    888       System.out.println("\tSizeT = " + sizeT); 
    889       if (imageCount != sizeZ * effSizeC * sizeT) { 
    890         System.out.println("\t************ Warning: ZCT mismatch ************"); 
    891       } 
    892       System.out.println("\tThumbnail size = " + 
    893         thumbSizeX + " x " + thumbSizeY); 
    894       System.out.println("\tEndianness = " + 
    895         (little ? "intel (little)" : "motorola (big)")); 
    896       System.out.println("\tDimension order = " + dimOrder + 
    897         (orderCertain ? " (certain)" : " (uncertain)")); 
    898       System.out.println("\tPixel type = " + getPixelTypeString(pixelType)); 
    899       if (doMeta) { 
    900         System.out.println("\t-----"); 
    901         int[] indices; 
    902         if (imageCount > 6) { 
    903           int q = imageCount / 2; 
    904           indices = new int[] { 
    905             0, q - 2, q - 1, q, q + 1, q + 2, imageCount - 1 
    906           }; 
    907         } 
    908         else if (imageCount > 2) { 
    909           indices = new int[] {0, imageCount / 2, imageCount - 1}; 
    910         } 
    911         else if (imageCount > 1) indices = new int[] {0, 1}; 
    912         else indices = new int[] {0}; 
    913         int[][] zct = new int[indices.length][]; 
    914         int[] indices2 = new int[indices.length]; 
    915         for (int i=0; i<indices.length; i++) { 
    916           zct[i] = reader.getZCTCoords(id, indices[i]); 
    917           indices2[i] = reader.getIndex(id, zct[i][0], zct[i][1], zct[i][2]); 
    918           System.out.print("\tPlane #" + indices[i] + " <=> Z " + zct[i][0] + 
    919             ", C " + zct[i][1] + ", T " + zct[i][2]); 
    920           if (indices[i] != indices2[i]) { 
    921             System.out.println(" [mismatch: " + indices2[i] + "]"); 
    922           } 
    923           else System.out.println(); 
    924         } 
    925       } 
    926     } 
    927     reader.setSeries(id, series); 
    928     String s = seriesCount > 1 ? (" series #" + series) : ""; 
    929     int pixelType = reader.getPixelType(id); 
    930  
    931     // read pixels 
    932     if (pixels) { 
    933       System.out.println(); 
    934       System.out.print("Reading" + s + " pixel data "); 
    935       long s1 = System.currentTimeMillis(); 
    936       int num = reader.getImageCount(id); 
    937       if (start < 0) start = 0; 
    938       if (start >= num) start = num - 1; 
    939       if (end < 0) end = 0; 
    940       if (end >= num) end = num - 1; 
    941       if (end < start) end = start; 
    942  
    943       System.out.print("(" + start + "-" + end + ") "); 
    944       long e1 = System.currentTimeMillis(); 
    945       BufferedImage[] images = new BufferedImage[end - start + 1]; 
    946       long s2 = System.currentTimeMillis(); 
    947       boolean mismatch = false; 
    948       for (int i=start; i<=end; i++) { 
    949         if (!fastBlit) { 
    950           images[i - start] = thumbs ? 
    951             reader.openThumbImage(id, i) : reader.openImage(id, i); 
    952         } 
    953         else { 
    954           int x = reader.getSizeX(id); 
    955           int y = reader.getSizeY(id); 
    956           byte[] b = thumbs ? reader.openThumbBytes(id, i) : 
    957             reader.openBytes(id, i); 
    958           Object pix = DataTools.makeDataArray(b, 
    959             FormatReader.getBytesPerPixel(reader.getPixelType(id)), 
    960             reader.getPixelType(id) == FormatReader.FLOAT, 
    961             reader.isLittleEndian(id)); 
    962           images[i - start] = 
    963             ImageTools.makeImage(ImageTools.make24Bits(pix, x, y, 
    964               false, false), x, y); 
    965         } 
    966  
    967         // check for pixel type mismatch 
    968         int pixType = ImageTools.getPixelType(images[i - start]); 
    969         if (pixType != pixelType && !fastBlit) { 
    970           if (!mismatch) { 
    971             System.out.println(); 
    972             mismatch = true; 
    973           } 
    974           System.out.println("\tPlane #" + i + ": pixel type mismatch: " + 
    975             getPixelTypeString(pixType) + "/" + getPixelTypeString(pixelType)); 
    976         } 
    977         else { 
    978           mismatch = false; 
    979           System.out.print("."); 
    980         } 
    981       } 
    982       long e2 = System.currentTimeMillis(); 
    983       if (!mismatch) System.out.print(" "); 
    984       System.out.println("[done]"); 
    985  
    986       // output timing results 
    987       float sec = (e2 - s1) / 1000f; 
    988       float avg = (float) (e2 - s2) / images.length; 
    989       long initial = e1 - s1; 
    990       System.out.println(sec + "s elapsed (" + 
    991         avg + "ms per image, " + initial + "ms overhead)"); 
    992  
    993       // display pixels in image viewer 
    994       ImageViewer viewer = new ImageViewer(); 
    995       viewer.setImages(id, reader, images); 
    996       viewer.setVisible(true); 
    997     } 
    998  
    999     // read format-specific metadata table 
    1000     if (doMeta) { 
    1001       System.out.println(); 
    1002       System.out.println("Reading" + s + " metadata"); 
    1003       Hashtable meta = reader.getMetadata(id); 
    1004       String[] keys = (String[]) meta.keySet().toArray(new String[0]); 
    1005       Arrays.sort(keys); 
    1006       for (int i=0; i<keys.length; i++) { 
    1007         System.out.print(keys[i] + ": "); 
    1008         System.out.println(reader.getMetadataValue(id, keys[i])); 
    1009       } 
    1010     } 
    1011  
    1012     // output OME-XML 
    1013     if (omexml) { 
    1014       System.out.println(); 
    1015       System.out.println("Generating OME-XML"); 
    1016       MetadataStore ms = reader.getMetadataStore(id); 
    1017  
    1018       if (ms.getClass().getName().equals( 
    1019         "loci.formats.ome.OMEXMLMetadataStore")) 
    1020       { 
    1021         try { 
    1022           Method m = ms.getClass().getMethod("dumpXML", (Class[]) null); 
    1023           System.out.println(m.invoke(ms, (Object[]) null)); 
    1024           System.out.println(); 
    1025         } 
    1026         catch (Throwable t) { 
    1027           System.out.println("Error generating OME-XML:"); 
    1028           t.printStackTrace(); 
    1029         } 
    1030       } 
    1031       else { 
    1032         System.out.println("OME-Java library not found; no OME-XML available"); 
    1033       } 
    1034     } 
    1035  
    1036     return true; 
    1037   } 
    1038  
    1039   /** 
    1040    * Gets the rasterized index corresponding 
    1041    * to the given Z, C and T coordinates. 
    1042    */ 
    1043   public static int getIndex(IFormatReader reader, String id, 
    1044     int z, int c, int t) throws FormatException, IOException 
    1045   { 
    1046     String order = reader.getDimensionOrder(id); 
    1047     int zSize = reader.getSizeZ(id); 
    1048     int cSize = reader.getEffectiveSizeC(id); 
    1049     int tSize = reader.getSizeT(id); 
    1050     int num = reader.getImageCount(id); 
    1051     return getIndex(order, zSize, cSize, tSize, num, z, c, t); 
    1052   } 
    1053  
    1054   /** 
    1055    * Gets the rasterized index corresponding 
    1056    * to the given Z, C and T coordinates. 
    1057    */ 
    1058   public static int getIndex(String order, int zSize, int cSize, int tSize, 
    1059     int num, int z, int c, int t) 
    1060     throws FormatException, IOException 
    1061   { 
    1062     // check DimensionOrder 
    1063     if (order == null) throw new FormatException("Dimension order is null"); 
    1064     if (!order.startsWith("XY")) { 
    1065       throw new FormatException("Invalid dimension order: " + order); 
    1066     } 
    1067     int iz = order.indexOf("Z") - 2; 
    1068     int ic = order.indexOf("C") - 2; 
    1069     int it = order.indexOf("T") - 2; 
    1070     if (iz < 0 || iz > 2 || ic < 0 || ic > 2 || it < 0 || it > 2) { 
    1071       throw new FormatException("Invalid dimension order: " + order); 
    1072     } 
    1073  
    1074     // check SizeZ 
    1075     if (zSize <= 0) throw new FormatException("Invalid Z size: " + zSize); 
    1076     if (z < 0 || z >= zSize) { 
    1077       throw new FormatException("Invalid Z index: " + z + "/" + zSize); 
    1078     } 
    1079  
    1080     // check SizeC 
    1081     if (cSize <= 0) throw new FormatException("Invalid C size: " + cSize); 
    1082     if (c < 0 || c >= cSize) { 
    1083       throw new FormatException("Invalid C index: " + c + "/" + cSize); 
    1084     } 
    1085  
    1086     // check SizeT 
    1087     if (tSize <= 0) throw new FormatException("Invalid T size: " + tSize); 
    1088     if (t < 0 || t >= tSize) { 
    1089       throw new FormatException("Invalid T index: " + t + "/" + tSize); 
    1090     } 
    1091  
    1092     // check image count 
    1093     if (num <= 0) throw new FormatException("Invalid image count: " + num); 
    1094     if (num != zSize * cSize * tSize) { 
    1095       // if this happens, there is probably a bug in metadata population -- 
    1096       // either one of the ZCT sizes, or the total number of images -- 
    1097       // or else the input file is invalid 
    1098       throw new FormatException("ZCT size vs image count mismatch (sizeZ=" + 
    1099         zSize + ", sizeC=" + cSize + ", sizeT=" + tSize + ", total=" + num + 
    1100         ")"); 
    1101     } 
    1102  
    1103     // assign rasterization order 
    1104     int v0 = iz == 0 ? z : (ic == 0 ? c : t); 
    1105     int v1 = iz == 1 ? z : (ic == 1 ? c : t); 
    1106     int v2 = iz == 2 ? z : (ic == 2 ? c : t); 
    1107     int len0 = iz == 0 ? zSize : (ic == 0 ? cSize : tSize); 
    1108     int len1 = iz == 1 ? zSize : (ic == 1 ? cSize : tSize); 
    1109     int len2 = iz == 2 ? zSize : (ic == 2 ? cSize : tSize); 
    1110  
    1111     return v0 + v1 * len0 + v2 * len0 * len1; 
    1112   } 
    1113  
    1114   /** 
    1115    * Gets the Z, C and T coordinates corresponding 
    1116    * to the given rasterized index value. 
    1117    */ 
    1118   public static int[] getZCTCoords(IFormatReader reader, 
    1119     String id, int index) throws FormatException, IOException 
    1120   { 
    1121     String order = reader.getDimensionOrder(id); 
    1122     int zSize = reader.getSizeZ(id); 
    1123     int cSize = reader.getEffectiveSizeC(id); 
    1124     int tSize = reader.getSizeT(id); 
    1125     int num = reader.getImageCount(id); 
    1126     return getZCTCoords(order, zSize, cSize, tSize, num, index); 
    1127   } 
    1128  
    1129   /** 
    1130    * Gets the Z, C and T coordinates corresponding to the given rasterized 
    1131    * index value. 
    1132    */ 
    1133   public static int[] getZCTCoords(String order, 
    1134     int zSize, int cSize, int tSize, int num, int index) 
    1135     throws FormatException, IOException 
    1136   { 
    1137     // check DimensionOrder 
    1138     if (order == null) throw new FormatException("Dimension order is null"); 
    1139     if (!order.startsWith("XY")) { 
    1140       throw new FormatException("Invalid dimension order: " + order); 
    1141     } 
    1142     int iz = order.indexOf("Z") - 2; 
    1143     int ic = order.indexOf("C") - 2; 
    1144     int it = order.indexOf("T") - 2; 
    1145     if (iz < 0 || iz > 2 || ic < 0 || ic > 2 || it < 0 || it > 2) { 
    1146       throw new FormatException("Invalid dimension order: " + order); 
    1147     } 
    1148  
    1149     // check SizeZ 
    1150     if (zSize <= 0) throw new FormatException("Invalid Z size: " + zSize); 
    1151  
    1152     // check SizeC 
    1153     if (cSize <= 0) throw new FormatException("Invalid C size: " + cSize); 
    1154  
    1155     // check SizeT 
    1156     if (tSize <= 0) throw new FormatException("Invalid T size: " + tSize); 
    1157  
    1158     // check image count 
    1159     if (num <= 0) throw new FormatException("Invalid image count: " + num); 
    1160     if (num != zSize * cSize * tSize) { 
    1161       // if this happens, there is probably a bug in metadata population -- 
    1162       // either one of the ZCT sizes, or the total number of images -- 
    1163       // or else the input file is invalid 
    1164       throw new FormatException("ZCT size vs image count mismatch (sizeZ=" + 
    1165         zSize + ", sizeC=" + cSize + ", sizeT=" + tSize + ", total=" + num + 
    1166         ")"); 
    1167     } 
    1168     if (index < 0 || index >= num) { 
    1169       throw new FormatException("Invalid image index: " + index + "/" + num); 
    1170     } 
    1171  
    1172     // assign rasterization order 
    1173     int len0 = iz == 0 ? zSize : (ic == 0 ? cSize : tSize); 
    1174     int len1 = iz == 1 ? zSize : (ic == 1 ? cSize : tSize); 
    1175     //int len2 = iz == 2 ? sizeZ : (ic == 2 ? sizeC : sizeT); 
    1176     int v0 = index % len0; 
    1177     int v1 = index / len0 % len1; 
    1178     int v2 = index / len0 / len1; 
    1179     int z = iz == 0 ? v0 : (iz == 1 ? v1 : v2); 
    1180     int c = ic == 0 ? v0 : (ic == 1 ? v1 : v2); 
    1181     int t = it == 0 ? v0 : (it == 1 ? v1 : v2); 
    1182  
    1183     return new int[] {z, c, t}; 
    1184   } 
    1185  
    1186   /** Returns true if the given file name is in the used files list. */ 
    1187   public boolean isUsedFile(String id, String file) 
    1188     throws FormatException, IOException 
    1189   { 
    1190     String[] usedFiles = getUsedFiles(id); 
    1191     for (int i=0; i<usedFiles.length; i++) { 
    1192       if (usedFiles[i].equals(file) || 
    1193         usedFiles[i].equals(new Location(file).getAbsolutePath())) 
    1194       { 
    1195         return true; 
    1196       } 
    1197     } 
    1198     return false; 
    1199   } 
     645  public static void setDebugLevel(int debugLevel) { 
     646    FormatReader.debugLevel = debugLevel; 
     647  } 
     648 
     649  // -- Helper methods -- 
    1200650 
    1201651  /** 
     
    1203653   * Should be called by each format reader's openImage method. 
    1204654   */ 
    1205   public void updateMinMax(BufferedImage b, int ndx) 
     655  protected void updateMinMax(BufferedImage b, int ndx) 
    1206656    throws FormatException, IOException 
    1207657  { 
     
    1251701   * Should be called by each format reader's openBytes method. 
    1252702   */ 
    1253   public void updateMinMax(byte[] b, int ndx) 
     703  protected void updateMinMax(byte[] b, int ndx) 
    1254704    throws FormatException, IOException 
    1255705  { 
     
    1267717 
    1268718      boolean little = isLittleEndian(currentId); 
    1269       int bytes = getBytesPerPixel(getPixelType(currentId)); 
     719      int bytes = FormatTools.getBytesPerPixel(getPixelType(currentId)); 
    1270720      int numRGB = getRGBChannelCount(currentId); 
    1271721      int pixels = getSizeX(currentId) * getSizeY(currentId); 
     
    1299749  } 
    1300750 
    1301   /** 
    1302    * Takes a string value and maps it to one of the pixel type enumerations. 
    1303    * @param pixelTypeAsString the pixel type as a string. 
    1304    * @return type enumeration value for use with class constants. 
    1305    */ 
    1306   public static int pixelTypeFromString(String pixelTypeAsString) { 
    1307     String lowercaseTypeAsString = pixelTypeAsString.toLowerCase(); 
    1308     for (int i = 0; i < pixelTypes.length; i++) { 
    1309       if (pixelTypes[i].equals(lowercaseTypeAsString)) return i; 
    1310     } 
    1311     throw new RuntimeException("Unknown type: '" + pixelTypeAsString + "'"); 
    1312   } 
    1313  
    1314   /** 
    1315    * Takes a pixel type value and gets a corresponding string representation. 
    1316    * @param pixelType the pixel type. 
    1317    * @return string value for human-readable output. 
    1318    */ 
    1319   public static String getPixelTypeString(int pixelType) { 
    1320     return pixelType < 0 || pixelType >= pixelTypes.length ? 
    1321       "unknown (" + pixelType + ")" : pixelTypes[pixelType]; 
    1322   } 
    1323  
    1324   /** 
    1325    * Retrieves how many bytes per pixel the current plane or section has. 
    1326    * @param type the pixel type as retrieved from 
    1327    *   {@link IFormatReader#getPixelType(String)}. 
    1328    * @return the number of bytes per pixel. 
    1329    * @see IFormatReader#getPixelType(String) 
    1330    */ 
    1331   public static int getBytesPerPixel(int type) { 
    1332     switch (type) { 
    1333       case FormatReader.INT8: 
    1334       case FormatReader.UINT8: 
    1335         return 1; 
    1336       case FormatReader.INT16: 
    1337       case FormatReader.UINT16: 
    1338         return 2; 
    1339       case FormatReader.INT32: 
    1340       case FormatReader.UINT32: 
    1341       case FormatReader.FLOAT: 
    1342         return 4; 
    1343       case FormatReader.DOUBLE: 
    1344         return 8; 
    1345     } 
    1346     throw new RuntimeException("Unknown type with id: '" + type + "'"); 
    1347   } 
    1348  
    1349   /** Toggles debug mode (more verbose output and error messages). */ 
    1350   public static void setDebug(boolean debug) { 
    1351     FormatReader.debug = debug; 
    1352   } 
    1353  
    1354   /** 
    1355    * Toggles debug mode verbosity (which kinds of output are produced). 
    1356    * @param debugLevel 1=basic, 2=extended, 3=everything. 
    1357    */ 
    1358   public static void setDebugLevel(int debugLevel) { 
    1359     FormatReader.debugLevel = debugLevel; 
    1360   } 
     751  /** Returns true if the given file name is in the used files list. */ 
     752  protected boolean isUsedFile(String id, String file) 
     753    throws FormatException, IOException 
     754  { 
     755    String[] usedFiles = getUsedFiles(id); 
     756    for (int i=0; i<usedFiles.length; i++) { 
     757      if (usedFiles[i].equals(file) || 
     758        usedFiles[i].equals(new Location(file).getAbsolutePath())) 
     759      { 
     760        return true; 
     761      } 
     762    } 
     763    return false; 
     764  } 
     765 
    1361766} 
  • trunk/loci/formats/FormatWriter.java

    r2320 r2430  
    9999  /* @see IFormatWriter#getPixelTypes(String) */ 
    100100  public int[] getPixelTypes(String id) throws FormatException, IOException { 
    101     return new int[] {FormatReader.UINT8, FormatReader.UINT16, 
    102       FormatReader.UINT32, FormatReader.FLOAT}; 
     101    return new int[] {FormatTools.UINT8, FormatTools.UINT16, 
     102      FormatTools.UINT32, FormatTools.FLOAT}; 
    103103  } 
    104104 
  • trunk/loci/formats/ImageReader.java

    r2320 r2430  
    512512      } 
    513513    } 
    514     return FormatReader.testRead(this, args); 
     514    return FormatTools.testRead(this, args); 
    515515  } 
    516516 
  • trunk/loci/formats/ImageTools.java

    r2390 r2430  
    602602    DataBuffer buffer = null; 
    603603    switch (type) { 
    604       case FormatReader.INT8: 
    605       case FormatReader.UINT8: 
     604      case FormatTools.INT8: 
     605      case FormatTools.UINT8: 
    606606        tt = DataBuffer.TYPE_BYTE; 
    607607        buffer = new DataBufferByte(new byte[c * w * h], c * w * h); 
    608608        break; 
    609       case FormatReader.INT16: 
    610       case FormatReader.UINT16: 
     609      case FormatTools.INT16: 
     610      case FormatTools.UINT16: 
    611611        tt = DataBuffer.TYPE_USHORT; 
    612612        buffer = new DataBufferUShort(new short[c * w * h], c * w * h); 
    613613        break; 
    614       case FormatReader.INT32: 
    615       case FormatReader.UINT32: 
     614      case FormatTools.INT32: 
     615      case FormatTools.UINT32: 
    616616        tt = DataBuffer.TYPE_INT; 
    617617        buffer = new DataBufferInt(new int[c * w * h], c * w * h); 
    618618        break; 
    619       case FormatReader.FLOAT: 
     619      case FormatTools.FLOAT: 
    620620        tt = DataBuffer.TYPE_FLOAT; 
    621621        buffer = new DataBufferFloat(new float[c * w * h], c * w * h); 
    622622        break; 
    623       case FormatReader.DOUBLE: 
     623      case FormatTools.DOUBLE: 
    624624        tt = DataBuffer.TYPE_DOUBLE; 
    625625        buffer = new DataBufferDouble(new double[c * w * h], c * w * h); 
     
    848848    switch (type) { 
    849849      case DataBuffer.TYPE_BYTE: 
    850         return FormatReader.UINT8; 
     850        return FormatTools.UINT8; 
    851851      case DataBuffer.TYPE_DOUBLE: 
    852         return FormatReader.DOUBLE; 
     852        return FormatTools.DOUBLE; 
    853853      case DataBuffer.TYPE_FLOAT: 
    854         return FormatReader.FLOAT; 
     854        return FormatTools.FLOAT; 
    855855      case DataBuffer.TYPE_INT: 
    856         return FormatReader.INT32; 
     856        return FormatTools.INT32; 
    857857      case DataBuffer.TYPE_SHORT: 
    858         return FormatReader.INT16; 
     858        return FormatTools.INT16; 
    859859      case DataBuffer.TYPE_USHORT: 
    860         return FormatReader.UINT16; 
     860        return FormatTools.UINT16; 
    861861      default: 
    862862        return -1; 
  • trunk/loci/formats/ImageViewer.java

    r2339 r2430  
    475475        sb.append("; type="); 
    476476        int pixelType = ImageTools.getPixelType(image); 
    477         sb.append(FormatReader.getPixelTypeString(pixelType)); 
     477        sb.append(FormatTools.getPixelTypeString(pixelType)); 
    478478      } 
    479479    } 
  • trunk/loci/formats/in/AVIReader.java

    r2418 r2430  
    522522    int bytesPerPixel = bitsPerPixel / 8; 
    523523 
    524     if (bitsPerPixel == 8) pixelType[0] = FormatReader.UINT8; 
    525     else if (bitsPerPixel == 16) pixelType[0] = FormatReader.UINT16; 
    526     else if (bitsPerPixel == 32) pixelType[0] = FormatReader.UINT32; 
    527     else if (bitsPerPixel == 24) pixelType[0] = FormatReader.UINT8; 
     524    if (bitsPerPixel == 8) pixelType[0] = FormatTools.UINT8; 
     525    else if (bitsPerPixel == 16) pixelType[0] = FormatTools.UINT16; 
     526    else if (bitsPerPixel == 32) pixelType[0] = FormatTools.UINT32; 
     527    else if (bitsPerPixel == 24) pixelType[0] = FormatTools.UINT8; 
    528528    else 
    529529      throw new FormatException( 
  • trunk/loci/formats/in/AliconaReader.java

    r2418 r2430  
    208208    sizeT[0] = numImages / sizeC[0]; 
    209209 
    210     pixelType[0] = numBytes == 2 ? FormatReader.UINT16 : FormatReader.UINT8; 
     210    pixelType[0] = numBytes == 2 ? FormatTools.UINT16 : FormatTools.UINT8; 
    211211    currentOrder[0] = "XYCTZ"; 
    212212 
  • trunk/loci/formats/in/BMPReader.java

    r2418 r2430  
    294294    switch (tbpp) { 
    295295      case 8: 
    296         pixType = FormatReader.UINT8; 
     296        pixType = FormatTools.UINT8; 
    297297        break; 
    298298      case 16: 
    299         pixType = FormatReader.UINT16; 
     299        pixType = FormatTools.UINT16; 
    300300        break; 
    301301      case 32: 
    302         pixType = FormatReader.UINT32; 
     302        pixType = FormatTools.UINT32; 
    303303        break; 
    304304    } 
  • trunk/loci/formats/in/BaseTiffReader.java

    r2418 r2430  
    472472    if (bps == 24 || bps == 48) bps /= 3; 
    473473 
    474     if (bitFormat == 3) pixelType[0] = FormatReader.FLOAT; 
     474    if (bitFormat == 3) pixelType[0] = FormatTools.FLOAT; 
    475475    else if (bitFormat == 2) { 
    476476      switch (bps) { 
    477477        case 8: 
    478           pixelType[0] = FormatReader.UINT8; 
     478          pixelType[0] = FormatTools.UINT8; 
    479479          break; 
    480480        case 16: 
    481           pixelType[0] = FormatReader.INT16; 
     481          pixelType[0] = FormatTools.INT16; 
    482482          break; 
    483483        case 32: 
    484           pixelType[0] = FormatReader.INT32; 
     484          pixelType[0] = FormatTools.INT32; 
    485485          break; 
    486486        default: 
    487           pixelType[0] = FormatReader.UINT8; 
     487          pixelType[0] = FormatTools.UINT8; 
    488488      } 
    489489    } 
     
    491491      switch (bps) { 
    492492        case 8: 
    493           pixelType[0] = FormatReader.UINT8; 
     493          pixelType[0] = FormatTools.UINT8; 
    494494          break; 
    495495        case 16: 
    496           pixelType[0] = FormatReader.UINT16; 
     496          pixelType[0] = FormatTools.UINT16; 
    497497          break; 
    498498        case 32: 
    499           pixelType[0] = FormatReader.UINT32; 
     499          pixelType[0] = FormatTools.UINT32; 
    500500          break; 
    501501        default: 
    502           pixelType[0] = FormatReader.UINT8; 
     502          pixelType[0] = FormatTools.UINT8; 
    503503      } 
    504504    } 
     
    732732    } 
    733733 
    734     int bytesPerPixel = FormatReader.getBytesPerPixel(getPixelType(id)); 
     734    int bytesPerPixel = FormatTools.getBytesPerPixel(getPixelType(id)); 
    735735    byte[] buf = new byte[getSizeX(id) * getSizeY(id) * bytesPerPixel * 
    736736      getRGBChannelCount(id)]; 
  • trunk/loci/formats/in/BioRadReader.java

    r2418 r2430  
    644644    int type = in.readShort(); 
    645645    if (type == 1) 
    646       pixelType[0] = FormatReader.UINT8; 
     646      pixelType[0] = FormatTools.UINT8; 
    647647    else 
    648       pixelType[0] = FormatReader.UINT16; 
     648      pixelType[0] = FormatTools.UINT16; 
    649649 
    650650    String dimOrder = "XY"; 
  • trunk/loci/formats/in/DeltavisionReader.java

    r2418 r2430  
    272272      case 0: 
    273273        pixel = "8 bit unsigned integer"; 
    274         pixelType[0] = FormatReader.UINT8; 
     274        pixelType[0] = FormatTools.UINT8; 
    275275        bytesPerPixel = 1; 
    276276        break; 
    277277      case 1: 
    278278        pixel = "16 bit signed integer"; 
    279         pixelType[0] = FormatReader.UINT16; 
     279        pixelType[0] = FormatTools.UINT16; 
    280280        bytesPerPixel = 2; 
    281281        break; 
    282282      case 2: 
    283283        pixel = "32 bit floating point"; 
    284         pixelType[0] = FormatReader.FLOAT; 
     284        pixelType[0] = FormatTools.FLOAT; 
    285285        bytesPerPixel = 4; 
    286286        break; 
    287287      case 3: 
    288288        pixel = "32 bit complex"; 
    289         pixelType[0] = FormatReader.UINT32; 
     289        pixelType[0] = FormatTools.UINT32; 
    290290        bytesPerPixel = 4; 
    291291        break; 
    292292      case 4: 
    293293        pixel = "64 bit complex"; 
    294         pixelType[0] = FormatReader.FLOAT; 
     294        pixelType[0] = FormatTools.FLOAT; 
    295295        bytesPerPixel = 8; 
    296296        break; 
    297297      case 6: 
    298298        pixel = "16 bit unsigned integer"; 
    299         pixelType[0] = FormatReader.UINT16; 
     299        pixelType[0] = FormatTools.UINT16; 
    300300        bytesPerPixel = 2; 
    301301        break; 
    302302      default: 
    303303        pixel = "unknown"; 
    304         pixelType[0] = FormatReader.UINT8; 
     304        pixelType[0] = FormatTools.UINT8; 
    305305        bytesPerPixel = 1; 
    306306    } 
  • trunk/loci/formats/in/DicomReader.java

    r2418 r2430  
    342342    switch (bitsPerPixel) { 
    343343      case 8: 
    344         pixelType[0] = FormatReader.UINT8; 
     344        pixelType[0] = FormatTools.UINT8; 
    345345        break; 
    346346      case 16: 
    347         pixelType[0] = FormatReader.UINT16; 
     347        pixelType[0] = FormatTools.UINT16; 
    348348        break; 
    349349      case 32: 
    350         pixelType[0] = FormatReader.UINT32; 
     350        pixelType[0] = FormatTools.UINT32; 
    351351        break; 
    352352    } 
  • trunk/loci/formats/in/EPSReader.java

    r2418 r2430  
    269269    MetadataStore store = getMetadataStore(id); 
    270270 
    271     pixelType[0] = FormatReader.UINT8; 
     271    pixelType[0] = FormatTools.UINT8; 
    272272    store.setPixels( 
    273273      new Integer(width), 
  • trunk/loci/formats/in/GIFReader.java

    r2418 r2430  
    402402    MetadataStore store = getMetadataStore(id); 
    403403 
    404     pixelType[0] = FormatReader.UINT8; 
     404    pixelType[0] = FormatTools.UINT8; 
    405405    store.setPixels( 
    406406      new Integer(width), 
  • trunk/loci/formats/in/GatanReader.java

    r2418 r2430  
    208208    int datatype = Integer.parseInt((String) getMeta("DataType")); 
    209209 
    210     pixelType[0] = FormatReader.INT8; 
     210    pixelType[0] = FormatTools.INT8; 
    211211    switch (datatype) { 
    212212      case 1: 
    213         pixelType[0] = FormatReader.UINT16; 
     213        pixelType[0] = FormatTools.UINT16; 
    214214        break; 
    215215      case 2: 
    216         pixelType[0] = FormatReader.FLOAT; 
     216        pixelType[0] = FormatTools.FLOAT; 
    217217        break; 
    218218      case 3: 
    219         pixelType[0] = FormatReader.FLOAT; 
     219        pixelType[0] = FormatTools.FLOAT; 
    220220        break; 
    221221      // there is no case 4 
    222222      case 5: 
    223         pixelType[0] = FormatReader.FLOAT; 
     223        pixelType[0] = FormatTools.FLOAT; 
    224224        break; 
    225225      case 6: 
    226         pixelType[0] = FormatReader.UINT8; 
     226        pixelType[0] = FormatTools.UINT8; 
    227227        break; 
    228228      case 7: 
    229         pixelType[0] = FormatReader.INT32; 
     229        pixelType[0] = FormatTools.INT32; 
    230230        break; 
    231231      case 8: 
    232         pixelType[0] = FormatReader.UINT32; 
     232        pixelType[0] = FormatTools.UINT32; 
    233233        break; 
    234234      case 9: 
    235         pixelType[0] = FormatReader.INT8; 
     235        pixelType[0] = FormatTools.INT8; 
    236236        break; 
    237237      case 10: 
    238         pixelType[0] = FormatReader.UINT16; 
     238        pixelType[0] = FormatTools.UINT16; 
    239239        break; 
    240240      case 11: 
    241         pixelType[0] = FormatReader.UINT32; 
     241        pixelType[0] = FormatTools.UINT32; 
    242242        break; 
    243243      case 12: 
    244         pixelType[0] = FormatReader.FLOAT; 
     244        pixelType[0] = FormatTools.FLOAT; 
    245245        break; 
    246246      case 13: 
    247         pixelType[0] = FormatReader.FLOAT; 
     247        pixelType[0] = FormatTools.FLOAT; 
    248248        break; 
    249249      case 14: 
    250         pixelType[0] = FormatReader.UINT8; 
     250        pixelType[0] = FormatTools.UINT8; 
    251251        break; 
    252252      case 23: 
    253         pixelType[0] = FormatReader.INT32; 
     253        pixelType[0] = FormatTools.INT32; 
    254254        break; 
    255255    } 
  • trunk/loci/formats/in/ICSReader.java

    r2418 r2430  
    4343 
    4444  /** Metadata field categories. */ 
    45   private String[] CATEGORIES = new String[] { 
     45  private static final String[] CATEGORIES = new String[] { 
    4646    "ics_version", "filename", "source", "layout", "representation", 
    4747    "parameter", "sensor", "history", "end" 
     
    4949 
    5050  /** Metadata field subcategories. */ 
    51   private String[] SUB_CATEGORIES = new String[] { 
     51  private static final String[] SUB_CATEGORIES = new String[] { 
    5252    "file", "offset", "parameters", "order", "sizes", "coordinates", 
    5353    "significant_bits", "format", "sign", "compression", "byte_order", 
     
    5757 
    5858  /** Metadata field sub-subcategories. */ 
    59   private String[] SUB_SUB_CATEGORIES = new String[] { 
     59  private static final String[] SUB_SUB_CATEGORIES = new String[] { 
    6060    "Channels", "PinholeRadius", "LambdaEx", "LambdaEm", "ExPhotonCnt", 
    6161    "RefInxMedium", "NumAperture", "RefInxLensMedium", "PinholeSpacing" 
     
    460460    if (bitsPerPixel < 32) littleEndian = !littleEndian; 
    461461 
    462     if (fmt.equals("real")) pixelType[0] = FormatReader.FLOAT; 
     462    if (fmt.equals("real")) pixelType[0] = FormatTools.FLOAT; 
    463463    else if (fmt.equals("integer")) { 
    464464      while (bitsPerPixel % 8 != 0) bitsPerPixel++; 
     
    467467      switch (bitsPerPixel) { 
    468468        case 8: 
    469           pixelType[0] = FormatReader.UINT8; 
     469          pixelType[0] = FormatTools.UINT8; 
    470470          break; 
    471471        case 16: 
    472           pixelType[0] = FormatReader.UINT16; 
     472          pixelType[0] = FormatTools.UINT16; 
    473473          break; 
    474474        case 32: 
    475           pixelType[0] = FormatReader.UINT32; 
     475          pixelType[0] = FormatTools.UINT32; 
    476476          break; 
    477477      } 
  • trunk/loci/formats/in/IPLabReader.java

    r2418 r2430  
    220220      case 0: 
    221221        ptype = "8 bit unsigned"; 
    222         pixelType[0] = FormatReader.UINT8; 
     222        pixelType[0] = FormatTools.UINT8; 
    223223        bps = 1; 
    224224        break; 
    225225      case 1: 
    226226        ptype = "16 bit signed short"; 
    227         pixelType[0] = FormatReader.INT16; 
     227        pixelType[0] = FormatTools.INT16; 
    228228        bps = 2; 
    229229        break; 
    230230      case 2: 
    231231        ptype = "16 bit unsigned short"; 
    232         pixelType[0] = FormatReader.UINT16; 
     232        pixelType[0] = FormatTools.UINT16; 
    233233        bps = 2; 
    234234        break; 
    235235      case 3: 
    236236        ptype = "32 bit signed long"; 
    237         pixelType[0] = FormatReader.INT32; 
     237        pixelType[0] = FormatTools.INT32; 
    238238        bps = 4; 
    239239        break; 
    240240      case 4: 
    241241        ptype = "32 bit single-precision float"; 
    242         pixelType[0] = FormatReader.FLOAT; 
     242        pixelType[0] = FormatTools.FLOAT; 
    243243        bps = 4; 
    244244        break; 
    245245      case 5: 
    246246        ptype = "Color24"; 
    247         pixelType[0] = FormatReader.INT32; 
     247        pixelType[0] = FormatTools.INT32; 
    248248        bps = 1; 
    249249        break; 
    250250      case 6: 
    251251        ptype = "Color48"; 
    252         pixelType[0] = FormatReader.INT32; 
     252        pixelType[0] = FormatTools.INT32; 
    253253        bps = 2; 
    254254        break; 
    255255      case 10: 
    256256        ptype = "64 bit double-precision float"; 
    257         pixelType[0] = FormatReader.DOUBLE; 
     257        pixelType[0] = FormatTools.DOUBLE; 
    258258        bps = 8; 
    259259        break; 
  • trunk/loci/formats/in/IPWReader.java

    r2418 r2430  
    114114    if (c == 2) c++; 
    115115    byte[] buf = new byte[sizeX[0] * sizeY[0] * c * 
    116       FormatReader.getBytesPerPixel(pixelType[0])]; 
     116      FormatTools.getBytesPerPixel(pixelType[0])]; 
    117117    return openBytes(id, no, buf); 
    118118  } 
     
    370370    if (bitsPerSample == 24 || bitsPerSample == 48) bitsPerSample /= 3; 
    371371 
    372     pixelType[0] = FormatReader.UINT8; 
    373  
    374     if (bitFormat == 3) pixelType[0] = FormatReader.FLOAT; 
     372    pixelType[0] = FormatTools.UINT8; 
     373 
     374    if (bitFormat == 3) pixelType[0] = FormatTools.FLOAT; 
    375375    else if (bitFormat == 2) { 
    376376      switch (bitsPerSample) { 
    377377        case 8: 
    378           pixelType[0] = FormatReader.INT8; 
     378          pixelType[0] = FormatTools.INT8; 
    379379          break; 
    380380        case 16: 
    381           pixelType[0] = FormatReader.INT16; 
     381          pixelType[0] = FormatTools.INT16; 
    382382          break; 
    383383        case 32: 
    384           pixelType[0] = FormatReader.INT32; 
     384          pixelType[0] = FormatTools.INT32; 
    385385          break; 
    386386      } 
     
    389389      switch (bitsPerSample) { 
    390390        case 8: 
    391           pixelType[0] = FormatReader.UINT8; 
     391          pixelType[0] = FormatTools.UINT8; 
    392392          break; 
    393393        case 16: 
    394           pixelType[0] = FormatReader.UINT16; 
     394          pixelType[0] = FormatTools.UINT16; 
    395395          break; 
    396396        case 32: 
    397           pixelType[0] = FormatReader.UINT32; 
     397          pixelType[0] = FormatTools.UINT32; 
    398398          break; 
    399399      } 
  • trunk/loci/formats/in/ImarisReader.java

    r2418 r2430  
    136136    MetadataStore store = getMetadataStore(id); 
    137137 
    138     pixelType[0] = FormatReader.UINT8; 
     138    pixelType[0] = FormatTools.UINT8; 
    139139    store.setPixels( 
    140140      new Integer(dims[0]), 
  • trunk/loci/formats/in/ImarisTiffReader.java

    r2178 r2430  
    173173    if (bitsPerSample == 24 || bitsPerSample == 48) bitsPerSample /= 3; 
    174174 
    175     if (bitFormat == 3) pixelType[0] = FormatReader.FLOAT; 
     175    if (bitFormat == 3) pixelType[0] = FormatTools.FLOAT; 
    176176    else if (bitFormat == 2) { 
    177177      switch (bitsPerSample) { 
    178178        case 8: 
    179           pixelType[0] = FormatReader.INT8; 
     179          pixelType[0] = FormatTools.INT8; 
    180180          break; 
    181181        case 16: 
    182           pixelType[0] = FormatReader.INT16; 
     182          pixelType[0] = FormatTools.INT16; 
    183183          break; 
    184184        case 32: 
    185           pixelType[0] = FormatReader.INT32; 
     185          pixelType[0] = FormatTools.INT32; 
    186186          break; 
    187187      } 
     
    190190      switch (bitsPerSample) { 
    191191        case 8: 
    192           pixelType[0] = FormatReader.UINT8; 
     192          pixelType[0] = FormatTools.UINT8; 
    193193          break; 
    194194        case 16: 
    195           pixelType[0] = FormatReader.UINT16; 
     195          pixelType[0] = FormatTools.UINT16; 
    196196          break; 
    197197        case 32: 
    198           pixelType[0] = FormatReader.UINT32; 
     198          pixelType[0] = FormatTools.UINT32; 
    199199          break; 
    200200      } 
  • trunk/loci/formats/in/LIFReader.java

    r2420 r2430  
    543543      switch (dims[i][5]) { 
    544544        case 8: 
    545           pixelType[i] = FormatReader.UINT8; 
     545          pixelType[i] = FormatTools.UINT8; 
    546546          break; 
    547547        case 16: 
    548           pixelType[i] = FormatReader.UINT16; 
     548          pixelType[i] = FormatTools.UINT16; 
    549549          break; 
    550550        case 32: 
    551           pixelType[i] = FormatReader.FLOAT; 
     551          pixelType[i] = FormatTools.FLOAT; 
    552552          break; 
    553553      } 
  • trunk/loci/formats/in/LegacyPictReader.java

    r2320 r2430  
    119119    sizeC[0] = img.getRaster().getNumBands(); 
    120120    sizeT[0] = 1; 
    121     pixelType[0] = FormatReader.INT8; 
     121    pixelType[0] = FormatTools.INT8; 
    122122    currentOrder[0] = "XYCZT"; 
    123123 
  • trunk/loci/formats/in/LegacyZVIReader.java

    r2418 r2430  
    344344        case 1: 
    345345          type = "8 bit rgb tuple, 24 bpp"; 
    346           pixelType[0] = FormatReader.INT8; 
     346          pixelType[0] = FormatTools.INT8; 
    347347          break; 
    348348        case 2: 
    349349          type = "8 bit rgb quad, 32 bpp"; 
    350           pixelType[0] = FormatReader.INT8; 
     350          pixelType[0] = FormatTools.INT8; 
    351351          break; 
    352352        case 3: 
    353353          type = "8 bit grayscale"; 
    354           pixelType[0] = FormatReader.INT8; 
     354          pixelType[0] = FormatTools.INT8; 
    355355          break; 
    356356        case 4: 
    357357          type = "16 bit signed int, 16 bpp"; 
    358           pixelType[0] = FormatReader.INT16; 
     358          pixelType[0] = FormatTools.INT16; 
    359359          break; 
    360360        case 5: 
    361361          type = "32 bit int, 32 bpp"; 
    362           pixelType[0] = FormatReader.INT32; 
     362          pixelType[0] = FormatTools.INT32; 
    363363          break; 
    364364        case 6: 
    365365          type = "32 bit float, 32 bpp"; 
    366           pixelType[0] = FormatReader.FLOAT; 
     366          pixelType[0] = FormatTools.FLOAT; 
    367367          break; 
    368368        case 7: 
    369369          type = "64 bit float, 64 bpp"; 
    370           pixelType[0] = FormatReader.DOUBLE; 
     370          pixelType[0] = FormatTools.DOUBLE; 
    371371          break; 
    372372        case 8: 
    373373          type = "16 bit unsigned short triple, 48 bpp"; 
    374           pixelType[0] = FormatReader.INT16; 
     374          pixelType[0] = FormatTools.INT16; 
    375375          break; 
    376376        case 9: 
    377377          type = "32 bit int triple, 96 bpp"; 
    378           pixelType[0] = FormatReader.INT32; 
     378          pixelType[0] = FormatTools.INT32; 
    379379          break; 
    380380        default: 
  • trunk/loci/formats/in/LeicaReader.java

    r2421 r2430  
    11141114      switch (tPixelType) { 
    11151115        case 1: 
    1116           pixelType[i] = FormatReader.UINT8; 
     1116          pixelType[i] = FormatTools.UINT8; 
    11171117          break; 
    11181118        case 2: 
    1119           pixelType[i] = FormatReader.UINT16; 
     1119          pixelType[i] = FormatTools.UINT16; 
    11201120          break; 
    11211121        case 3: 
    1122           pixelType[i] = FormatReader.UINT8; 
     1122          pixelType[i] = FormatTools.UINT8; 
    11231123          break; 
    11241124        case 4: 
    1125           pixelType[i] = FormatReader.INT32; 
     1125          pixelType[i] = FormatTools.INT32; 
    11261126          break; 
    11271127        case 6: 
    1128           pixelType[i] = FormatReader.INT16; 
     1128          pixelType[i] = FormatTools.INT16; 
    11291129          break; 
    11301130        case 8: 
    1131           pixelType[i] = FormatReader.DOUBLE; 
     1131          pixelType[i] = FormatTools.DOUBLE; 
    11321132          break; 
    11331133      } 
  • trunk/loci/formats/in/MNGReader.java

    r2320 r2430  
    218218    sizeT[0] = numImages; 
    219219    currentOrder[0] = "XYCZT"; 
    220     pixelType[0] = FormatReader.UINT8; 
     220    pixelType[0] = FormatTools.UINT8; 
    221221 
    222222    MetadataStore store = getMetadataStore(id); 
  • trunk/loci/formats/in/MRCReader.java

    r2418 r2430  
    192192      case 0: 
    193193        bpp = 1; 
    194         pixelType[0] = FormatReader.UINT8; 
     194        pixelType[0] = FormatTools.UINT8; 
    195195        break; 
    196196      case 1: 
    197197        bpp = 2; 
    198         pixelType[0] = FormatReader.UINT16; 
     198        pixelType[0] = FormatTools.UINT16; 
    199199        break; 
    200200      case 2: 
    201201        bpp = 4; 
    202202        isFloat = true; 
    203         pixelType[0] = FormatReader.FLOAT; 
     203        pixelType[0] = FormatTools.FLOAT; 
    204204        break; 
    205205      case 3: 
    206206        bpp = 4; 
    207         pixelType[0] = FormatReader.UINT32; 
     207        pixelType[0] = FormatTools.UINT32; 
    208208        break; 
    209209      case 4: 
    210210        bpp = 8; 
    211211        isFloat = true; 
    212         pixelType[0] = FormatReader.DOUBLE; 
     212        pixelType[0] = FormatTools.DOUBLE; 
    213213        break; 
    214214      case 6: 
    215215        bpp = 2; 
    216         pixelType[0] = FormatReader.UINT16; 
     216        pixelType[0] = FormatTools.UINT16; 
    217217        break; 
    218218      case 16: 
    219219        bpp = 2; 
    220220        sizeC[0] = 3; 
    221         pixelType[0] = FormatReader.UINT16; 
     221        pixelType[0] = FormatTools.UINT16; 
    222222        break; 
    223223    } 
  • trunk/loci/formats/in/ND2Reader.java

    r2418 r2430  
    229229    int dataType = 0; 
    230230    switch (pixelType[0]) { 
    231       case FormatReader.INT8: 
     231      case FormatTools.INT8: 
    232232        throw new FormatException("Unsupported pixel type: int8"); 
    233       case FormatReader.UINT8: 
     233      case FormatTools.UINT8: 
    234234        dataType = DataBuffer.TYPE_BYTE; 
    235235        break; 
    236       case FormatReader.INT16: 
     236      case FormatTools.INT16: 
    237237        dataType = DataBuffer.TYPE_SHORT; 
    238238        break; 
    239       case FormatReader.UINT16: 
     239      case FormatTools.UINT16: 
    240240        dataType = DataBuffer.TYPE_USHORT; 
    241241        break; 
    242       case FormatReader.INT32: 
    243       case FormatReader.UINT32: 
     242      case FormatTools.INT32: 
     243      case FormatTools.UINT32: 
    244244        dataType = DataBuffer.TYPE_INT; 
    245245        break; 
    246       case FormatReader.FLOAT: 
     246      case FormatTools.FLOAT: 
    247247        dataType = DataBuffer.TYPE_FLOAT; 
    248248        break; 
    249       case FormatReader.DOUBLE: 
     249      case FormatTools.DOUBLE: 
    250250        dataType = DataBuffer.TYPE_DOUBLE; 
    251251        break; 
     
    304304    numImages = offsets.length; 
    305305 
    306     pixelType[0] = FormatReader.UINT8; 
     306    pixelType[0] = FormatTools.UINT8; 
    307307 
    308308    // read XML metadata from the end of the file 
     
    544544    else validBits = null; 
    545545 
    546     if (validBits == null) pixelType[0] = FormatReader.UINT8; 
     546    if (validBits == null) pixelType[0] = FormatTools.UINT8; 
    547547    else { 
    548548      int bpp = validBits[0]; 
     
    550550      switch (bpp) { 
    551551        case 8: 
    552           pixelType[0] = FormatReader.UINT8; 
     552          pixelType[0] = FormatTools.UINT8; 
    553553          break; 
    554554        case 16: 
    555           pixelType[0] = FormatReader.UINT16; 
     555          pixelType[0] = FormatTools.UINT16; 
    556556          break; 
    557557        case 32: 
    558           pixelType[0] = FormatReader.UINT32; 
     558          pixelType[0] = FormatTools.UINT32; 
    559559          break; 
    560560        default: 
  • trunk/loci/formats/in/OIBReader.java

    r2418 r2430  
    196196    byte[] buf = new byte[sizeX[series] * sizeY[series] * 
    197197      getRGBChannelCount(id) * 
    198       FormatReader.getBytesPerPixel(pixelType[series])]; 
     198      FormatTools.getBytesPerPixel(pixelType[series])]; 
    199199    return openBytes(id, no, buf); 
    200200  } 
     
    498498        case 0: 
    499499        case 1: 
    500           pixelType[i] = FormatReader.UINT8; 
     500          pixelType[i] = FormatTools.UINT8; 
    501501          break; 
    502502        case 2: 
    503           pixelType[i] = FormatReader.UINT16; 
     503          pixelType[i] = FormatTools.UINT16; 
    504504          break; 
    505505        case 4: 
    506           pixelType[i] = FormatReader.UINT32; 
     506          pixelType[i] = FormatTools.UINT32; 
    507507          break; 
    508508        default: 
  • trunk/loci/formats/in/OIFReader.java

    r2418 r2430  
    422422    switch (imageDepth) { 
    423423      case 1: 
    424         pixelType[0] = FormatReader.UINT8; 
     424        pixelType[0] = FormatTools.UINT8; 
    425425        break; 
    426426      case 2: 
    427         pixelType[0] = FormatReader.UINT16; 
     427        pixelType[0] = FormatTools.UINT16; 
    428428        break; 
    429429      case 4: 
    430         pixelType[0] = FormatReader.UINT32; 
     430        pixelType[0] = FormatTools.UINT32; 
    431431        break; 
    432432      default: 
  • trunk/loci/formats/in/OMEXMLReader.java

    r2327 r2430  
    420420      if (type.endsWith("16")) { 
    421421        bpp[i] = 2; 
    422         pixelType[i] = FormatReader.UINT16; 
     422        pixelType[i] = FormatTools.UINT16; 
    423423      } 
    424424      else if (type.endsWith("32")) { 
    425425        bpp[i] = 4; 
    426         pixelType[i] = FormatReader.UINT32; 
     426        pixelType[i] = FormatTools.UINT32; 
    427427      } 
    428428      else if (type.equals("float")) { 
    429429        bpp[i] = 4; 
    430         pixelType[i] = FormatReader.FLOAT; 
     430        pixelType[i] = FormatTools.FLOAT; 
    431431      } 
    432432      else { 
    433433        bpp[i] = 1; 
    434         pixelType[i] = FormatReader.UINT8; 
     434        pixelType[i] = FormatTools.UINT8; 
    435435      } 
    436436 
  • trunk/loci/formats/in/OpenlabRawReader.java

    r2418 r2430  
    217217    switch (bytesPerPixel) { 
    218218      case 1: 
    219         pixelType[0] = FormatReader.UINT8; 
     219        pixelType[0] = FormatTools.UINT8; 
    220220        break; 
    221221      case 2: 
    222         pixelType[0] = FormatReader.UINT16; 
     222        pixelType[0] = FormatTools.UINT16; 
    223223        break; 
    224224      case 3: 
    225         pixelType[0] = FormatReader.INT8; 
     225        pixelType[0] = FormatTools.INT8; 
    226226        break; 
    227227      default: 
    228         pixelType[0] = FormatReader.FLOAT; 
     228        pixelType[0] = FormatTools.FLOAT; 
    229229    } 
    230230 
  • trunk/loci/formats/in/OpenlabReader.java

    r2323 r2430  
    725725      switch (bpp[i]) { 
    726726        case 1: 
    727           pixelType[i] = FormatReader.INT8; 
     727          pixelType[i] = FormatTools.INT8; 
    728728          break; 
    729729        case 2: 
    730           pixelType[i] = FormatReader.UINT16; 
     730          pixelType[i] = FormatTools.UINT16; 
    731731          break; 
    732732        case 3: 
    733           pixelType[i] = FormatReader.UINT8; 
     733          pixelType[i] = FormatTools.UINT8; 
    734734          break; 
    735735        case 4: 
    736           pixelType[i] = FormatReader.INT32; 
     736          pixelType[i] = FormatTools.INT32; 
    737737          break; 
    738738        case 6: 
    739           pixelType[i] = FormatReader.INT16; 
     739          pixelType[i] = FormatTools.INT16; 
    740740          break; 
    741741      } 
  • trunk/loci/formats/in/PerkinElmerReader.java

    r2418 r2430  
    546546      switch (bpp) { 
    547547        case 1: 
    548           pixelType[0] = FormatReader.INT8; 
     548          pixelType[0] = FormatTools.INT8; 
    549549          break; 
    550550        case 2: 
    551           pixelType[0] = FormatReader.UINT16; 
     551          pixelType[0] = FormatTools.UINT16; 
    552552          break; 
    553553        case 3: 
    554           pixelType[0] = FormatReader.INT8; 
     554          pixelType[0] = FormatTools.INT8; 
    555555          break; 
    556556        case 4: 
    557           pixelType[0] = FormatReader.INT32; 
     557          pixelType[0] = FormatTools.INT32; 
    558558          break; 
    559559      } 
  • trunk/loci/formats/in/PictReader.java

    r2307 r2430  
    218218    MetadataStore store = getMetadataStore(id); 
    219219 
    220     pixelType[0] = FormatReader.UINT8; 
     220    pixelType[0] = FormatTools.UINT8; 
    221221    store.setPixels( 
    222222      new Integer(d.width), new Integer(d.height), 
  • trunk/loci/formats/in/PrairieReader.java

    r2418 r2430  
    327327        sizeC[0] = numImages / (sizeZ[0] * sizeT[0]); 
    328328        currentOrder[0] = "XYC" + (isZ ? "ZT" : "TZ"); 
    329         pixelType[0] = FormatReader.UINT16; 
     329        pixelType[0] = FormatTools.UINT16; 
    330330 
    331331        float pixSizeX = 
  • trunk/loci/formats/in/QTReader.java

    r2313 r2430  
    586586      case 0: 
    587587      case 1: 
    588         pixelType[0] = FormatReader.UINT8; 
     588        pixelType[0] = FormatTools.UINT8; 
    589589        break; 
    590590      case 2: 
    591         pixelType[0] = FormatReader.INT16; 
     591        pixelType[0] = FormatTools.INT16; 
    592592        break; 
    593593      case 3: 
    594         pixelType[0] = FormatReader.UINT8; 
     594        pixelType[0] = FormatTools.UINT8; 
    595595        break; 
    596596    } 
  • trunk/loci/formats/in/SDTReader.java

    r2418 r2430  
    231231    sizeT[0] = 1; 
    232232    currentOrder[0] = "XYZTC"; 
    233     pixelType[0] = FormatReader.UINT16; 
     233    pixelType[0] = FormatTools.UINT16; 
    234234 
    235235    MetadataStore store = getMetadataStore(id); 
  • trunk/loci/formats/in/SlidebookReader.java

    r2418 r2430  
    246246    sizeT[0] = numT; 
    247247 
    248     pixelType[0] = FormatReader.UINT16; 
     248    pixelType[0] = FormatTools.UINT16; 
    249249    currentOrder[0] = "XY"; 
    250250 
  • trunk/loci/formats/in/TiffReader.java

    r2377 r2430  
    146146          if (rgb) sc /= 3; 
    147147          sizeT[i] = Integer.parseInt(pixels[i].getAttribute("SizeT")); 
    148           pixelType[i] = FormatReader.pixelTypeFromString( 
     148          pixelType[i] = FormatTools.pixelTypeFromString( 
    149149            pixels[i].getAttribute("PixelType")); 
    150           if (pixelType[i] == FormatReader.INT8 || 
    151             pixelType[i] == FormatReader.INT16 || 
    152             pixelType[i] == FormatReader.INT32) 
     150          if (pixelType[i] == FormatTools.INT8 || 
     151            pixelType[i] == FormatTools.INT16 || 
     152            pixelType[i] == FormatTools.INT32) 
    153153          { 
    154154            pixelType[i]++; 
  • trunk/loci/formats/in/ZeissLSMReader.java

    r2320 r2430  
    281281        case 1: 
    282282          put("DataType", "8 bit unsigned integer"); 
    283           pixelType[0] = FormatReader.UINT8; 
     283          pixelType[0] = FormatTools.UINT8; 
    284284          break; 
    285285        case 2: 
    286286          put("DataType", "12 bit unsigned integer"); 
    287           pixelType[0] = FormatReader.UINT16; 
     287          pixelType[0] = FormatTools.UINT16; 
    288288          break; 
    289289        case 5: 
    290290          put("DataType", "32 bit float"); 
    291           pixelType[0] = FormatReader.FLOAT; 
     291          pixelType[0] = FormatTools.FLOAT; 
    292292          break; 
    293293        case 0: 
     
    303303        int[] bps = TiffTools.getBitsPerSample(ifd); 
    304304        switch (bps[0]) { 
    305           case 8: pixelType[0] = FormatReader.UINT8; break; 
    306           case 16: pixelType[0] = FormatReader.UINT16; break; 
    307           case 32: pixelType[0] = FormatReader.FLOAT; break; 
    308           default: pixelType[0] = FormatReader.UINT8; 
     305          case 8: pixelType[0] = FormatTools.UINT8; break; 
     306          case 16: pixelType[0] = FormatTools.UINT16; break; 
     307          case 32: pixelType[0] = FormatTools.FLOAT; break; 
     308          default: pixelType[0] = FormatTools.UINT8; 
    309309        } 
    310310      } 
     
    558558    } 
    559559    catch (FormatException e) { 
    560       if (FormatReader.debug) e.printStackTrace(); 
     560      if (debug) e.printStackTrace(); 
    561561    } 
    562562    catch (IOException e) { 
    563       if (FormatReader.debug) e.printStackTrace(); 
     563      if (debug) e.printStackTrace(); 
    564564    } 
    565565 
  • trunk/loci/formats/in/ZeissZVIReader.java

    r2422 r2430  
    471471    store.setImage((String) getMeta("Title"), null, null, null); 
    472472 
    473     if (bpp == 1 || bpp == 3) pixelType[0] = FormatReader.UINT8; 
    474     else if (bpp == 2 || bpp == 6) pixelType[0] = FormatReader.UINT16; 
     473    if (bpp == 1 || bpp == 3) pixelType[0] = FormatTools.UINT8; 
     474    else if (bpp == 2 || bpp == 6) pixelType[0] = FormatTools.UINT16; 
    475475 
    476476    store.setPixels( 
  • trunk/loci/formats/ome/OMEReader.java

    r2327 r2430  
    150150  { 
    151151    BufferedImage b = ImageTools.makeImage(openBytes(id, no), sizeX[0], 
    152       sizeY[0], 1, false, FormatReader.getBytesPerPixel(pixelType[0]), true); 
     152      sizeY[0], 1, false, FormatTools.getBytesPerPixel(pixelType[0]), true); 
    153153    updateMinMax(b, no); 
    154154    return b; 
     
    284284    sizeC[0] = pixels.getSizeC().intValue(); 
    285285    sizeT[0] = pixels.getSizeT().intValue(); 
    286     pixelType[0] = FormatReader.pixelTypeFromString(pixels.getPixelType()); 
     286    pixelType[0] = FormatTools.pixelTypeFromString(pixels.getPixelType()); 
    287287    currentOrder[0] = "XYZCT"; 
    288288 
  • trunk/loci/formats/ome/OMEUploader.java

    r2418 r2430  
    166166 
    167167      int bytesPerPixel = 4; 
    168       String pixelType = FormatReader.getPixelTypeString(f.getPixelType(file)); 
     168      String pixelType = FormatTools.getPixelTypeString(f.getPixelType(file)); 
    169169      if (pixelType.indexOf("int") != -1) { 
    170170        pixelType = pixelType.substring(pixelType.indexOf("int") + 3); 
     
    353353        for (int i=0; i<plane.length / bytesPerChannel; i++) { 
    354354          System.arraycopy(plane, i*bytesPerChannel, b, 0, bytesPerChannel); 
    355           int[] indices = FormatReader.getZCTCoords( 
     355          int[] indices = FormatTools.getZCTCoords( 
    356356            xmlStore.getDimensionOrder(null), sizeZ, sizeC, sizeT, 
    357357            sizeZ * sizeC * sizeT, num); 
     
    368368        return bytesUploaded; 
    369369      } 
    370       int[] indices = FormatReader.getZCTCoords( 
     370      int[] indices = FormatTools.getZCTCoords( 
    371371        xmlStore.getDimensionOrder(null), sizeZ, sizeC, sizeT, 
    372372        sizeZ * sizeC * sizeT, num); 
     
    824824  } 
    825825 
     826  // -- Main method -- 
     827 
     828  /** 
     829   * A command-line tool for uploading data to an 
     830   * OME server using client-side Java tools. 
     831   */ 
     832  public static void main(String[] args) { 
     833    String server = null, user = null, pass = null; 
     834    Vector files = new Vector(); 
     835 
     836    // parse command-line arguments 
     837    boolean doUsage = false; 
     838    if (args.length == 0) doUsage = true; 
     839    for (int i=0; i<args.length; i++) { 
     840      if (args[i].startsWith("-")) { 
     841        // argument is a command line flag 
     842        String param = args[i]; 
     843        try { 
     844          if (param.equalsIgnoreCase("-s")) server = args[++i]; 
     845          else if (param.equalsIgnoreCase("-u")) user = args[++i]; 
     846          else if (param.equalsIgnoreCase("-p")) pass = args[++i]; 
     847          else if (param.equalsIgnoreCase("-h") || 
     848            param.equalsIgnoreCase("-?")) 
     849          { 
     850            doUsage = true; 
     851          } 
     852          else { 
     853            System.out.println("Error: unknown flag: " + param); 
     854            System.out.println(); 
     855            doUsage = true; 
     856            break; 
     857          } 
     858        } 
     859        catch (ArrayIndexOutOfBoundsException exc) { 
     860          if (i == args.length - 1) { 
     861            System.out.println("Error: flag " + param + 
     862              " must be followed by a parameter value."); 
     863            System.out.println(); 
     864            doUsage = true; 
     865            break; 
     866          } 
     867          else throw exc; 
     868        } 
     869      } 
     870      else { 
     871        files.add(args[i]); 
     872      } 
     873    } 
     874    if (doUsage) { 
     875      System.out.println("Usage: omeul [-s server.address] " + 
     876        "[-u username] [-p password] filename"); 
     877      System.out.println(); 
     878      System.exit(1); 
     879    } 
     880 
     881    // ask for information if necessary 
     882    BufferedReader cin = new BufferedReader(new InputStreamReader(System.in)); 
     883    if (server == null) { 
     884      System.out.print("Server address? "); 
     885      try { server = cin.readLine(); } 
     886      catch (IOException exc) { } 
     887    } 
     888    if (user == null) { 
     889      System.out.print("Username? "); 
     890      try { user = cin.readLine(); } 
     891      catch (IOException exc) { } 
     892    } 
     893    if (pass == null) { 
     894      System.out.print("Password? "); 
     895      try { pass = cin.readLine(); } 
     896      catch (IOException exc) { } 
     897    } 
     898 
     899    if (server == null || user == null || pass == null) { 
     900      System.out.println("Error: could not obtain server login information"); 
     901      System.exit(2); 
     902    } 
     903    System.out.println("Using server " + server + " as user " + user); 
     904 
     905    // create image uploader 
     906/* CTR TODO 
     907    OMEUploader uploader = new OMEUploader(); 
     908    uploader.addTaskListener(new TaskListener() { 
     909      public void taskUpdated(TaskEvent e) { 
     910        System.out.println(e.getStatusMessage()); 
     911      } 
     912    }); 
     913 
     914    for (int i=0; i<files.size(); i++) { 
     915      FilePattern fp = new FilePattern((String) files.get(i)); 
     916      int[] lengths = fp.getCount(); 
     917      if (lengths.length == 0) { 
     918        lengths = new int[1]; 
     919        lengths[0] = 1; 
     920      } 
     921       
     922      loci.visbio.data.Dataset data = new loci.visbio.data.Dataset( 
     923        (String) files.get(i), fp.getPattern(), fp.getFiles(), lengths,  
     924        new String[lengths.length]); 
     925      uploader.upload(data, server, user, pass); 
     926    } 
     927*/ 
     928  } 
     929 
    826930} 
  • trunk/loci/formats/ome/OMEXMLMetadataStore.java

    r2422 r2430  
    3232import javax.xml.parsers.ParserConfigurationException; 
    3333import javax.xml.transform.TransformerException; 
    34 import loci.formats.FormatReader; 
     34import loci.formats.FormatTools; 
    3535import loci.formats.MetadataStore; 
    3636import org.openmicroscopy.xml.*; 
     
    944944 
    945945    switch (pixelType.intValue()) { 
    946       case FormatReader.INT8: 
     946      case FormatTools.INT8: 
    947947        return "int8"; 
    948       case FormatReader.UINT8: 
     948      case FormatTools.UINT8: 
    949949        return "Uint8"; 
    950       case FormatReader.INT16: 
     950      case FormatTools.INT16: 
    951951        return "int16"; 
    952       case FormatReader.UINT16: 
     952      case FormatTools.UINT16: 
    953953        return "Uint16"; 
    954       case FormatReader.INT32: 
     954      case FormatTools.INT32: 
    955955        return "int32"; 
    956       case FormatReader.UINT32: 
     956      case FormatTools.UINT32: 
    957957        return "Uint32"; 
    958       case FormatReader.FLOAT: 
     958      case FormatTools.FLOAT: 
    959959        return "float"; 
    960       case FormatReader.DOUBLE: 
     960      case FormatTools.DOUBLE: 
    961961        return "double"; 
    962962    } 
  • trunk/loci/formats/ome/OmeisImporter.java

    r2327 r2430  
    215215      boolean isSigned, isFloat; 
    216216      switch (pixelType) { 
    217         case FormatReader.INT8: 
     217        case FormatTools.INT8: 
    218218          bytesPerPixel = 1; 
    219219          isSigned = true; 
    220220          isFloat = false; 
    221221          break; 
    222         case FormatReader.UINT8: 
     222        case FormatTools.UINT8: 
    223223          bytesPerPixel = 1; 
    224224          isSigned = false; 
    225225          isFloat = false; 
    226226          break; 
    227         case FormatReader.INT16: 
     227        case FormatTools.INT16: 
    228228          bytesPerPixel = 2; 
    229229          isSigned = true; 
    230230          isFloat = false; 
    231231          break; 
    232         case FormatReader.UINT16: 
     232        case FormatTools.UINT16: 
    233233          bytesPerPixel = 2; 
    234234          isSigned = false; 
    235235          isFloat = false; 
    236236          break; 
    237         case FormatReader.INT32: 
     237        case FormatTools.INT32: 
    238238          bytesPerPixel = 4; 
    239239          isSigned = true; 
    240240          isFloat = false; 
    241241          break; 
    242         case FormatReader.UINT32: 
     242        case FormatTools.UINT32: 
    243243          bytesPerPixel = 4; 
    244244          isSigned = false; 
    245245          isFloat = false; 
    246246          break; 
    247         case FormatReader.FLOAT: 
     247        case FormatTools.FLOAT: 
    248248          bytesPerPixel = 4; 
    249249          isSigned = true; 
    250250          isFloat = true; 
    251251          break; 
    252         case FormatReader.DOUBLE: 
     252        case FormatTools.DOUBLE: 
    253253          bytesPerPixel = 8; 
    254254          isSigned = true; 
  • trunk/loci/formats/out/AVIWriter.java

    r2182 r2430  
    525525  /* @see IFormatWriter#getPixelTypes(String) */ 
    526526  public int[] getPixelTypes(String id) throws FormatException, IOException { 
    527     return new int[] {FormatReader.UINT8}; 
     527    return new int[] {FormatTools.UINT8}; 
    528528  } 
    529529 
  • trunk/loci/formats/out/EPSWriter.java

    r2182 r2430  
    156156  /* @see IFormatWriter#getPixelTypes(String) */ 
    157157  public int[] getPixelTypes(String id) throws FormatException, IOException { 
    158     return new int[] {FormatReader.UINT8}; 
     158    return new int[] {FormatTools.UINT8}; 
    159159  } 
    160160 
  • trunk/loci/formats/out/ImageIOWriter.java

    r2182 r2430  
    7777    BufferedImage img = (cm == null) ? 
    7878      ImageTools.makeBuffered(image) : ImageTools.makeBuffered(image, cm); 
    79     if (ImageTools.getPixelType(img) == FormatReader.FLOAT) { 
     79    if (ImageTools.getPixelType(img) == FormatTools.FLOAT) { 
    8080      throw new FormatException("Floating point data not supported."); 
    8181    } 
     
    9797  /* @see IFormatWriter#getPixelTypes(String) */ 
    9898  public int[] getPixelTypes(String id) throws FormatException, IOException { 
    99     return new int[] {FormatReader.UINT8, FormatReader.UINT16}; 
     99    return new int[] {FormatTools.UINT8, FormatTools.UINT16}; 
    100100  } 
    101101 
  • trunk/loci/formats/out/JPEGWriter.java

    r2182 r2430  
    4949      ImageTools.makeBuffered(image) : ImageTools.makeBuffered(image, cm); 
    5050    int type = ImageTools.getPixelType(img); 
    51     if (type == FormatReader.UINT16 || type == FormatReader.INT16) { 
     51    if (type == FormatTools.UINT16 || type == FormatTools.INT16) { 
    5252      throw new FormatException("16-bit data not supported."); 
    5353    } 
     
    5757  /* @see IFormatWriter#getPixelTypes(String) */ 
    5858  public int[] getPixelTypes(String id) throws FormatException, IOException { 
    59     return new int[] {FormatReader.UINT8}; 
     59    return new int[] {FormatTools.UINT8}; 
    6060  } 
    6161 
  • trunk/loci/formats/out/QTWriter.java

    r2418 r2430  
    595595  /* @see IFormatWriter#getPixelTypes(String) */ 
    596596  public int[] getPixelTypes(String id) throws FormatException, IOException { 
    597     return new int[] {FormatReader.UINT8, FormatReader.UINT16}; 
     597    return new int[] {FormatTools.UINT8, FormatTools.UINT16}; 
    598598  } 
    599599 
  • trunk/loci/formats/test/ConfigurationFiles.java

    r2321 r2430  
    128128              Integer.parseInt(s.substring(ndx, s.indexOf(" ", ndx))); 
    129129            ndx = s.indexOf("type") + 5; 
    130             entry.type[i] = FormatReader.pixelTypeFromString( 
     130            entry.type[i] = FormatTools.pixelTypeFromString( 
    131131              s.substring(ndx, s.indexOf(" ", ndx))); 
    132132            ndx = s.indexOf("little") + 7; 
  • trunk/loci/formats/test/ReaderTest.java

    r2418 r2430  
    177177        int sizeY = reader.getSizeY(id); 
    178178        int bytesPerPixel = 
    179           FormatReader.getBytesPerPixel(reader.getPixelType(id)); 
     179          FormatTools.getBytesPerPixel(reader.getPixelType(id)); 
    180180        int sizeC = reader.getSizeC(id); 
    181181        boolean rgb = reader.isRGB(id); 
     
    326326        int sizeT = reader.getSizeT(id); 
    327327        boolean bigEndian = !reader.isLittleEndian(id); 
    328         String type = 
    329           FormatReader.getPixelTypeString(reader.getPixelType(id)); 
     328        String type = FormatTools.getPixelTypeString(reader.getPixelType(id)); 
    330329        String dimensionOrder = reader.getDimensionOrder(id); 
    331330 
     
    406405          configLine.append(reader.getThumbSizeY(id)); 
    407406          configLine.append(" type="); 
    408           configLine.append(FormatReader.getPixelTypeString( 
     407          configLine.append(FormatTools.getPixelTypeString( 
    409408            reader.getPixelType(id))); 
    410409          configLine.append(" little="); 
     
    745744 
    746745  public static void main(String[] args) { 
    747     if (FormatReader.debug) FormatReader.setDebug(true); 
    748746    if (args.length > 0) { 
    749747      for (int i=1; i<args.length; i++) { 
  • trunk/loci/plugins/Importer.java

    r2413 r2430  
    598598          meta.put("\t" + s + "IsRGB", new Boolean(r.isRGB(id))); 
    599599          meta.put("\t" + s + "PixelType", 
    600             FormatReader.getPixelTypeString(r.getPixelType(id))); 
     600            FormatTools.getPixelTypeString(r.getPixelType(id))); 
    601601          meta.put("\t" + s + "LittleEndian", 
    602602            new Boolean(r.isLittleEndian(id))); 
     
    719719            ImageProcessor ip = null; 
    720720 
    721             int bpp = FormatReader.getBytesPerPixel(type); 
     721            int bpp = FormatTools.getBytesPerPixel(type); 
    722722 
    723723            if (b.length != w * h * c * bpp && b.length != w * h * bpp) { 
     
    731731 
    732732            Object pixels = DataTools.makeDataArray(b, bpp, 
    733               type == FormatReader.FLOAT || type == FormatReader.DOUBLE, 
     733              type == FormatTools.FLOAT || type == FormatTools.DOUBLE, 
    734734              r.isLittleEndian(id)); 
    735735 
  • trunk/loci/plugins/LociUploader.java

    r2419 r2430  
    107107      else { 
    108108        store.createRoot(); 
    109         int pixelType = FormatReader.UINT8; 
     109        int pixelType = FormatTools.UINT8; 
    110110        switch (imp.getBitDepth()) { 
    111           case 16: pixelType = FormatReader.UINT16; break; 
    112           case 32: pixelType = FormatReader.FLOAT; break; 
     111          case 16: pixelType = FormatTools.UINT16; break; 
     112          case 32: pixelType = FormatTools.FLOAT; break; 
    113113        } 
    114114 
     
    131131      if (is.getProcessor(1) instanceof ColorProcessor) { 
    132132        store.setPixels(null, null, null, null, null, 
    133           new Integer(FormatReader.UINT8), null, null, null, null); 
     133          new Integer(FormatTools.UINT8), null, null, null, null); 
    134134      } 
    135135 
Note: See TracChangeset for help on using the changeset viewer.