Changeset 3469


Ignore:
Timestamp:
12/12/07 13:03:46 (12 years ago)
Author:
melissa
Message:

Added "-preload" option: reads the given file into a byte array, then uses Location's String->IRandomAccess mapping logic to read images from the byte array.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/tools/ImageInfo.java

    r3307 r3469  
    6767    boolean normalize = false; 
    6868    boolean fastBlit = false; 
     69    boolean preload = false; 
    6970    int start = 0; 
    7071    int end = Integer.MAX_VALUE; 
     
    8889          else if (args[i].equals("-fast")) fastBlit = true; 
    8990          else if (args[i].equals("-debug")) FormatHandler.setDebug(true); 
     91          else if (args[i].equals("-preload")) preload = true; 
    9092          else if (args[i].equals("-level")) { 
    9193            try { 
     
    150152        "     -swap: override the default dimension order", 
    151153        "      -map: specify file on disk to which name should be mapped", 
     154        "  -preload: pre-read entire file into a buffer; significantly", 
     155        "            reduces the time required to read the images, but", 
     156        "            requires more memory", 
    152157        "", 
    153158        "* = may result in loss of precision", 
     
    158163    } 
    159164    if (map != null) Location.mapId(id, map); 
     165    else if (preload) { 
     166      RandomAccessStream f = new RandomAccessStream(id); 
     167      byte[] b = new byte[(int) f.length()]; 
     168      f.read(b); 
     169      f.close(); 
     170      RABytes file = new RABytes(b); 
     171      Location.mapFile(id, file); 
     172    } 
     173 
    160174    if (omexml) { 
    161175      reader.setOriginalMetadataPopulated(true); 
Note: See TracChangeset for help on using the changeset viewer.