Changeset 7482


Ignore:
Timestamp:
12/31/10 11:07:31 (9 years ago)
Author:
melissa
Message:

Moved 'void setWriteSequentially(boolean)' from TiffWriter to IFormatWriter. See #565.

Location:
trunk/components
Files:
7 edited

Legend:

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

    r7428 r7482  
    7575  protected int series; 
    7676 
     77  /** Whether or not we are writing planes sequentially. */ 
     78  protected boolean sequential; 
     79 
    7780  /** 
    7881   * Current metadata retrieval object. Should <b>never</b> be accessed 
     
    235238    } 
    236239    return false; 
     240  } 
     241 
     242  /* @see IFormatWriter#setWriteSequentially(boolean) */ 
     243  public void setWriteSequentially(boolean sequential) { 
     244    this.sequential = sequential; 
    237245  } 
    238246 
  • trunk/components/bio-formats/src/loci/formats/IFormatWriter.java

    r7428 r7482  
    158158  void changeOutputFile(String id) throws FormatException, IOException; 
    159159 
     160  /** 
     161   * Sets whether or not we know that planes will be written sequentially. 
     162   * If planes are written sequentially and this flag is set, then performance 
     163   * will be slightly improved. 
     164   */ 
     165  void setWriteSequentially(boolean sequential); 
     166 
    160167  // -- Deprecated methods -- 
    161168 
  • trunk/components/bio-formats/src/loci/formats/ImageWriter.java

    r7428 r7482  
    331331  } 
    332332 
     333  /* @see IFormatWriter#setWriteSequentially(boolean) */ 
     334  public void setWriteSequentially(boolean sequential) { 
     335    for (IFormatWriter writer : writers) { 
     336      writer.setWriteSequentially(sequential); 
     337    } 
     338  } 
     339 
    333340  // -- Deprecated IFormatWriter API methods -- 
    334341 
  • trunk/components/bio-formats/src/loci/formats/WriterWrapper.java

    r7428 r7482  
    239239  } 
    240240 
     241  public void setWriteSequentially(boolean sequential) { 
     242    writer.setWriteSequentially(sequential); 
     243  } 
     244 
    241245  // -- Deprecated IFormatWriter methods -- 
    242246 
  • trunk/components/bio-formats/src/loci/formats/out/TiffWriter.java

    r7237 r7482  
    6262  /** Whether or not the output file is a BigTIFF file. */ 
    6363  protected boolean isBigTiff; 
    64  
    65   /** Whether or not we are writing planes sequentially. */ 
    66   protected boolean sequential; 
    6764 
    6865  /** The TiffSaver that will do most of the writing. */ 
     
    248245  { 
    249246    IFD ifd = new IFD(); 
    250     TiffParser parser = new TiffParser(currentId); 
    251     try { 
    252       long[] ifdOffsets = parser.getIFDOffsets(); 
    253       if (no < ifdOffsets.length) { 
    254         ifd = parser.getIFD(ifdOffsets[no]); 
    255       } 
    256     } 
    257     finally { 
    258       RandomAccessInputStream tiffParserStream = parser.getStream(); 
    259       if (tiffParserStream != null) { 
    260         tiffParserStream.close(); 
     247    if (!sequential) { 
     248      TiffParser parser = new TiffParser(currentId); 
     249      try { 
     250        long[] ifdOffsets = parser.getIFDOffsets(); 
     251        if (no < ifdOffsets.length) { 
     252          ifd = parser.getIFD(ifdOffsets[no]); 
     253        } 
     254      } 
     255      finally { 
     256        RandomAccessInputStream tiffParserStream = parser.getStream(); 
     257        if (tiffParserStream != null) { 
     258          tiffParserStream.close(); 
     259        } 
    261260      } 
    262261    } 
     
    308307  } 
    309308 
    310   /** 
    311    * Sets whether or not we know that planes will be written sequentially. 
    312    * If planes are written sequentially and this flag is set, then performance 
    313    * will be slightly improved. 
    314    */ 
    315   public void setWriteSequentially(boolean sequential) { 
    316     this.sequential = sequential; 
    317   } 
    318  
    319309} 
  • trunk/components/bio-formats/src/loci/formats/tools/ImageConverter.java

    r7428 r7482  
    229229      writer.setMetadataRetrieve((MetadataRetrieve) store); 
    230230    } 
     231    writer.setWriteSequentially(true); 
    231232 
    232233    if (writer instanceof TiffWriter) { 
    233234      ((TiffWriter) writer).setBigTiff(bigtiff); 
    234       ((TiffWriter) writer).setWriteSequentially(true); 
    235235    } 
    236236    else if (writer instanceof ImageWriter) { 
     
    238238      if (w instanceof TiffWriter) { 
    239239        ((TiffWriter) w).setBigTiff(bigtiff); 
    240         ((TiffWriter) w).setWriteSequentially(true); 
    241240      } 
    242241    } 
  • trunk/components/loci-plugins/src/loci/plugins/out/Exporter.java

    r7428 r7482  
    220220 
    221221      IFormatWriter w = new ImageWriter().getWriter(outfile); 
     222      w.setWriteSequentially(true); 
    222223      FileInfo fi = imp.getOriginalFileInfo(); 
    223224      String xml = fi == null ? null : fi.description == null ? null : 
Note: See TracChangeset for help on using the changeset viewer.