Changeset 3904


Ignore:
Timestamp:
04/09/08 12:46:31 (12 years ago)
Author:
melissa
Message:

Removed swapIfRequired - because of recent fixes to TiffTools, it's no longer needed.

Location:
trunk/loci/formats/in
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/in/BaseTiffReader.java

    r3900 r3904  
    747747    if (o instanceof String[]) return ((String[]) o)[0]; 
    748748    return null; 
    749   } 
    750  
    751   /** 
    752    * Examines a byte array to see if it needs to be byte swapped and modifies 
    753    * the byte array directly. 
    754    * @param byteArray The byte array to check and modify if required. 
    755    * @return the <i>byteArray</i> either swapped or not for convenience. 
    756    * @throws IOException if there is an error read from the file. 
    757    * @throws FormatException if there is an error during metadata parsing. 
    758    */ 
    759   protected byte[] swapIfRequired(byte[] byteArray) 
    760     throws FormatException, IOException 
    761   { 
    762     int bitsPerSample = TiffTools.getBitsPerSample(ifds[0])[0]; 
    763  
    764     // We've got nothing to do if the samples are only 8-bits wide or if they 
    765     // are floating point. 
    766     if (bitsPerSample == 8 || bitsPerSample == 32) return byteArray; 
    767  
    768     if (isLittleEndian()) { 
    769       if (bitsPerSample == 16) { // short 
    770         ShortBuffer buf = ByteBuffer.wrap(byteArray).asShortBuffer(); 
    771         for (int i = 0; i < (byteArray.length / 2); i++) { 
    772           buf.put(i, DataTools.swap(buf.get(i))); 
    773         } 
    774       } 
    775       else { 
    776         throw new FormatException( 
    777           "Unsupported sample bit width: '" + bitsPerSample + "'"); 
    778       } 
    779     } 
    780     // We've got a big-endian file with a big-endian byte array. 
    781     return byteArray; 
    782749  } 
    783750 
  • trunk/loci/formats/in/OMETiffReader.java

    r3900 r3904  
    394394    TiffTools.getSamples(usedIFDs[fileIndex][ifd], in, buf, x, y, w, h); 
    395395    in.close(); 
    396     return swapIfRequired(buf); 
     396    return buf; 
    397397  } 
    398398 
  • trunk/loci/formats/in/SVSReader.java

    r3854 r3904  
    6666 
    6767    TiffTools.getSamples(ifds[series], in, buf, x, y, w, h); 
    68     return swapIfRequired(buf); 
     68    return buf; 
    6969  } 
    7070 
  • trunk/loci/formats/in/ZeissLSMReader.java

    r3900 r3904  
    172172      TiffTools.getSamples(ifds[0], in, buf, x, no, w, 1); 
    173173    } 
    174     return swapIfRequired(buf); 
     174    return buf; 
    175175  } 
    176176 
Note: See TracChangeset for help on using the changeset viewer.