Changeset 5988 for branches/cleanup


Ignore:
Timestamp:
03/03/10 16:35:40 (10 years ago)
Author:
melissa
Message:

Removed null checking from IFD.getIFD*Value methods, as it was rarely used. See #466.

Location:
branches/cleanup/components/bio-formats/src/loci/formats
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • branches/cleanup/components/bio-formats/src/loci/formats/DelegateReader.java

    r5852 r5988  
    135135  } 
    136136 
     137  /* @see IFormatReader#get8BitLookupTable() */ 
     138  public byte[][] get8BitLookupTable() throws FormatException, IOException { 
     139    if (useLegacy || (legacyReaderInitialized && !nativeReaderInitialized)) { 
     140      return legacyReader.get8BitLookupTable(); 
     141    } 
     142    return nativeReader.get8BitLookupTable(); 
     143  } 
     144 
     145  /* @see IFormatReader#get16BitLookupTable() */ 
     146  public short[][] get16BitLookupTable() throws FormatException, IOException { 
     147    if (useLegacy || (legacyReaderInitialized && !nativeReaderInitialized)) { 
     148      return legacyReader.get16BitLookupTable(); 
     149    } 
     150    return nativeReader.get16BitLookupTable(); 
     151  } 
     152 
    137153  /* @see IFormatReader#openBytes(int, byte[], int, int, int, int) */ 
    138154  public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) 
     
    166182      } 
    167183      catch (FormatException e) { 
    168         LOGGER.debug("Could not initialize legacy reader", e); 
     184        LOGGER.debug("", e); 
    169185        nativeReader.setId(id); 
    170186        nativeReaderInitialized = true; 
     
    180196      catch (IOException e) { exc = e; } 
    181197      if (exc != null) { 
    182         LOGGER.debug("Could not initialize native reader", exc); 
     198        LOGGER.debug("", exc); 
    183199        legacyReader.setId(id); 
    184200        legacyReaderInitialized = true; 
  • branches/cleanup/components/bio-formats/src/loci/formats/gui/AWTTiffTools.java

    r5969 r5988  
    166166    int rowsPerStrip = stripSize / (width * bytesPerPixel * nChannels); 
    167167    int stripsPerImage = (height + rowsPerStrip - 1) / rowsPerStrip; 
    168     int[] bps = (int[]) ifd.getIFDValue(IFD.BITS_PER_SAMPLE, true, int[].class); 
     168    int[] bps = ifd.getBitsPerSample(); 
    169169    ByteArrayOutputStream[] stripBuf = 
    170170      new ByteArrayOutputStream[stripsPerImage]; 
     
    192192    // compress strips according to given differencing and compression schemes 
    193193    int planarConfig = ifd.getPlanarConfiguration(); 
    194     int predictor = ifd.getIFDIntValue(IFD.PREDICTOR, false, 1); 
     194    int predictor = ifd.getIFDIntValue(IFD.PREDICTOR, 1); 
    195195 
    196196    byte[][] strips = new byte[stripsPerImage][]; 
  • branches/cleanup/components/bio-formats/src/loci/formats/in/BaseTiffReader.java

    r5969 r5988  
    409409        lastName = artist.substring(ndx + 1); 
    410410      } 
    411       String email = firstIFD.getIFDStringValue(IFD.HOST_COMPUTER, false); 
     411      String email = firstIFD.getIFDStringValue(IFD.HOST_COMPUTER); 
    412412      store.setExperimenterFirstName(firstName, 0); 
    413413      store.setExperimenterLastName(lastName, 0); 
     
    437437 
    438438    int resolutionUnit = firstIFD.getIFDIntValue(IFD.RESOLUTION_UNIT); 
    439     TiffRational xResolution = firstIFD.getIFDRationalValue( 
    440       IFD.X_RESOLUTION, false); 
    441     TiffRational yResolution = firstIFD.getIFDRationalValue( 
    442       IFD.Y_RESOLUTION, false); 
     439    TiffRational xResolution = firstIFD.getIFDRationalValue(IFD.X_RESOLUTION); 
     440    TiffRational yResolution = firstIFD.getIFDRationalValue(IFD.Y_RESOLUTION); 
    443441    float pixX = xResolution == null ? 0f : 1 / xResolution.floatValue(); 
    444442    float pixY = yResolution == null ? 0f : 1 / yResolution.floatValue(); 
  • branches/cleanup/components/bio-formats/src/loci/formats/in/EPSReader.java

    r5852 r5988  
    8686      in.seek(offsets[0]); 
    8787 
    88       int[] map = ifds.get(0).getIFDIntArray(IFD.COLOR_MAP, false); 
     88      int[] map = ifds.get(0).getIFDIntArray(IFD.COLOR_MAP); 
    8989      if (map == null) { 
    9090        readPlane(in, x, y, w, h, buf); 
  • branches/cleanup/components/bio-formats/src/loci/formats/in/FlexReader.java

    r5958 r5988  
    599599    } 
    600600    IFD ifd = ifds[wellRow][wellCol].get(0); 
    601     String xml = XMLTools.sanitizeXML(ifd.getIFDStringValue(FLEX, true)); 
     601    String xml = XMLTools.sanitizeXML(ifd.getIFDStringValue(FLEX)); 
    602602 
    603603    Vector<String> n = new Vector<String>(); 
  • branches/cleanup/components/bio-formats/src/loci/formats/in/FluoviewReader.java

    r5778 r5988  
    172172    // reader. 
    173173 
    174     short[] s = ifds.get(0).getIFDShortArray(MMHEADER, true); 
     174    short[] s = ifds.get(0).getIFDShortArray(MMHEADER); 
     175    if (s == null) { 
     176      throw new FormatException("Invalid Fluoview/Andor TIFF. Tag " + 
     177        MMHEADER + " not found."); 
     178    } 
    175179    byte[] mmheader = new byte[s.length]; 
    176180    for (int i=0; i<mmheader.length; i++) { 
     
    242246    stamps = new long[8][ifds.size()]; 
    243247    for (int i=0; i<ifds.size(); i++) { 
    244       s = ifds.get(i).getIFDShortArray(MMSTAMP, true); 
     248      s = ifds.get(i).getIFDShortArray(MMSTAMP); 
    245249      byte[] stamp = new byte[s.length]; 
    246250      for (int j=0; j<s.length; j++) { 
  • branches/cleanup/components/bio-formats/src/loci/formats/in/GelReader.java

    r5971 r5988  
    7373  private static final int LINEAR = 128; 
    7474 
     75  // -- Fields -- 
     76 
     77  private long fmt; 
     78 
    7579  // -- Constructor -- 
    7680 
     
    99103    IFD ifd = ifds.get(no); 
    100104 
    101     boolean sqrt = ifd.getIFDLongValue(MD_FILETAG, true, LINEAR) == SQUARE_ROOT; 
     105    boolean sqrt = fmt == SQUARE_ROOT; 
    102106 
    103107    if (sqrt) { 
     
    144148    IFD firstIFD = ifds.get(0); 
    145149 
    146     long fmt = firstIFD.getIFDLongValue(MD_FILETAG, true, LINEAR); 
     150    fmt = firstIFD.getIFDLongValue(MD_FILETAG, LINEAR); 
    147151    if (fmt == SQUARE_ROOT) core[0].pixelType = FormatTools.FLOAT; 
    148152    addGlobalMeta("Data format", fmt == SQUARE_ROOT ? "square root" : "linear"); 
     
    155159    // ignore MD_COLOR_TABLE 
    156160 
    157     String lab = firstIFD.getIFDStringValue(MD_LAB_NAME, false); 
     161    String lab = firstIFD.getIFDStringValue(MD_LAB_NAME); 
    158162    addGlobalMeta("Lab name", lab); 
    159163 
    160     String info = firstIFD.getIFDStringValue(MD_SAMPLE_INFO, false); 
     164    String info = firstIFD.getIFDStringValue(MD_SAMPLE_INFO); 
    161165    addGlobalMeta("Sample info", info); 
    162166 
    163     String prepDate = firstIFD.getIFDStringValue(MD_PREP_DATE, false); 
     167    String prepDate = firstIFD.getIFDStringValue(MD_PREP_DATE); 
    164168    addGlobalMeta("Date prepared", prepDate); 
    165169 
    166     String prepTime = firstIFD.getIFDStringValue(MD_PREP_TIME, false); 
     170    String prepTime = firstIFD.getIFDStringValue(MD_PREP_TIME); 
    167171    addGlobalMeta("Time prepared", prepTime); 
    168172 
    169     String units = firstIFD.getIFDStringValue(MD_FILE_UNITS, false); 
     173    String units = firstIFD.getIFDStringValue(MD_FILE_UNITS); 
    170174    addGlobalMeta("File units", units); 
    171175 
  • branches/cleanup/components/bio-formats/src/loci/formats/in/ImarisTiffReader.java

    r5971 r5988  
    7676    for (int i=0; i<ifds.size(); i++) { 
    7777      IFD ifd = ifds.get(i); 
    78       long[] byteCounts = ifd.getIFDLongArray(IFD.TILE_BYTE_COUNTS, false); 
    79       long[] offsets = ifd.getIFDLongArray(IFD.TILE_OFFSETS, false); 
     78      long[] byteCounts = ifd.getStripByteCounts(); 
     79      long[] offsets = ifd.getStripOffsets(); 
    8080 
    8181      for (int j=0; j<byteCounts.length; j++) { 
  • branches/cleanup/components/bio-formats/src/loci/formats/in/MIASReader.java

    r5852 r5988  
    771771    IFD ifd = tp.getFirstIFD(); 
    772772    s.close(); 
    773     int[] colorMap = ifd.getIFDIntArray(IFD.COLOR_MAP, false); 
     773    int[] colorMap = ifd.getIFDIntArray(IFD.COLOR_MAP); 
    774774    if (colorMap == null) return null; 
    775775 
  • branches/cleanup/components/bio-formats/src/loci/formats/in/MetamorphReader.java

    r5971 r5988  
    769769      // additional image planes 
    770770      IFD firstIFD = ifds.get(0); 
    771       long[] uic2 = firstIFD.getIFDLongArray(UIC2TAG, true); 
     771      long[] uic2 = firstIFD.getIFDLongArray(UIC2TAG); 
     772      if (uic2 == null) { 
     773        throw new FormatException("Invalid Metamorph file. Tag " + 
     774          UIC2TAG + " not found."); 
     775      } 
    772776      core[0].imageCount = uic2.length; 
    773777 
     
    801805      } 
    802806 
    803       emWavelength = firstIFD.getIFDLongArray(UIC3TAG, true); 
     807      emWavelength = firstIFD.getIFDLongArray(UIC3TAG); 
    804808 
    805809      // for each image plane, construct an IFD hashtable 
  • branches/cleanup/components/bio-formats/src/loci/formats/in/MinimalTiffReader.java

    r5969 r5988  
    105105    int[] bits = lastIFD.getBitsPerSample(); 
    106106    if (bits[0] <= 8) { 
    107       int[] colorMap = 
    108         lastIFD.getIFDIntArray(IFD.COLOR_MAP, false); 
     107      int[] colorMap = lastIFD.getIFDIntArray(IFD.COLOR_MAP); 
    109108      if (colorMap == null) { 
    110109        // it's possible that the LUT is only present in the first IFD 
    111110        if (lastPlane != 0) { 
    112111          lastIFD = ifds.get(0); 
    113           colorMap = lastIFD.getIFDIntArray(IFD.COLOR_MAP, false); 
     112          colorMap = lastIFD.getIFDIntArray(IFD.COLOR_MAP); 
    114113          if (colorMap == null) return null; 
    115114        } 
     
    137136    int[] bits = lastIFD.getBitsPerSample(); 
    138137    if (bits[0] <= 16 && bits[0] > 8) { 
    139       int[] colorMap = 
    140         lastIFD.getIFDIntArray(IFD.COLOR_MAP, false); 
     138      int[] colorMap = lastIFD.getIFDIntArray(IFD.COLOR_MAP); 
    141139      if (colorMap == null || colorMap.length < 65536 * 3) { 
    142140        // it's possible that the LUT is only present in the first IFD 
    143141        if (lastPlane != 0) { 
    144142          lastIFD = ifds.get(0); 
    145           colorMap = lastIFD.getIFDIntArray(IFD.COLOR_MAP, false); 
     143          colorMap = lastIFD.getIFDIntArray(IFD.COLOR_MAP); 
    146144          if (colorMap == null || colorMap.length < 65536 * 3) return null; 
    147145        } 
  • branches/cleanup/components/bio-formats/src/loci/formats/in/PrairieReader.java

    r5852 r5988  
    145145    String software = null; 
    146146    try { 
    147       software = ifd.getIFDStringValue(IFD.SOFTWARE, true); 
     147      software = ifd.getIFDStringValue(IFD.SOFTWARE); 
    148148    } 
    149149    catch (FormatException exc) { 
  • branches/cleanup/components/bio-formats/src/loci/formats/in/TCSReader.java

    r5852 r5988  
    254254 
    255255    IFDList ifds = tiffParser.getIFDs(); 
    256     String date = ifds.get(0).getIFDStringValue(IFD.DATE_TIME, false); 
     256    String date = ifds.get(0).getIFDStringValue(IFD.DATE_TIME); 
    257257    datestamp = DateTools.getTime(date, "yyyy:MM:dd HH:mm:ss"); 
    258258 
     
    304304 
    305305    for (int i=0; i<ifds.size(); i++) { 
    306       String document = ifds.get(i).getIFDStringValue(IFD.DOCUMENT_NAME, false); 
     306      String document = ifds.get(i).getIFDStringValue(IFD.DOCUMENT_NAME); 
    307307      if (document == null) continue; 
    308308 
     
    468468        IFD ifd = tp.getIFDs().get(0); 
    469469 
    470         String date = ifd.getIFDStringValue(IFD.DATE_TIME, false); 
     470        String date = ifd.getIFDStringValue(IFD.DATE_TIME); 
    471471        long stamp = DateTools.getTime(date, "yyyy:MM:dd HH:mm:ss"); 
    472472 
    473473        rais.close(); 
    474         String software = ifd.getIFDStringValue(IFD.SOFTWARE, false); 
     474        String software = ifd.getIFDStringValue(IFD.SOFTWARE); 
    475475        if (software != null && software.trim().startsWith("TCS")) { 
    476476          timestamps.put(file, new Long(stamp)); 
     
    491491        s.close(); 
    492492 
    493         String date = ifd.getIFDStringValue(IFD.DATE_TIME, false); 
     493        String date = ifd.getIFDStringValue(IFD.DATE_TIME); 
    494494        long nextStamp = DateTools.getTime(date, "yyyy:MM:dd HH:mm:ss"); 
    495495        if (Math.abs(thisStamp - nextStamp) < 60000) { 
  • branches/cleanup/components/bio-formats/src/loci/formats/in/ZeissLSMReader.java

    r5969 r5988  
    465465 
    466466    // get TIF_CZ_LSMINFO structure 
    467     short[] s = ifd.getIFDShortArray(ZEISS_ID, true); 
     467    short[] s = ifd.getIFDShortArray(ZEISS_ID); 
     468    if (s == null) { 
     469      throw new FormatException("Invalid Zeiss LSM file. Tag " + 
     470        ZEISS_ID + " not found."); 
     471    } 
    468472    byte[] cz = new byte[s.length]; 
    469473    for (int i=0; i<s.length; i++) { 
  • branches/cleanup/components/bio-formats/src/loci/formats/tiff/IFD.java

    r5969 r5988  
    205205  /** Gets whether this is a BigTIFF IFD. */ 
    206206  public boolean isBigTiff() throws FormatException { 
    207     return ((Boolean) 
    208       getIFDValue(BIG_TIFF, false, Boolean.class)).booleanValue(); 
     207    return ((Boolean) getIFDValue(BIG_TIFF, Boolean.class)).booleanValue(); 
    209208  } 
    210209 
    211210  /** Gets whether the TIFF information in this IFD is little-endian. */ 
    212211  public boolean isLittleEndian() throws FormatException { 
    213     return ((Boolean) 
    214       getIFDValue(LITTLE_ENDIAN, true, Boolean.class)).booleanValue(); 
     212    return ((Boolean) getIFDValue(LITTLE_ENDIAN, Boolean.class)).booleanValue(); 
    215213  } 
    216214 
     
    224222   * performing some error checking. 
    225223   */ 
    226   public Object getIFDValue(int tag, boolean checkNull, 
    227     Class checkClass) throws FormatException 
    228   { 
     224  public Object getIFDValue(int tag, Class checkClass) throws FormatException { 
    229225    Object value = get(new Integer(tag)); 
    230     if (checkNull && value == null) { 
    231       throw new FormatException( 
    232         getIFDTagName(tag) + " directory entry not found"); 
    233     } 
    234     if (checkClass != null && value != null && 
    235       !checkClass.isInstance(value)) 
    236     { 
     226    if (checkClass != null && value != null && !checkClass.isInstance(value)) { 
    237227      // wrap object in array of length 1, if appropriate 
    238228      Class cType = checkClass.getComponentType(); 
    239       Object array = null; 
     229      Object array = 
     230        Array.newInstance(cType == null ? value.getClass() : cType, 1); 
    240231      if (cType == value.getClass()) { 
    241         array = Array.newInstance(value.getClass(), 1); 
    242232        Array.set(array, 0, value); 
    243233      } 
    244       if (cType == boolean.class && value instanceof Boolean) { 
    245         array = Array.newInstance(boolean.class, 1); 
     234      else if (cType == boolean.class && value instanceof Boolean) { 
    246235        Array.setBoolean(array, 0, ((Boolean) value).booleanValue()); 
    247236      } 
    248237      else if (cType == byte.class && value instanceof Byte) { 
    249         array = Array.newInstance(byte.class, 1); 
    250238        Array.setByte(array, 0, ((Byte) value).byteValue()); 
    251239      } 
    252240      else if (cType == char.class && value instanceof Character) { 
    253         array = Array.newInstance(char.class, 1); 
    254241        Array.setChar(array, 0, ((Character) value).charValue()); 
    255242      } 
    256243      else if (cType == double.class && value instanceof Double) { 
    257         array = Array.newInstance(double.class, 1); 
    258244        Array.setDouble(array, 0, ((Double) value).doubleValue()); 
    259245      } 
    260246      else if (cType == float.class && value instanceof Float) { 
    261         array = Array.newInstance(float.class, 1); 
    262247        Array.setFloat(array, 0, ((Float) value).floatValue()); 
    263248      } 
    264249      else if (cType == int.class && value instanceof Integer) { 
    265         array = Array.newInstance(int.class, 1); 
    266250        Array.setInt(array, 0, ((Integer) value).intValue()); 
    267251      } 
    268252      else if (cType == long.class && value instanceof Long) { 
    269         array = Array.newInstance(long.class, 1); 
    270253        Array.setLong(array, 0, ((Long) value).longValue()); 
    271254      } 
    272255      else if (cType == short.class && value instanceof Short) { 
    273         array = Array.newInstance(short.class, 1); 
    274256        Array.setShort(array, 0, ((Short) value).shortValue()); 
    275257      } 
    276       if (array != null) return array; 
    277  
    278       throw new FormatException(getIFDTagName(tag) + 
    279         " directory entry is the wrong type (got " + 
    280         value.getClass().getName() + ", expected " + checkClass.getName()); 
     258      else { 
     259        throw new FormatException(getIFDTagName(tag) + 
     260          " directory entry is the wrong type (got " + 
     261          value.getClass().getName() + ", expected " + checkClass.getName()); 
     262      } 
     263 
     264      return array; 
    281265    } 
    282266    return value; 
     
    287271   * performing some error checking. 
    288272   */ 
    289   public long getIFDLongValue(int tag, 
    290     boolean checkNull, long defaultValue) throws FormatException 
     273  public long getIFDLongValue(int tag, long defaultValue) throws FormatException 
    291274  { 
    292275    long value = defaultValue; 
    293     Number number = (Number) getIFDValue(tag, checkNull, Number.class); 
     276    Number number = (Number) getIFDValue(tag, Number.class); 
    294277    if (number != null) value = number.longValue(); 
    295278    return value; 
     
    303286    int value = -1; 
    304287    try { 
    305       value = getIFDIntValue(tag, false, -1); 
     288      value = getIFDIntValue(tag, -1); 
    306289    } 
    307290    catch (FormatException exc) { } 
     
    313296   * performing some error checking. 
    314297   */ 
    315   public int getIFDIntValue(int tag, 
    316     boolean checkNull, int defaultValue) throws FormatException 
    317   { 
     298  public int getIFDIntValue(int tag, int defaultValue) throws FormatException { 
    318299    int value = defaultValue; 
    319     Number number = (Number) getIFDValue(tag, checkNull, Number.class); 
     300    Number number = (Number) getIFDValue(tag, Number.class); 
    320301    if (number != null) value = number.intValue(); 
    321302    return value; 
     
    326307   * performing some error checking. 
    327308   */ 
    328   public TiffRational getIFDRationalValue(int tag, boolean checkNull) 
    329     throws FormatException 
    330   { 
    331     return (TiffRational) getIFDValue(tag, checkNull, TiffRational.class); 
     309  public TiffRational getIFDRationalValue(int tag) throws FormatException { 
     310    return (TiffRational) getIFDValue(tag, TiffRational.class); 
    332311  } 
    333312 
     
    336315   * performing some error checking. 
    337316   */ 
    338   public String getIFDStringValue(int tag, boolean checkNull) 
    339     throws FormatException 
    340   { 
    341     return (String) getIFDValue(tag, checkNull, String.class); 
     317  public String getIFDStringValue(int tag) throws FormatException { 
     318    return (String) getIFDValue(tag, String.class); 
    342319  } 
    343320 
     
    380357   * from this IFD, performing some error checking. 
    381358   */ 
    382   public long[] getIFDLongArray(int tag, 
    383     boolean checkNull) throws FormatException 
    384   { 
    385     Object value = getIFDValue(tag, checkNull, null); 
     359  public long[] getIFDLongArray(int tag) throws FormatException { 
     360    Object value = getIFDValue(tag); 
    386361    long[] results = null; 
    387362    if (value instanceof long[]) results = (long[]) value; 
     
    412387   * from this IFD, performing some error checking. 
    413388   */ 
    414   public int[] getIFDIntArray(int tag, 
    415     boolean checkNull) throws FormatException 
    416   { 
    417     Object value = getIFDValue(tag, checkNull, null); 
     389  public int[] getIFDIntArray(int tag) throws FormatException { 
     390    Object value = getIFDValue(tag); 
    418391    int[] results = null; 
    419392    if (value instanceof int[]) results = (int[]) value; 
     
    445418   * from this IFD, performing some error checking. 
    446419   */ 
    447   public short[] getIFDShortArray(int tag, 
    448     boolean checkNull) throws FormatException 
    449   { 
    450     Object value = getIFDValue(tag, checkNull, null); 
     420  public short[] getIFDShortArray(int tag) throws FormatException { 
     421    Object value = getIFDValue(tag); 
    451422    short[] results = null; 
    452423    if (value instanceof short[]) results = (short[]) value; 
     
    484455  /** Returns the width of an image tile. */ 
    485456  public long getTileWidth() throws FormatException { 
    486     long tileWidth = getIFDLongValue(TILE_WIDTH, false, 0); 
     457    long tileWidth = getIFDLongValue(TILE_WIDTH, 0); 
    487458    return tileWidth == 0 ? getImageWidth() : tileWidth; 
    488459  } 
    489460 
    490461  /** Returns the length of an image tile. */ 
    491   public long getTileLength() 
    492     throws FormatException 
    493   { 
    494     long tileLength = getIFDLongValue(TILE_LENGTH, false, 0); 
     462  public long getTileLength() throws FormatException { 
     463    long tileLength = getIFDLongValue(TILE_LENGTH, 0); 
    495464    return tileLength == 0 ? getRowsPerStrip()[0] : tileLength; 
    496465  } 
     
    528497   */ 
    529498  public long getImageWidth() throws FormatException { 
    530     long width = getIFDLongValue(IMAGE_WIDTH, true, 0); 
     499    long width = getIFDLongValue(IMAGE_WIDTH, 0); 
    531500    if (width > Integer.MAX_VALUE) { 
    532501      throw new FormatException("Sorry, ImageWidth > " + Integer.MAX_VALUE + 
     
    542511   */ 
    543512  public long getImageLength() throws FormatException { 
    544     long length = getIFDLongValue(IMAGE_LENGTH, true, 0); 
     513    long length = getIFDLongValue(IMAGE_LENGTH, 0); 
    545514    if (length > Integer.MAX_VALUE) { 
    546515      throw new FormatException("Sorry, ImageLength > " + Integer.MAX_VALUE + 
     
    559528   */ 
    560529  public int[] getBitsPerSample() throws FormatException { 
    561     int[] bitsPerSample = getIFDIntArray(BITS_PER_SAMPLE, false); 
     530    int[] bitsPerSample = getIFDIntArray(BITS_PER_SAMPLE); 
    562531    if (bitsPerSample == null) bitsPerSample = new int[] {1}; 
    563532 
     
    642611   */ 
    643612  public int getSamplesPerPixel() throws FormatException { 
    644     return getIFDIntValue(SAMPLES_PER_PIXEL, false, 1); 
     613    return getIFDIntValue(SAMPLES_PER_PIXEL, 1); 
    645614  } 
    646615 
     
    666635  public TiffCompression getCompression() throws FormatException { 
    667636    return TiffCompression.get(getIFDIntValue( 
    668         COMPRESSION, false, TiffCompression.UNCOMPRESSED.getCode())); 
     637        COMPRESSION, TiffCompression.UNCOMPRESSED.getCode())); 
    669638  } 
    670639 
     
    688657   */ 
    689658  public PhotoInterp getPhotometricInterpretation() throws FormatException { 
    690     return PhotoInterp.get(getIFDIntValue(PHOTOMETRIC_INTERPRETATION, true, 0)); 
     659    Object photo = getIFDValue(PHOTOMETRIC_INTERPRETATION); 
     660    if (photo instanceof PhotoInterp) return (PhotoInterp) photo; 
     661    return PhotoInterp.get(((Number) photo).intValue()); 
    691662  } 
    692663 
     
    703674   */ 
    704675  public int getPlanarConfiguration() throws FormatException { 
    705     int planarConfig = getIFDIntValue(PLANAR_CONFIGURATION, false, 1); 
     676    int planarConfig = getIFDIntValue(PLANAR_CONFIGURATION, 1); 
    706677    if (planarConfig != 1 && planarConfig != 2) { 
    707678      throw new FormatException("Sorry, PlanarConfiguration (" + planarConfig + 
     
    723694  public long[] getStripOffsets() throws FormatException { 
    724695    int tag = isTiled() ? TILE_OFFSETS : STRIP_OFFSETS; 
    725     long[] offsets = getIFDLongArray(tag, false); 
     696    long[] offsets = getIFDLongArray(tag); 
    726697    if (isTiled() && offsets == null) { 
    727       offsets = getIFDLongArray(STRIP_OFFSETS, false); 
     698      offsets = getIFDLongArray(STRIP_OFFSETS); 
    728699    } 
    729700 
     
    750721  public long[] getStripByteCounts() throws FormatException { 
    751722    int tag = isTiled() ? TILE_BYTE_COUNTS : STRIP_BYTE_COUNTS; 
    752     long[] byteCounts = getIFDLongArray(tag, false); 
     723    long[] byteCounts = getIFDLongArray(tag); 
    753724    if (isTiled() && byteCounts == null) { 
    754       byteCounts = getIFDLongArray(STRIP_BYTE_COUNTS, false); 
     725      byteCounts = getIFDLongArray(STRIP_BYTE_COUNTS); 
    755726    } 
    756727    if (byteCounts == null) { 
     
    806777      return new long[] {getImageLength()}; 
    807778    } 
    808     long[] rowsPerStrip = getIFDLongArray(ROWS_PER_STRIP, false); 
     779    long[] rowsPerStrip = getIFDLongArray(ROWS_PER_STRIP); 
    809780    if (rowsPerStrip == null) { 
    810781      // create a fake RowsPerStrip entry if one is not present 
     
    861832      String v = null; 
    862833      if ((value instanceof Boolean) || (value instanceof Number) || 
    863         (value instanceof String)) 
     834        (value instanceof String) || (value instanceof PhotoInterp) || 
     835        (value instanceof TiffCompression)) 
    864836      { 
    865837        v = value.toString(); 
  • branches/cleanup/components/bio-formats/src/loci/formats/tiff/TiffCompression.java

    r5963 r5988  
    174174    throws FormatException 
    175175  { 
    176     int predictor = ifd.getIFDIntValue(IFD.PREDICTOR, false, 1); 
     176    int predictor = ifd.getIFDIntValue(IFD.PREDICTOR, 1); 
    177177    if (predictor == 2) { 
    178178      LOGGER.debug("reversing horizontal differencing"); 
  • branches/cleanup/components/bio-formats/src/loci/formats/tiff/TiffParser.java

    r5970 r5988  
    157157      long[] subOffsets = null; 
    158158      try { 
    159         subOffsets = ifd.getIFDLongArray(IFD.SUB_IFD, false); 
     159        subOffsets = ifd.getIFDLongArray(IFD.SUB_IFD); 
    160160      } 
    161161      catch (FormatException e) { } 
     
    204204    IFDList exif = new IFDList(); 
    205205    for (IFD ifd : ifds) { 
    206       long offset = ifd.getIFDLongValue(IFD.EXIF, false, 0); 
     206      long offset = ifd.getIFDLongValue(IFD.EXIF, 0); 
    207207      if (offset != 0) { 
    208208        IFD exifIFD = getIFD(offset); 
     
    510510    throws FormatException, IOException 
    511511  { 
    512     byte[] jpegTable = (byte[]) ifd.getIFDValue(IFD.JPEG_TABLES, false, null); 
     512    byte[] jpegTable = (byte[]) ifd.getIFDValue(IFD.JPEG_TABLES); 
    513513 
    514514    CodecOptions options = new CodecOptions(); 
     
    773773    float lumaGreen = PhotoInterp.LUMA_GREEN; 
    774774    float lumaBlue = PhotoInterp.LUMA_BLUE; 
    775     int[] reference = ifd.getIFDIntArray(IFD.REFERENCE_BLACK_WHITE, false); 
     775    int[] reference = ifd.getIFDIntArray(IFD.REFERENCE_BLACK_WHITE); 
    776776    if (reference == null) { 
    777777      reference = new int[] {0, 0, 0, 0, 0, 0}; 
    778778    } 
    779     int[] subsampling = ifd.getIFDIntArray(IFD.Y_CB_CR_SUB_SAMPLING, false); 
     779    int[] subsampling = ifd.getIFDIntArray(IFD.Y_CB_CR_SUB_SAMPLING); 
    780780    TiffRational[] coefficients = (TiffRational[]) 
    781781      ifd.getIFDValue(IFD.Y_CB_CR_COEFFICIENTS); 
Note: See TracChangeset for help on using the changeset viewer.