Changeset 2269


Ignore:
Timestamp:
02/14/07 16:56:57 (13 years ago)
Author:
chris
Message:

Notebook:
more efficient saving of tiff files through TiffWriter
instead of painfully slow convoluted way of doint it.

Location:
trunk/loci/ome/notebook
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/ome/notebook/Merger.java

    r2268 r2269  
    187187      (javax.swing.Icon)null, 
    188188      possibilities, 
    189       possibilities[3]); 
     189      possibilities[1]); 
    190190    if ((s != null) && (s.length() > 0)) {  
    191191      if(s.equals(possibilities[0])) mode = ALL_ORIGINAL; 
  • trunk/loci/ome/notebook/MetadataPane.java

    r2268 r2269  
    282282 
    283283        if (originalTIFF == file) { 
     284          //just rewrite image description of original file. 
    284285          RandomAccessFile raf = new RandomAccessFile(file, "rw"); 
    285286          TiffTools.overwriteIFDValue(raf, 0, TiffTools.IMAGE_DESCRIPTION, xml); 
     
    287288        } 
    288289        else { 
    289           FileInputStream fis = new FileInputStream(originalTIFF); 
    290           FileOutputStream fos = new FileOutputStream(file); 
    291           int myByte = fis.read(); 
    292           while (myByte != -1) { 
    293             fos.write(myByte); 
    294             myByte = fis.read(); 
    295           } 
    296           fis.close(); 
    297           fos.close(); 
    298  
    299           RandomAccessFile raf = new RandomAccessFile(file, "rw"); 
    300           TiffTools.overwriteIFDValue(raf, 0, TiffTools.IMAGE_DESCRIPTION, xml); 
    301           raf.close(); 
     290          //create the new tiff file. 
     291          saveTiffFile(file); 
    302292        } 
    303293      } 
     
    452442      } 
    453443      else originalTIFF = null; 
     444      in.close(); 
    454445 
    455446      OMENode ome = null; 
     
    460451        reader = new ImageReader(); 
    461452        OMEXMLMetadataStore ms = new OMEXMLMetadataStore(); 
     453        ms.createRoot(); 
    462454         
    463455        // tell reader to write metadata as it's being 
     
    467459        File companionFile = new File(id + ".ome"); 
    468460        if(companionFile.exists()) { 
    469           Object[] options = {"Sounds good", "No thanks"}; 
     461          Object[] options = {"Sounds good", "No, open original file"}; 
    470462         
    471463          int n = JOptionPane.showOptionDialog(getTopLevelAncestor(), 
     
    504496        if (s.startsWith("<?xml") || s.startsWith("<OME")) { 
    505497          // raw OME-XML 
     498          in = new DataInputStream(new FileInputStream(file)); 
    506499          byte[] data = new byte[(int) file.length()]; 
    507500          System.arraycopy(header, 0, data, 0, 8); 
Note: See TracChangeset for help on using the changeset viewer.