Changeset 6218


Ignore:
Timestamp:
05/03/10 13:47:18 (10 years ago)
Author:
melissa
Message:
  • Cache previously opened LSM plane if channels are being split.
  • Disabled memory-mapped byte buffers, as there have been a number of bug reports related to memory-mapped buffer usage. If you really want to use memory-mapped buffers, set the 'mappedBuffers' system property to 'true'.
Location:
trunk/components
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats/src/loci/formats/in/ZeissLSMReader.java

    r6217 r6218  
    167167  private int totalROIs = 0; 
    168168 
     169  private int prevPlane = -1; 
     170  private byte[] prevBuf = null; 
     171 
    169172  // -- Constructor -- 
    170173 
     
    202205      binning = null; 
    203206      totalROIs = 0; 
     207      prevPlane = -1; 
     208      prevBuf = null; 
    204209    } 
    205210  } 
     
    287292      int c = no % getSizeC(); 
    288293 
    289       byte[] b = new byte[buf.length * getSizeC()]; 
    290       tiffParser.getSamples(ifds.get(plane), b, x, y, w, h); 
    291       ImageTools.splitChannels(b, buf, c, getSizeC(), bpp, false, false); 
     294      if (prevPlane != plane || prevBuf == null) { 
     295        prevBuf = new byte[buf.length * getSizeC()]; 
     296        tiffParser.getSamples(ifds.get(plane), prevBuf, x, y, w, h); 
     297        prevPlane = plane; 
     298      } 
     299      ImageTools.splitChannels(prevBuf, buf, c, getSizeC(), bpp, false, false); 
    292300    } 
    293301    else tiffParser.getSamples(ifds.get(no), buf, x, y, w, h); 
  • trunk/components/common/src/loci/common/NIOByteBufferProvider.java

    r6155 r6218  
    7171 
    7272  static { 
    73     String osArch = System.getProperty("os.arch"); 
    74     String javaVersion = System.getProperty("java.version"); 
    75     if ("amd64".equals(osArch) || "x86_64".equals(osArch)) { 
    76       // We're on a 64-bit platform; we're safe to use memory mapped I/O 
    77       // without consequence. 
    78       useMappedByteBuffer = true; 
    79     } 
    80     else if (osArch == null) { 
    81       LOGGER.warn("Java Virtual Machine os.arch system property missing!"); 
    82     } 
    83     else if (javaVersion == null) { 
    84       LOGGER.warn("Java Virtual Machine os.arch system property missing!"); 
    85     } 
    86     else { 
    87       // Check if we're on a Java 1.6 VM where we're safe to use memory 
    88       // mapped I/O without consequence regardless of architecture. 
    89       StringTokenizer tokenizer = new StringTokenizer(javaVersion, "."); 
    90       try { 
    91         // Ensure we have an integer here at least 
    92         Integer.parseInt(tokenizer.nextToken()); 
    93         // This is the actual "major" version number we want to check 
    94         int y = Integer.parseInt(tokenizer.nextToken()); 
    95         if (y >= MINIMUM_JAVA_VERSION) { 
    96           useMappedByteBuffer = true; 
    97         } 
    98         else { 
    99           useMappedByteBuffer = false; 
    100         } 
    101       } 
    102       catch (Exception e) { 
    103         LOGGER.warn("Error parsing x.y.z Java version string.", e); 
    104       } 
    105     } 
     73    String mapping = System.getProperty("mappedBuffers"); 
     74    useMappedByteBuffer = Boolean.parseBoolean(mapping); 
    10675    LOGGER.info("Using mapped byte buffer? " + useMappedByteBuffer); 
    10776  } 
Note: See TracChangeset for help on using the changeset viewer.