Changeset 4879


Ignore:
Timestamp:
03/03/09 08:45:23 (11 years ago)
Author:
melissa
Message:

Synced 4.0.0 branch to r4878 (including r4804).

Location:
branches/4.0.0/components
Files:
22 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/4.0.0/components/bio-formats/src/loci/formats/AWTImageTools.java

    r4872 r4879  
    786786      } 
    787787      else if (pixelType == FormatTools.INT16) { 
    788         model = new SignedColorModel(16, DataBuffer.TYPE_SHORT, rgbChanCount); 
     788        model = new SignedColorModel(16, DataBuffer.TYPE_USHORT, rgbChanCount); 
    789789      } 
    790790      else if (pixelType == FormatTools.INT32) { 
  • branches/4.0.0/components/bio-formats/src/loci/formats/ChannelFiller.java

    r4570 r4879  
    175175    throws FormatException, IOException 
    176176  { 
     177    int pixelType = getPixelType(); 
    177178    return AWTImageTools.makeImage(openBytes(no, x, y, w, h), w, h, 
    178179      getRGBChannelCount(), isInterleaved(), 
    179       FormatTools.getBytesPerPixel(getPixelType()), isLittleEndian()); 
     180      FormatTools.getBytesPerPixel(pixelType), 
     181      FormatTools.isFloatingPoint(pixelType), isLittleEndian(), 
     182      FormatTools.isSigned(pixelType)); 
    180183  } 
    181184 
  • branches/4.0.0/components/bio-formats/src/loci/formats/FormatReader.java

    r4872 r4879  
    189189      if (!simple) return; 
    190190 
    191       // verify key & value are not empty 
    192       if (key.length() == 0) return; 
    193       if (string && val.length() == 0) return; 
    194  
    195191      // verify key & value are reasonable length 
    196192      int maxLen = 8192; 
     
    213209        if (string) val = val.replaceAll(invalidSequences[i], ""); 
    214210      } 
     211 
     212      // verify key & value are not empty 
     213      if (key.length() == 0) return; 
     214      if (string && val.trim().length() == 0) return; 
    215215 
    216216      if (string) value = val; 
  • branches/4.0.0/components/bio-formats/src/loci/formats/FormatWriter.java

    r4872 r4879  
    9999 
    100100    BufferedImage img = AWTImageTools.makeImage(bytes, width, height, channels, 
    101       true, FormatTools.getBytesPerPixel(type), littleEndian); 
     101      true, FormatTools.getBytesPerPixel(type), 
     102      FormatTools.isFloatingPoint(type), littleEndian, 
     103      FormatTools.isSigned(type)); 
    102104    saveImage(img, series, lastInSeries, last); 
    103105  } 
  • branches/4.0.0/components/bio-formats/src/loci/formats/gui/ImageViewer.java

    r4584 r4879  
    203203 
    204204    // image icon 
    205     BufferedImage dummy = AWTImageTools.makeImage(new byte[1][1], 1, 1); 
     205    BufferedImage dummy = AWTImageTools.makeImage(new byte[1][1], 1, 1, false); 
    206206    icon = new ImageIcon(dummy); 
    207207    iconLabel = new JLabel(icon, SwingConstants.LEFT); 
  • branches/4.0.0/components/bio-formats/src/loci/formats/in/DeltavisionReader.java

    r4872 r4879  
    725725          values = (String[]) realValues.toArray(new String[0]); 
    726726 
    727           int zz = Integer.parseInt(values[0].trim()) - 1; 
    728           int index = getIndex(zz, cc, tt); 
    729           for (int i=1; i<keys.length; i++) { 
    730             addMeta("Plane " + index + " " + keys[i], values[i]); 
     727          try { 
     728            int zz = Integer.parseInt(values[0].trim()) - 1; 
     729            int index = getIndex(zz, cc, tt); 
     730            for (int i=1; i<keys.length; i++) { 
     731              addMeta("Plane " + index + " " + keys[i], values[i]); 
     732            } 
    731733          } 
     734          catch (NumberFormatException e) { } 
    732735          line = s.readLine().trim(); 
    733736        } 
  • branches/4.0.0/components/bio-formats/src/loci/formats/in/MNGReader.java

    r4677 r4879  
    104104    // ImageIO often returns images that cannot be scaled because a 
    105105    // BytePackedRaster is used 
    106     byte[][] pix = AWTImageTools.getPixelBytes(img, isLittleEndian()); 
     106    int pixelType = getPixelType(); 
     107    boolean little = isLittleEndian(); 
     108    byte[][] pix = AWTImageTools.getPixelBytes(img, little); 
    107109    img = AWTImageTools.makeImage(pix, w, h, 
    108       FormatTools.getBytesPerPixel(getPixelType()), isLittleEndian()); 
     110      FormatTools.getBytesPerPixel(pixelType), 
     111      FormatTools.isFloatingPoint(pixelType), little, 
     112      FormatTools.isSigned(pixelType)); 
    109113 
    110114    return img; 
  • branches/4.0.0/components/bio-formats/src/loci/formats/tools/ImageInfo.java

    r4872 r4879  
    496496          Object pix = DataTools.makeDataArray(b, 
    497497            FormatTools.getBytesPerPixel(pixelType), 
    498             pixelType == FormatTools.FLOAT, 
     498            FormatTools.isFloatingPoint(pixelType), 
    499499            reader.isLittleEndian()); 
    500500          images[i - start] = AWTImageTools.makeImage( 
    501             ImageTools.make24Bits(pix, x, y, false, false), x, y); 
     501            ImageTools.make24Bits(pix, x, y, false, false), x, y, 
     502            FormatTools.isSigned(pixelType)); 
    502503        } 
    503504 
  • branches/4.0.0/components/common/src/loci/common/DataTools.java

    r4765 r4879  
    515515    boolean little) 
    516516  { 
    517     return makeDataArray(b, bpp, fp, little, false); 
    518   } 
    519  
    520   /** 
    521    * Convert a byte array to the appropriate primitive type array. 
    522    * @param b Byte array to convert. 
    523    * @param bpp Denotes the number of bytes in the returned primitive type 
    524    *   (e.g. if bpp == 2, we should return an array of type short). 
    525    * @param fp If set and bpp == 4 or bpp == 8, then return floats or doubles. 
    526    * @param little Whether byte array is in little-endian order. 
    527    */ 
    528   public static Object makeDataArray(byte[] b, 
    529     int bpp, boolean fp, boolean little, boolean signed) 
    530   { 
    531517    if (bpp == 1) { 
    532518      return b; 
     
    568554    } 
    569555    return null; 
     556  } 
     557 
     558  /** 
     559   * @deprecated Use {@link #makeDataArray(byte[], int, boolean, boolean)} 
     560   *   regardless of signedness. 
     561   */ 
     562  public static Object makeDataArray(byte[] b, 
     563    int bpp, boolean fp, boolean little, boolean signed) 
     564  { 
     565    return makeDataArray(b, bpp, fp, little); 
    570566  } 
    571567 
  • branches/4.0.0/components/legacy/ome-notes/src/loci/ome/notes/TemplateField.java

    r4550 r4879  
    147147    else if (type.equals("thumbnail")) { 
    148148      ImageIcon icon = 
    149         new ImageIcon(AWTImageTools.makeImage(new byte[1][1], 1, 1)); 
     149        new ImageIcon(AWTImageTools.makeImage(new byte[1][1], 1, 1, false)); 
    150150      component = new JLabel(icon, SwingConstants.LEFT); 
    151151    } 
     
    193193    else if (type.equals("thumbnail")) { 
    194194      ImageIcon icon = 
    195         new ImageIcon(AWTImageTools.makeImage(new byte[1][1], 1, 1)); 
     195        new ImageIcon(AWTImageTools.makeImage(new byte[1][1], 1, 1, false)); 
    196196      comp = new JLabel(icon, SwingConstants.LEFT); 
    197197    } 
  • branches/4.0.0/components/loci-plugins/src/loci/plugins/Exporter.java

    r4872 r4879  
    296296              b[j] = (byte[]) is.getProcessor(i + j + 1).getPixels(); 
    297297            } 
    298             img = AWTImageTools.makeImage(b, x, y); 
     298            img = AWTImageTools.makeImage(b, x, y, false); 
    299299          } 
    300300          else { 
    301301            byte[] b = (byte[]) proc.getPixels(); 
    302             img = AWTImageTools.makeImage(b, x, y); 
     302            img = AWTImageTools.makeImage(b, x, y, false); 
    303303          } 
    304304        } 
     
    309309              s[j] = (short[]) is.getProcessor(i + j + 1).getPixels(); 
    310310            } 
    311             img = AWTImageTools.makeImage(s, x, y); 
     311            img = AWTImageTools.makeImage(s, x, y, false); 
    312312          } 
    313313          else { 
    314314            short[] s = (short[]) proc.getPixels(); 
    315             img = AWTImageTools.makeImage(s, x, y); 
     315            img = AWTImageTools.makeImage(s, x, y, false); 
    316316          } 
    317317        } 
     
    332332          byte[][] pix = new byte[3][x*y]; 
    333333          ((ColorProcessor) proc).getRGB(pix[0], pix[1], pix[2]); 
    334           img = AWTImageTools.makeImage(pix, x, y); 
     334          img = AWTImageTools.makeImage(pix, x, y, false); 
    335335        } 
    336336 
  • branches/4.0.0/components/native/itk-plugin/CMakeLists.txt

    r4872 r4879  
    2323# http://viewvc.slicer.org/viewcvs.cgi/trunk/Libs/MGHImageIO/ 
    2424# 
    25 # See slicer-license.txt for licensing information. 
     25# See slicer-license.txt for Slicer3's licensing information. 
    2626# 
    2727# For more information about the ITK Plugin IO mechanism, see: 
  • branches/4.0.0/components/native/itk-plugin/itkBioFormatsIOPlugin.cxx

    r4872 r4879  
    2626http://viewvc.slicer.org/viewcvs.cgi/trunk/Libs/MGHImageIO/ 
    2727 
    28 See slicer-license.txt for licensing information. 
     28See slicer-license.txt for Slicer3's licensing information. 
    2929 
    3030For more information about the ITK Plugin IO mechanism, see: 
  • branches/4.0.0/components/native/itk-plugin/itkBioFormatsIOPlugin.h

    r4872 r4879  
    2626http://viewvc.slicer.org/viewcvs.cgi/trunk/Libs/MGHImageIO/ 
    2727 
    28 See slicer-license.txt for licensing information. 
     28See slicer-license.txt for Slicer3's licensing information. 
    2929 
    3030For more information about the ITK Plugin IO mechanism, see: 
  • branches/4.0.0/components/native/itk-plugin/itkBioFormatsIOWin32Header.h

    r4872 r4879  
    2626http://viewvc.slicer.org/viewcvs.cgi/trunk/Libs/MGHImageIO/ 
    2727 
    28 See slicer-license.txt for licensing information. 
     28See slicer-license.txt for Slicer3's licensing information. 
    2929 
    3030For more information about the ITK Plugin IO mechanism, see: 
  • branches/4.0.0/components/native/itk-plugin/itkBioFormatsImageIO.cxx

    r4872 r4879  
    2626http://viewvc.slicer.org/viewcvs.cgi/trunk/Libs/MGHImageIO/ 
    2727 
    28 See slicer-license.txt for licensing information. 
     28See slicer-license.txt for Slicer3's licensing information. 
    2929 
    3030For more information about the ITK Plugin IO mechanism, see: 
  • branches/4.0.0/components/native/itk-plugin/itkBioFormatsImageIO.h

    r4872 r4879  
    2626http://viewvc.slicer.org/viewcvs.cgi/trunk/Libs/MGHImageIO/ 
    2727 
    28 See slicer-license.txt for licensing information. 
     28See slicer-license.txt for Slicer3's licensing information. 
    2929 
    3030For more information about the ITK Plugin IO mechanism, see: 
  • branches/4.0.0/components/native/itk-plugin/itkBioFormatsImageIOConfigure.h.in

    r4872 r4879  
    2626http://viewvc.slicer.org/viewcvs.cgi/trunk/Libs/MGHImageIO/ 
    2727 
    28 See slicer-license.txt for licensing information. 
     28See slicer-license.txt for Slicer3's licensing information. 
    2929 
    3030For more information about the ITK Plugin IO mechanism, see: 
  • branches/4.0.0/components/native/itk-plugin/itkBioFormatsImageIOFactory.cxx

    r4872 r4879  
    2626http://viewvc.slicer.org/viewcvs.cgi/trunk/Libs/MGHImageIO/ 
    2727 
    28 See slicer-license.txt for licensing information. 
     28See slicer-license.txt for Slicer3's licensing information. 
    2929 
    3030For more information about the ITK Plugin IO mechanism, see: 
  • branches/4.0.0/components/native/itk-plugin/itkBioFormatsImageIOFactory.h

    r4872 r4879  
    2626http://viewvc.slicer.org/viewcvs.cgi/trunk/Libs/MGHImageIO/ 
    2727 
    28 See slicer-license.txt for licensing information. 
     28See slicer-license.txt for Slicer3's licensing information. 
    2929 
    3030For more information about the ITK Plugin IO mechanism, see: 
  • branches/4.0.0/components/native/itk-plugin/readme.txt

    r4872 r4879  
    44This package provides an ImageIO plugin for ITK that uses Bio-Formats 
    55to read and write supported life sciences file formats. 
     6 
     7The initial plugin implementation is complete. However, there are a number of 
     8symbol lookup errors at runtime, so portions of the functionality are currently 
     9commented out to avoid them. 
     10 
     11 
     12LICENSE 
     13 
     14OME Bio-Formats package for reading and converting biological file formats. 
     15Copyright (C) 2005-@year@ UW-Madison LOCI and Glencoe Software, Inc. 
     16 
     17This program is free software; you can redistribute it and/or modify 
     18it under the terms of the GNU General Public License as published by 
     19the Free Software Foundation; either version 3 of the License, or 
     20(at your option) any later version. 
     21 
     22This program is distributed in the hope that it will be useful, 
     23but WITHOUT ANY WARRANTY; without even the implied warranty of 
     24MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     25GNU General Public License for more details. 
     26 
     27You should have received a copy of the GNU General Public License 
     28along with this program; if not, write to the Free Software 
     29Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
     30 
     31Adapted from the Slicer3 project: http://www.slicer.org/ 
     32http://viewvc.slicer.org/viewcvs.cgi/trunk/Libs/MGHImageIO/ 
     33 
     34See slicer-license.txt for Slicer3's licensing information. 
     35 
     36For more information about the ITK Plugin IO mechanism, see: 
     37http://www.itk.org/Wiki/Plugin_IO_mechanisms 
     38 
     39 
     40BUILDING AND TESTING THE PLUGIN ON LINUX 
     41 
     421) Download and build the Insight Toolkit source code from: 
     43 
     44  http://www.itk.org/ITK/resources/software.html 
     45 
     462) Follow the directions in components/native/bf-cpp to build the Bio-Formats 
     47   C++ bindings. 
     48 
     493) Change to this directory (components/native/itk-plugin). 
     50 
     514) Run the (lame, temporary) build script: 
     52 
     53  ITK_DIR=/path/to/itk/build sh build.sh 2> /dev/null 
     54 
     555) After the build succeeds, the script will copy dependent libraries 
     56   (libjace.so, libbfjace.so, jace-runtime.jar and loci_tools.jar) into the ITK 
     57   binaries directory, then suggest some commands to proceed in testing. These 
     58   commands boil down to: a) set ITK_AUTOLOAD_PATH; b) run ImageHistogram1 
     59   example program on a TIFF file; c) optionally, clear ITK_AUTOLOAD_PATH and 
     60   rerun to compare against the results with ITK's built-in TIFF reader. 
     61 
     62If you get this far, you will have noticed that the histogram is always filled 
     63with 255s. This is because the plugin does not currently copy the planar data 
     64between data structures, due to one of the symbol lookup errors. 
     65 
     66 
     67SYMBOL LOOKUP ERRORS 
     68 
     69As a rule of thumb, anything labeled "NB:" or "TEMP" in the 
     70itkBioFormatsImageIO.cxx source file documents a known problem and/or 
     71associated workaround at the moment, the most show-stopping of which are the 
     72symbol lookup errors. 
     73 
     74For example, from lines 260-2 of itkBioFormatsImageIO.cxx: 
     75 
     76  // NB: Using brackets with a JArray causes a symbol lookup error on: 
     77  //     _ZN4jace6helper12newGlobalRefEP10_Jv_JNIEnvP9__jobject 
     78  //for (int i=0; i<bytesPerSubPlane; i++) data[p++] = buf[i]; 
     79 
     80Uncommenting the for loop and rerunning the build script yields: 
     81 
     82  $ ./ImageHistogram1 image.tif 
     83  *snip output* 
     84  Reading image plane 1/1 
     85  ./ImageHistogram1: symbol lookup error: libBioFormatsIO.so: undefined symbol: _ZN4jace6helper12newGlobalRefEP10_Jv_JNIEnvP9__jobject 
     86 
     87Dumping the relevant symbols from libjace.so yields: 
     88 
     89  $ nm libjace.so | grep newGlobalRef 
     90  00025621 T _ZN4jace6helper12newGlobalRefEP7JNIEnv_P8_jobject 
     91 
     92So the symbol is essentially there, but slightly different... 
  • branches/4.0.0/components/test-suite/src/loci/tests/ImageTester.java

    r4550 r4879  
    166166        } 
    167167      } 
    168       bimg1[q] = AWTImageTools.makeImage(bdata1, w, h); 
    169       bimg2[q] = AWTImageTools.makeImage(bdata2, w, h, c, true); 
    170       bimg3[q] = AWTImageTools.makeImage(bdata3, w, h, c, false); 
    171       simg1[q] = AWTImageTools.makeImage(sdata1, w, h); 
    172       simg2[q] = AWTImageTools.makeImage(sdata2, w, h, c, true); 
    173       simg3[q] = AWTImageTools.makeImage(sdata3, w, h, c, false); 
    174 //      iimg1[q] = AWTImageTools.makeImage(idata1, w, h); 
    175 //      iimg2[q] = AWTImageTools.makeImage(idata2, w, h, c, true); 
    176 //      iimg3[q] = AWTImageTools.makeImage(idata3, w, h, c, false); 
     168      boolean signedBytes = false; 
     169      bimg1[q] = AWTImageTools.makeImage(bdata1, w, h, signedBytes); 
     170      bimg2[q] = AWTImageTools.makeImage(bdata2, w, h, c, true, signedBytes); 
     171      bimg3[q] = AWTImageTools.makeImage(bdata3, w, h, c, false, signedBytes); 
     172      boolean signedShorts = false; 
     173      simg1[q] = AWTImageTools.makeImage(sdata1, w, h, signedShorts); 
     174      simg2[q] = AWTImageTools.makeImage(sdata2, w, h, c, true, signedShorts); 
     175      simg3[q] = AWTImageTools.makeImage(sdata3, w, h, c, false, signedShorts); 
     176//      boolean signedInts = true; 
     177//      iimg1[q] = AWTImageTools.makeImage(idata1, w, h, signedInts); 
     178//      iimg2[q] = AWTImageTools.makeImage(idata2, w, h, c, true, signedInts); 
     179//      iimg3[q] = AWTImageTools.makeImage(idata3, w, h, c, false, signedInts); 
    177180    } 
    178181 
Note: See TracChangeset for help on using the changeset viewer.