Changeset 3392


Ignore:
Timestamp:
11/20/07 15:17:07 (12 years ago)
Author:
melissa
Message:
  • Fixed SimplePCI endianness
  • Fixed PICT channel separation bug
  • Fixed TIFF LUT issue
  • Fixed core metadata issues in Leica LEI reader
  • Fixed bug with single-plane ND2 files
  • JPEGCodec now forces the built-in JPEG reader to be tried first
  • Tweaked wording of what's new for next release
Location:
trunk/loci/formats
Files:
9 edited

Legend:

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

    r3275 r3392  
    460460      getBytesPerPixel(r.getPixelType()); 
    461461    if (size > len) { 
    462       throw new FormatException("Buffer too small."); 
     462      throw new FormatException("Buffer too small (got " + len + 
     463        ", expected " + size + ")."); 
    463464    } 
    464465  } 
  • trunk/loci/formats/codec/JPEGCodec.java

    r3378 r3392  
    2727import java.awt.image.BufferedImage; 
    2828import java.io.*; 
     29import java.util.Iterator; 
    2930import javax.imageio.ImageIO; 
    3031import javax.imageio.spi.*; 
     
    7677      while (in.read() != (byte) 0xff || in.read() != (byte) 0xd8); 
    7778      in.seek(in.getFilePointer() - 2); 
    78       b = ImageIO.read(new BufferedInputStream(in)); 
     79 
     80      Iterator it = ImageIO.getImageReadersBySuffix("jpg"); 
     81      javax.imageio.ImageReader r = null; 
     82      String cname = "com.sun.imageio.plugins.jpeg.JPEGImageReader"; 
     83      while (it.hasNext()) { 
     84        Object tmp = it.next(); 
     85        if (tmp.getClass().getName().equals(cname)) { 
     86          r = (javax.imageio.ImageReader) tmp; 
     87        } 
     88      } 
     89 
     90      if (r == null) throw new IOException(""); 
     91 
     92      r.setInput(ImageIO.createImageInputStream(new BufferedInputStream(in))); 
     93      b = r.read(0); 
    7994    } 
    8095    catch (IOException exc) { 
     
    95110        in.seek(in.getFilePointer() - 2); 
    96111 
    97         ImageInputStream ii = ImageIO.createImageInputStream(in); 
     112        ImageInputStream ii = 
     113          ImageIO.createImageInputStream(new BufferedInputStream(in)); 
    98114        r.setInput(ii); 
    99115        b = r.read(0); 
  • trunk/loci/formats/doc/whats-new.txt

    r3391 r3392  
    1 2007 Nov 20: 
     12007 Nov 21: 
    22* Fixed bugs in ND2, Leica LIF, DICOM, Zeiss ZVI, Zeiss LSM, FV1000 OIB, 
    33  FV1000 OIF, BMP, Evotec Flex, BioRad PIC, Slidebook, TIFF 
     
    77* Improved stack slicing and colorizing logic in importer plugin 
    88* Added support for DICOM files compressed with lossless JPEG 
    9 * Added support for signed pixel data 
    10 * Added support for Imaris 5.5 files 
     9    - requires native libraries 
     10* Fixed bugs with signed pixel data 
     11* Added support for Imaris 5.5 (HDF) files 
    1112* Added 4 channel merging to importer plugin 
    1213* Added API methods for reading subimages 
  • trunk/loci/formats/in/BaseTiffReader.java

    r3354 r3392  
    9292      for (int j=0; j<table.length; j++) { 
    9393        for (int i=0; i<table[0].length; i++) { 
    94           table[j][i] = (byte) (colorMap[next++] & 0xff); 
     94          table[j][i] = (byte) ((colorMap[next++] >> 8) & 0xff); 
    9595        } 
    9696      } 
     
    526526    int samples = TiffTools.getIFDIntValue(ifds[0], 
    527527      TiffTools.SAMPLES_PER_PIXEL, false, 1); 
    528     core.rgb[0] = samples > 1 || p == TiffTools.RGB_PALETTE || 
    529       p == TiffTools.CFA_ARRAY || p == TiffTools.RGB; 
     528    core.rgb[0] = samples > 1 || p == TiffTools.RGB; 
    530529    core.interleaved[0] = false; 
    531530    core.littleEndian[0] = TiffTools.isLittleEndian(ifds[0]); 
     
    539538    core.sizeT[0] = ifds.length; 
    540539    core.metadataComplete[0] = true; 
    541     core.indexed[0] = TiffTools.getIFDIntValue(ifds[0], 
    542       TiffTools.PHOTOMETRIC_INTERPRETATION) == TiffTools.RGB_PALETTE && 
     540    core.indexed[0] = p == TiffTools.RGB_PALETTE && 
    543541      (get8BitLookupTable() != null || get16BitLookupTable() != null); 
    544542    if (core.sizeC[0] == 1 && !core.indexed[0]) core.rgb[0] = false; 
  • trunk/loci/formats/in/LeicaReader.java

    r3354 r3392  
    987987    for (int i=0; i<numSeries; i++) { 
    988988      core.orderCertain[i] = true; 
    989       core.interleaved[i] = true; 
    990989 
    991990      in.seek(0); 
     
    1000999      if (core.sizeZ[i] == 0) core.sizeZ[i] = 1; 
    10011000 
    1002       switch (bpp) { 
    1003         case 1: 
    1004           core.pixelType[i] = FormatTools.UINT8; 
    1005           break; 
    1006         case 2: 
    1007           core.pixelType[i] = FormatTools.UINT16; 
    1008           break; 
    1009         case 3: 
    1010           core.pixelType[i] = FormatTools.INT8; 
    1011           break; 
    1012         case 4: 
    1013           core.pixelType[i] = FormatTools.INT32; 
    1014           break; 
    1015         case 6: 
    1016           core.pixelType[i] = FormatTools.INT16; 
    1017           break; 
    1018         case 8: 
    1019           core.pixelType[i] = FormatTools.DOUBLE; 
    1020           break; 
    1021       } 
    1022  
    1023       core.rgb[i] = 
    1024         core.imageCount[i] != core.sizeC[i] * core.sizeZ[i] * core.sizeT[i]; 
    1025  
    10261001      Integer ii = new Integer(i); 
    10271002 
    1028       core.rgb[i] = false; 
    1029       //core.sizeC[i] *= 3; 
    1030  
    1031       core.indexed[i] = true; 
     1003      tiff[i][0].setId((String) files[i].get(0)); 
     1004      core.indexed[i] = tiff[i][0].isIndexed(); 
     1005      core.rgb[i] = tiff[i][0].isRGB(); 
     1006      if (core.rgb[i]) core.sizeC[i] *= 3; 
     1007      core.interleaved[i] = tiff[i][0].isInterleaved(); 
     1008      core.pixelType[i] = tiff[i][0].getPixelType(); 
    10321009      core.falseColor[i] = true; 
    10331010      core.metadataComplete[i] = true; 
  • trunk/loci/formats/in/ND2Reader.java

    r3388 r3392  
    730730    } 
    731731 
     732    if (core.imageCount[0] == 0) core.imageCount[0] = 1; 
     733    if (core.sizeZ[0] == 0) core.sizeZ[0] = 1; 
     734    if (core.sizeC[0] == 0) core.sizeC[0] = 1; 
     735    if (core.sizeT[0] == 0) core.sizeT[0] = 1; 
     736 
    732737    Arrays.fill(core.sizeZ, core.sizeZ[0]); 
    733738    Arrays.fill(core.sizeT, core.sizeT[0]); 
     
    738743    offsets = new long[1][2]; 
    739744    offsets[0][0] = ((Long) vs.get(0)).longValue(); 
    740     offsets[0][1] = ((Long) vs.get(1)).longValue(); 
     745    if (offsets[0].length > 1 && vs.size() > 1) { 
     746      offsets[0][1] = ((Long) vs.get(1)).longValue(); 
     747    } 
    741748    BufferedImage img = openImage(0); 
    742749    Arrays.fill(core.sizeX, img.getWidth()); 
    743750    Arrays.fill(core.sizeY, img.getHeight()); 
    744751    if (core.sizeC[0] == 0) core.sizeC[0] = 1; 
    745     int c = img.getRaster().getNumBands() * core.sizeC[0]; 
     752    int numBands = img.getRaster().getNumBands(); 
     753    int c = numBands > 1 ? numBands : core.sizeC[0]; 
    746754    Arrays.fill(core.sizeC, c); 
    747     Arrays.fill(core.rgb, img.getRaster().getNumBands() > 1); 
     755    Arrays.fill(core.rgb, numBands > 1); 
    748756    Arrays.fill(core.pixelType, ImageTools.getPixelType(img)); 
     757 
     758    if (!core.rgb[0] && core.imageCount[0] == 1) { 
     759      Arrays.fill(core.sizeC, 1); 
     760    } 
    749761 
    750762    if (vs.size() < core.imageCount[0]) { 
  • trunk/loci/formats/in/NRRDReader.java

    r3197 r3392  
    9191  } 
    9292 
     93  // -- IFormatHandler API methods -- 
     94 
    9395  /* @see loci.formats.IFormatReader#close() */ 
    9496  public void close() throws IOException { 
    9597    super.close(); 
    9698    if (helper != null) helper.close(); 
     99    helper = null; 
     100    dataFile = encoding = null; 
     101    offset = 0; 
    97102  } 
    98103 
  • trunk/loci/formats/in/PCIReader.java

    r3372 r3392  
    179179      core.interleaved[0] = false; 
    180180      core.currentOrder[0] = "XYCZT"; 
    181       core.littleEndian[0] = true; 
     181      core.littleEndian[0] = false; 
    182182      core.indexed[0] = false; 
    183183      core.falseColor[0] = false; 
  • trunk/loci/formats/in/PictReader.java

    r3339 r3392  
    278278    throws FormatException, IOException 
    279279  { 
    280     buf = ImageTools.getBytes(openImage(no), false, no % 3); 
     280    FormatTools.checkBufferSize(this, buf.length); 
     281    byte[][] b = ImageTools.getPixelBytes(openImage(no), core.littleEndian[0]); 
     282    for (int i=0; i<b.length; i++) { 
     283      System.arraycopy(b[i], 0, buf, i*b[i].length, b[i].length); 
     284    } 
    281285    return buf; 
    282286  } 
Note: See TracChangeset for help on using the changeset viewer.