Changeset 2563


Ignore:
Timestamp:
04/06/07 10:14:11 (13 years ago)
Author:
melissa
Message:

Removed "ignore color tables" logic.

Location:
trunk/loci
Files:
18 edited

Legend:

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

    r2538 r2563  
    480480    if (!id.equals(currentId)) initFile(id); 
    481481    return reader.getSeries(files[0]); 
    482   } 
    483  
    484   /* @see IFormatReader#setColorTableIgnored(boolean) */ 
    485   public void setColorTableIgnored(boolean ignore) { 
    486     reader.setColorTableIgnored(ignore); 
    487     if (readers == null) reader.setColorTableIgnored(ignore); 
    488     else { 
    489       for (int i=0; i<readers.length; i++) { 
    490         readers[i].setColorTableIgnored(ignore); 
    491       } 
    492     } 
    493   } 
    494  
    495   /* @see IFormatReader#isColorTableIgnored() */ 
    496   public boolean isColorTableIgnored() { 
    497     return reader.isColorTableIgnored(); 
    498482  } 
    499483 
     
    735719 
    736720    // sync reader configurations with original reader 
    737     boolean colorTableIgnored = reader.isColorTableIgnored(); 
    738721    boolean normalized = reader.isNormalized(); 
    739722    boolean metadataFiltered = reader.isMetadataFiltered(); 
    740723    StatusListener[] statusListeners = reader.getStatusListeners(); 
    741724    for (int i=1; i<readers.length; i++) { 
    742       readers[i].setColorTableIgnored(colorTableIgnored); 
    743725      readers[i].setNormalized(normalized); 
    744726      readers[i].setMetadataFiltered(metadataFiltered); 
  • trunk/loci/formats/FormatReader.java

    r2557 r2563  
    5757  /** Core metadata values. */ 
    5858  protected CoreMetadata core; 
    59  
    60   /** Whether or not to ignore color tables, if present. */ 
    61   protected boolean ignoreColorTable; 
    6259 
    6360  /** Whether or not to normalize float data. */ 
     
    371368  } 
    372369 
    373   /* @see IFormatReader#setColorTableIgnored(boolean) */ 
    374   public void setColorTableIgnored(boolean ignore) { 
    375     if (currentId != null) { 
    376       String s = "setColorTableIgnored called with open file."; 
    377       if (debug && debugLevel >= 2) trace(s); 
    378       else System.err.println("Warning: " + s); 
    379     } 
    380     ignoreColorTable = ignore; 
    381   } 
    382  
    383   /* @see IFormatReader#isColorTableIgnored() */ 
    384   public boolean isColorTableIgnored() { 
    385     return ignoreColorTable; 
    386   } 
    387  
    388370  /* @see IFormatReader#setNormalized(boolean) */ 
    389371  public void setNormalized(boolean normalize) { 
  • trunk/loci/formats/FormatTools.java

    r2543 r2563  
    247247      } 
    248248    }); 
    249     reader.setColorTableIgnored(ignoreColors); 
    250249    reader.setNormalized(normalize); 
    251250    reader.setMetadataFiltered(true); 
  • trunk/loci/formats/IFormatReader.java

    r2535 r2563  
    190190  int getSeries(String id) throws FormatException, IOException; 
    191191 
    192   /** Specifies whether or not to ignore color tables, if present. */ 
    193   void setColorTableIgnored(boolean ignore); 
    194  
    195   /** Returns true if we should ignore color tables, if present. */ 
    196   boolean isColorTableIgnored(); 
    197  
    198192  /** Specifies whether or not to normalize float data. */ 
    199193  void setNormalized(boolean normalize); 
  • trunk/loci/formats/ImageReader.java

    r2550 r2563  
    321321  } 
    322322 
    323   /* @see IFormatReader#setColorTableIgnored(boolean) */ 
    324   public void setColorTableIgnored(boolean ignore) { 
    325     for (int i=0; i<readers.length; i++) { 
    326       readers[i].setColorTableIgnored(ignore); 
    327     } 
    328   } 
    329  
    330   /* @see IFormatReader#isColorTableIgnored() */ 
    331   public boolean isColorTableIgnored() { 
    332     // NB: all readers should have the same color tables setting 
    333     return readers[0].isColorTableIgnored(); 
    334   } 
    335  
    336323  /* @see IFormatReader#setNormalized(boolean) */ 
    337324  public void setNormalized(boolean normalize) { 
  • trunk/loci/formats/ReaderWrapper.java

    r2538 r2563  
    198198  } 
    199199 
    200   public void setColorTableIgnored(boolean ignore) { 
    201     reader.setColorTableIgnored(ignore); 
    202   } 
    203  
    204   public boolean isColorTableIgnored() { 
    205     return reader.isColorTableIgnored(); 
    206   } 
    207  
    208200  public void setNormalized(boolean normalize) { 
    209201    reader.setNormalized(normalize); 
  • trunk/loci/formats/TiffTools.java

    r2532 r2563  
    798798    throws FormatException, IOException 
    799799  { 
    800     return getSamples(ifd, in, false); 
    801   } 
    802  
    803   /** 
    804    * Reads the image defined in the given IFD from the specified file. 
    805    * If the 'ignore' flag is set, then RGB LUT images are interpreted as 
    806    * grayscale images. 
    807    */ 
    808   public static byte[][] getSamples(Hashtable ifd, RandomAccessStream in, 
    809     boolean ignore) throws FormatException, IOException 
    810   { 
    811800    int samplesPerPixel = getSamplesPerPixel(ifd); 
    812801    int photoInterp = getPhotometricInterpretation(ifd); 
     
    821810    byte[] b = new byte[(int) (width * length * samplesPerPixel * bpp)]; 
    822811 
    823     getSamples(ifd, in, ignore, b); 
     812    getSamples(ifd, in, b); 
    824813    byte[][] samples = new byte[samplesPerPixel][(int) (width * length * bpp)]; 
    825814    for (int i=0; i<samplesPerPixel; i++) { 
     
    832821 
    833822  public static byte[] getSamples(Hashtable ifd, RandomAccessStream in, 
    834     boolean ignore, byte[] buf) throws FormatException, IOException 
     823    byte[] buf) throws FormatException, IOException 
    835824  { 
    836825    if (DEBUG) debug("parsing IFD entries"); 
     
    865854      } 
    866855      putIFDValue(ifd, VALID_BITS, validBits); 
    867     } 
    868  
    869     if (ignore && (photoInterp == RGB_PALETTE || photoInterp == CFA_ARRAY)) { 
    870       photoInterp = BLACK_IS_ZERO; 
    871       samplesPerPixel = 1;  
    872       bitsPerSample = new int[] {bitsPerSample[0]};  
    873856    } 
    874857 
     
    13791362    throws FormatException, IOException 
    13801363  { 
    1381     return getImage(ifd, in, false); 
    1382   } 
    1383  
    1384   /** 
    1385    * Reads the image defined in the given IFD from the specified file. 
    1386    * If the 'ignore' flag is set, then RGB LUT images are interpreted as 
    1387    * grayscale images. 
    1388    */ 
    1389   public static BufferedImage getImage(Hashtable ifd, RandomAccessStream in, 
    1390     boolean ignore) throws FormatException, IOException 
    1391   { 
    13921364    // construct field 
    13931365    if (DEBUG) debug("constructing image"); 
    13941366 
    1395     byte[][] samples = getSamples(ifd, in, ignore); 
     1367    byte[][] samples = getSamples(ifd, in); 
    13961368    int[] bitsPerSample = getBitsPerSample(ifd); 
    13971369    long imageWidth = getImageWidth(ifd); 
     
    14001372    int photoInterp = getPhotometricInterpretation(ifd); 
    14011373     
    1402     if (ignore && (photoInterp == RGB_PALETTE || photoInterp == CFA_ARRAY)) { 
    1403       photoInterp = BLACK_IS_ZERO; 
    1404       samplesPerPixel = 1; 
    1405     } 
    1406  
    14071374    int[] validBits = getIFDIntArray(ifd, VALID_BITS, false); 
    14081375 
    1409     if (!ignore && (photoInterp == RGB_PALETTE || photoInterp == CFA_ARRAY)) { 
     1376    if (photoInterp == RGB_PALETTE || photoInterp == CFA_ARRAY) { 
    14101377      samplesPerPixel = 3; 
    14111378    } 
  • trunk/loci/formats/in/BMPReader.java

    r2557 r2563  
    125125    in.seek(global); 
    126126 
    127     if (palette != null && palette[0].length > 0 && !ignoreColorTable) { 
     127    if (palette != null && palette[0].length > 0) { 
    128128      for (int y=core.sizeY[0]-1; y>=0; y--) { 
    129129        for (int x=0; x<core.sizeX[0]; x++) { 
  • trunk/loci/formats/in/BaseTiffReader.java

    r2557 r2563  
    424424 
    425425    int p = TiffTools.getIFDIntValue(ifd, TiffTools.PHOTOMETRIC_INTERPRETATION); 
    426     if (!ignoreColorTable && 
    427       (p == TiffTools.RGB_PALETTE || p == TiffTools.CFA_ARRAY)) 
    428     { 
     426    if (p == TiffTools.RGB_PALETTE || p == TiffTools.CFA_ARRAY) { 
    429427      numC = 3; 
    430428      bps *= 3; 
     
    707705    int p = TiffTools.getIFDIntValue(ifds[0], 
    708706      TiffTools.PHOTOMETRIC_INTERPRETATION, true, 0); 
    709     return (!isColorTableIgnored() && (p == TiffTools.RGB_PALETTE || 
    710       p == TiffTools.CFA_ARRAY)) || p == TiffTools.RGB; 
     707    return p == TiffTools.RGB_PALETTE || p == TiffTools.CFA_ARRAY ||  
     708      p == TiffTools.RGB; 
    711709  } 
    712710 
     
    745743    } 
    746744 
    747     TiffTools.getSamples(ifds[no], in, ignoreColorTable, buf); 
     745    TiffTools.getSamples(ifds[no], in, buf); 
    748746    return swapIfRequired(buf); 
    749747  } 
     
    777775    } 
    778776 
    779     return TiffTools.getImage(ifds[no], in, ignoreColorTable); 
     777    return TiffTools.getImage(ifds[no], in); 
    780778  } 
    781779 
  • trunk/loci/formats/in/GIFReader.java

    r2557 r2563  
    150150  public boolean isRGB(String id) throws FormatException, IOException { 
    151151    if (!id.equals(currentId)) initFile(id);  
    152     return !ignoreColorTable; 
     152    return true; 
    153153  } 
    154154 
     
    187187    int[] ints = (int[]) images.get(no); 
    188188 
    189     if (ignoreColorTable) { 
    190       for (int i=0; i<buf.length; i++) buf[i] = (byte) ints[i]; 
    191     } 
    192     else { 
    193       for (int i=0; i<ints.length; i++) { 
    194         buf[i] = (byte) ((ints[i] & 0xff0000) >> 16); 
    195         buf[i + ints.length] = (byte) ((ints[i] & 0xff00) >> 8); 
    196         buf[i + 2*ints.length] = (byte) (ints[i] & 0xff); 
    197       } 
     189    for (int i=0; i<ints.length; i++) { 
     190      buf[i] = (byte) ((ints[i] & 0xff0000) >> 16); 
     191      buf[i + ints.length] = (byte) ((ints[i] & 0xff00) >> 8); 
     192      buf[i + 2*ints.length] = (byte) (ints[i] & 0xff); 
    198193    } 
    199194    return buf; 
     
    396391 
    397392    core.sizeZ[0] = 1; 
    398     core.sizeC[0] = ignoreColorTable ? 1 : 3; 
     393    core.sizeC[0] = 3; 
    399394    core.sizeT[0] = numFrames; 
    400395    core.currentOrder[0] = "XYCTZ"; 
     
    605600          // map color and insert in destination 
    606601          int index = ((int) pixels[sx++]) & 0xff; 
    607           if (!ignoreColorTable) dest[dx++] = act[index]; 
    608           else dest[dx++] = index; 
     602          dest[dx++] = act[index]; 
    609603        } 
    610604      } 
  • trunk/loci/formats/in/IPWReader.java

    r2557 r2563  
    9696  public boolean isRGB(String id) throws FormatException, IOException { 
    9797    if (!id.equals(currentId)) initFile(id); 
    98     return rgb && !ignoreColorTable; 
     98    return rgb; 
    9999  } 
    100100 
     
    153153      ifds = TiffTools.getIFDs(stream); 
    154154      little = TiffTools.isLittleEndian(ifds[0]); 
    155       TiffTools.getSamples(ifds[0], stream, ignoreColorTable, buf); 
     155      TiffTools.getSamples(ifds[0], stream, buf); 
    156156      stream.close(); 
    157157      return buf; 
     
    312312 
    313313    if (rgb) core.sizeC[0] *= 3; 
    314     if (ignoreColorTable) core.sizeC[0] = 1; 
    315314 
    316315    int maxNdx = 0, max = 0; 
  • trunk/loci/formats/in/LeicaReader.java

    r2557 r2563  
    587587        for (int j=0; j<tiff[i].length; j++) { 
    588588          tiff[i][j] = new TiffReader(); 
    589           tiff[i][j].setColorTableIgnored(isColorTableIgnored()); 
    590589        } 
    591590      } 
     
    10111010        for (int i=0; i<core.sizeC.length; i++) { 
    10121011          setSeries(currentId, i); 
    1013           if (!ignoreColorTable) { 
    1014             if (isRGB(currentId)) core.sizeC[i] = 3; 
    1015             else core.sizeC[i] = 1; 
    1016           } 
    1017           else { 
    1018             core.sizeZ[i] /= core.sizeC[i]; 
    1019           } 
     1012          if (isRGB(currentId)) core.sizeC[i] = 3; 
     1013          else core.sizeC[i] = 1; 
    10201014        } 
    10211015        setSeries(currentId, oldSeries); 
  • trunk/loci/formats/in/OIBReader.java

    r2557 r2563  
    205205      Hashtable[] ifds = TiffTools.getIFDs(stream); 
    206206      littleEndian[series] = TiffTools.isLittleEndian(ifds[0]); 
    207       TiffTools.getSamples(ifds[0], stream, ignoreColorTable, buf); 
     207      TiffTools.getSamples(ifds[0], stream, buf); 
    208208      stream.close(); 
    209209      return buf; 
     
    612612          if (!isRGB) { 
    613613            int p = TiffTools.getPhotometricInterpretation(ifd); 
    614             isRGB = !isColorTableIgnored() && (p == TiffTools.RGB_PALETTE || 
    615               p == TiffTools.CFA_ARRAY) || p == TiffTools.RGB; 
     614            isRGB = p == TiffTools.RGB_PALETTE || 
     615              p == TiffTools.CFA_ARRAY || p == TiffTools.RGB; 
    616616          } 
    617617 
  • trunk/loci/formats/in/OIFReader.java

    r2557 r2563  
    305305 
    306306    thumbReader = new BMPReader(); 
    307     thumbReader.setColorTableIgnored(isColorTableIgnored()); 
    308307    numImages = filenames.size(); 
    309308    tiffs = new Vector(numImages); 
     
    312311    for (int i=0; i<numImages; i++) { 
    313312      tiffReader[i] = new TiffReader(); 
    314       tiffReader[i].setColorTableIgnored(isColorTableIgnored()); 
    315313    } 
    316314 
  • trunk/loci/formats/in/PerkinElmerReader.java

    r2557 r2563  
    381381    for (int i=0; i<tiff.length; i++) { 
    382382      tiff[i] = new TiffReader(); 
    383       tiff[i].setColorTableIgnored(isColorTableIgnored()); 
    384383    } 
    385384 
  • trunk/loci/formats/in/PictReader.java

    r2557 r2563  
    139139  /** Checks if the images in the file are RGB. */ 
    140140  public boolean isRGB(String id) throws FormatException, IOException { 
    141     return !ignoreColorTable; 
     141    return true; 
    142142  } 
    143143 
     
    212212    core.sizeY[0] = d.height; 
    213213    core.sizeZ[0] = 1; 
    214     core.sizeC[0] = ignoreColorTable ? 1 : 3; 
     214    core.sizeC[0] = 3; 
    215215    core.sizeT[0] = 1; 
    216216    core.currentOrder[0] = "XYCZT"; 
     
    274274    } 
    275275 
    276     if (lookup != null && !ignoreColorTable) { 
     276    if (lookup != null) { 
    277277      // 8 bit data 
    278278      short[][] data = new short[3][height * width]; 
     
    303303        debug("openBytes: 8-bit data, " + width + " x " + height + 
    304304          ", length=" + data.length + "x" + data[0].length); 
    305       } 
    306       return ImageTools.makeImage(data, width, height); 
    307     } 
    308     else if (ignoreColorTable) { 
    309       byte[][] data = new byte[1][width * height]; 
    310       byte[] row; 
    311  
    312       for (int i=0; i<height; i++) { 
    313         row = (byte[]) strips.get(i); 
    314         System.arraycopy(row, 0, data[0], i*width, width); 
    315305      } 
    316306      return ImageTools.makeImage(data, width, height); 
  • trunk/loci/formats/in/ZeissLSMReader.java

    r2557 r2563  
    147147   
    148148    ifds = TiffTools.getIFDs(in); 
    149     TiffTools.getSamples(ifds[2*no], in, ignoreColorTable, buf); 
     149    TiffTools.getSamples(ifds[2*no], in, buf); 
    150150    return swapIfRequired(buf); 
    151151  } 
  • trunk/loci/plugins/Importer.java

    r2466 r2563  
    7171  private String stackFormat = ""; 
    7272  private Checkbox mergeBox; 
    73   private Checkbox ignoreBox; 
    7473  private Checkbox colorizeBox; 
    7574  private Checkbox splitBox; 
     
    226225    // load preferences from IJ_Prefs.txt 
    227226    mergeChannels = Prefs.get("bioformats.mergeChannels", false); 
    228     boolean ignoreTables = Prefs.get("bioformats.ignoreTables", false); 
    229227    boolean colorize = Prefs.get("bioformats.colorize", false); 
    230228    boolean splitWindows = Prefs.get("bioformats.splitWindows", true); 
     
    236234 
    237235    final String mergeString = "Merge channels to RGB"; 
    238     final String ignoreString = "Ignore color lookup table"; 
    239236    final String colorizeString = "Colorize channels"; 
    240237    final String splitString = "Open each channel in its own window"; 
     
    248245    gd = new GenericDialog("LOCI Bio-Formats Import Options"); 
    249246    gd.addCheckbox(mergeString, mergeChannels); 
    250     gd.addCheckbox(ignoreString, ignoreTables); 
    251247    gd.addCheckbox(colorizeString, colorize); 
    252248    gd.addCheckbox(splitString, splitWindows); 
     
    261257    if (boxes != null) { 
    262258      mergeBox = (Checkbox) boxes.get(0); 
    263       ignoreBox = (Checkbox) boxes.get(1); 
    264       colorizeBox = (Checkbox) boxes.get(2); 
    265       splitBox = (Checkbox) boxes.get(3); 
    266       metadataBox = (Checkbox) boxes.get(4); 
    267       stitchBox = (Checkbox) boxes.get(5); 
    268       stitchStackBox = (Checkbox) boxes.get(6); 
    269       rangeBox = (Checkbox) boxes.get(7); 
     259      colorizeBox = (Checkbox) boxes.get(1); 
     260      splitBox = (Checkbox) boxes.get(2); 
     261      metadataBox = (Checkbox) boxes.get(3); 
     262      stitchBox = (Checkbox) boxes.get(4); 
     263      stitchStackBox = (Checkbox) boxes.get(5); 
     264      rangeBox = (Checkbox) boxes.get(6); 
    270265      for (int i=0; i<boxes.size(); i++) { 
    271266        ((Checkbox) boxes.get(i)).addItemListener(this); 
     
    286281    } 
    287282    mergeChannels = gd.getNextBoolean(); 
    288     ignoreTables = gd.getNextBoolean(); 
    289283    colorize = gd.getNextBoolean(); 
    290284    splitWindows = gd.getNextBoolean(); 
     
    305299 
    306300      FileStitcher fs = null; 
    307       r.setColorTableIgnored(ignoreTables); 
    308301      r.setMetadataFiltered(true); 
    309302 
     
    939932      // save parameter values to IJ_Prefs.txt 
    940933      Prefs.set("bioformats.mergeChannels", mergeChannels); 
    941       Prefs.set("bioformats.ignoreTables", ignoreTables); 
    942934      Prefs.set("bioformats.colorize", colorize); 
    943935      Prefs.set("bioformats.splitWindows", splitWindows); 
     
    978970        splitBox.setState(false); 
    979971      } 
    980     } 
    981     else if (src == ignoreBox) { 
    982972    } 
    983973    else if (src == colorizeBox) { 
Note: See TracChangeset for help on using the changeset viewer.