Changeset 2328


Ignore:
Timestamp:
02/23/07 15:21:42 (13 years ago)
Author:
chris
Message:

Notebook:
1) fixed problem with ZCT bioformats index mapping.
if file is corrupted, tell user in JOptionPane

2) prompt user when trying to naively add TiffData
elements to Pixels elements, so that it will not
screw up a series if they know what they're doing.

File:
1 edited

Legend:

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

    r2327 r2328  
    609609    //creating tiffData from non-OME-Tiff 
    610610    if(!isOMETiff) { 
    611       System.out.println("Isn't OME-Tiff");//TEMP 
    612611      for(int i = 0;i<pixList.size();i++) { 
    613612        Element thisEle = (Element) pixList.get(i); 
     
    616615    } 
    617616    //creating tiff from OMETiff file 
    618     else if (isOMETiff) { 
    619       System.out.println("Is OME-Tiff");//TEMP       
     617    
     618    else if (isOMETiff) {  
     619      boolean prompted = false; 
     620      boolean addElements = false;      
    620621      for(int i = 0;i<pixList.size();i++) { 
    621622        Element thisEle = (Element) pixList.get(i); 
     
    625626        //fixes if TiffData Elements not in File but should be 
    626627        if(dataEles.size() == 0) { 
    627           DOMUtil.createChild(thisEle, "TiffData"); 
    628           continue; 
     628          if(!prompted) { 
     629            Object[] options = {"Sounds good", "Cancel (Nothing bad will happen)"}; 
     630           
     631            int n = JOptionPane.showOptionDialog(getTopLevelAncestor(), 
     632              "We detected that an OME-xml companion file exists for" 
     633                + " the file you just opened,\n would you like to merge these" 
     634                + " files in some manner?", 
     635              "Companion File Detected", 
     636              JOptionPane.YES_NO_OPTION, 
     637              JOptionPane.QUESTION_MESSAGE, 
     638              (javax.swing.Icon)null, 
     639              options, 
     640              options[0]); 
     641               
     642              if (n == JOptionPane.YES_OPTION)  addElements = true; 
     643              prompted = true; 
     644          } 
     645             
     646          if(addElements) { 
     647            DOMUtil.createChild(thisEle, "TiffData"); 
     648            continue; 
     649          } 
    629650        } 
    630651         
     
    647668      DOMUtil.writeXML(baos,doc); 
    648669      result = baos.toString(); 
    649       System.out.println(tiffDataStore);//TEMP 
    650       System.out.println(result);//TEMP 
    651670    } 
    652671    catch (Exception exc) { 
     
    762781        //Set up thumbnails 
    763782        int numSeries = reader.getSeriesCount(id); 
     783         
    764784        images = new BufferedImage[numSeries+1]; 
    765785        thumbs = new BufferedImage[numSeries+1]; 
     
    789809          storeTiffData(file); 
    790810        } 
    791  
     811        
    792812        //find minimum pixel ID, doesn't have to be zero, if not in 
    793813        //standard format, flag this, all thumbs will be the same         
     
    835855      } 
    836856      catch (FormatException exc) { 
     857        if ("Unsupported ZCT index mapping".equals(exc.getMessage())) { 
     858          JOptionPane.showMessageDialog(this, 
     859             "This tiff file is corrupted. The ZCT index mapping is" 
     860             + " unsupported by bioformats.\nYour metadata will not" 
     861             + " populate correctly, our apologies.", 
     862          "MetadataNotebook Error", JOptionPane.ERROR_MESSAGE); 
     863        } 
    837864        img = null; 
    838865        thumb = null; 
Note: See TracChangeset for help on using the changeset viewer.