Changeset 536


Ignore:
Timestamp:
10/14/05 15:36:28 (15 years ago)
Author:
curtis
Message:

Better error handling when QuickTime is not installed.

Location:
trunk/loci/visbio
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/visbio/data/Dataset.java

    r532 r536  
    3838import org.w3c.dom.Element; 
    3939import visad.*; 
    40 import visad.data.BadFormException; 
    4140 
    4241/** 
     
    499498      if (ids.length > 1) format += "s"; 
    500499    } 
    501     catch (BadFormException exc) { 
    502       if (ids[0].toLowerCase().endsWith(".mov")) { 
    503         if (loaders[0].canDoQT()) { 
    504           System.err.println("The file seems to be in QuickTime format, " + 
    505             "but the data appears corrupt or invalid. It may use an " + 
    506             "unsupported codec or other feature."); 
    507         } 
    508         else { 
    509           System.err.println("The file seems to be in QuickTime format, " + 
    510             "but QuickTime for Java does not appear to be installed. " + 
    511             "Please install QuickTime for Java from: " + 
    512             "http://www.apple.com/quicktime/download/"); 
    513         } 
    514       } 
    515       else { 
    516         System.err.println("The file format is not supported, " + 
    517           "or the file data is corrupt or invalid."); 
    518       } 
    519       return; 
    520     } 
    521     catch (IOException exc) { 
    522       System.err.println("Could not determine number of images per file. " + 
    523         filename + " may be corrupt or invalid."); 
    524       return; 
    525     } 
    526     catch (VisADException exc) { 
     500    catch (Exception exc) { 
    527501      System.err.println("Could not determine number of images per file. " + 
    528502        filename + " may be corrupt or invalid."); 
  • trunk/loci/visbio/data/ImageFamily.java

    r522 r536  
    3535import visad.data.qt.PictForm; 
    3636import visad.data.qt.QTForm; 
     37import visad.data.tiff.BaseTiffForm; 
    3738import visad.data.tiff.TiffForm; 
    3839 
     
    171172    if (!id.equals(lastId)) initId(id); 
    172173    if (!(list[index] instanceof FormBlockReader)) return null; 
    173     return ((FormBlockReader) list[index]).open(id, block_number); 
     174    try { return ((FormBlockReader) list[index]).open(id, block_number); } 
     175    catch (BadFormException exc) { checkLibraryException(exc); throw exc; } 
    174176  } 
    175177 
     
    181183    if (!id.equals(lastId)) initId(id); 
    182184    if (!(list[index] instanceof FormBlockReader)) return -1; 
    183     return ((FormBlockReader) list[index]).getBlockCount(id); 
     185    try { return ((FormBlockReader) list[index]).getBlockCount(id); } 
     186    catch (BadFormException exc) { checkLibraryException(exc); throw exc; } 
    184187  } 
    185188 
     
    338341  } 
    339342 
     343  /** Prints an error message if the exception indicates a missing library. */ 
     344  private void checkLibraryException(BadFormException exc) { 
     345    if (exc.getMessage().equals(QTForm.NO_QT_MSG)) { 
     346      System.err.println("VisBio requires the QuickTime for Java library " + 
     347        "to read this dataset, but QuickTime does not appear to be " + 
     348        "installed. Please install QuickTime from: " + 
     349        "http://www.apple.com/quicktime/download/"); 
     350    } 
     351  } 
     352 
    340353 
    341354  // -- Main method -- 
    342355 
    343356  /** 
    344    * Run 'java loci.visbio.ImageFamily in_file out_file' to convert 
    345    * in_file to out_file in any of the supported formats. 
     357   * Run 'java loci.visbio.data.ImageFamily in_file' 
     358   * to test read a data files in any format VisBio supports. 
    346359   */ 
    347360  public static void main(String[] args) throws VisADException, IOException { 
    348     if (args == null || args.length < 1 || args.length > 2) { 
    349       System.out.println("To convert a file, run:"); 
    350       System.out.println( 
    351         "  java loci.visbio.ImageFamily in_file out_file"); 
    352       System.out.println("To test read an image file, run:"); 
    353       System.out.println("  java loci.visbio.ImageFamily in_file"); 
    354       System.exit(2); 
    355     } 
    356  
    357     if (args.length == 1) { 
    358       // Test read image file 
    359       ImageFamily form = new ImageFamily(); 
    360       System.out.print("Reading " + args[0] + " "); 
    361       Data data = form.open(args[0]); 
    362       System.out.println("[done]"); 
    363       System.out.println("MathType =\n" + data.getType().prettyString()); 
    364     } 
    365     else if (args.length == 2) { 
    366       // Convert file 
    367       System.out.print(args[0] + " -> " + args[1] + " "); 
    368       DefaultFamily loader = new DefaultFamily("loader"); 
    369       DataImpl data = loader.open(args[0]); 
    370       loader = null; 
    371       ImageFamily form = new ImageFamily(); 
    372       form.save(args[1], data, true); 
    373       System.out.println("[done]"); 
    374     } 
    375     System.exit(0); 
     361    BaseTiffForm.testRead(new ImageFamily(), "VisBio", args); 
    376362  } 
    377363 
  • trunk/loci/visbio/help/quicktime.html

    r528 r536  
    22 
    33<p>VisBio supports reading and writing QuickTime movies (not including 
    4 metadata), but it requires that QuickTime for Java be installed. 
     4metadata), but it requires that QuickTime be installed. 
    55 
    66<p>If you are running Mac OS X, you probably already have QuickTime installed. 
     
    88not have QuickTime installed, visit the 
    99<a href="http://www.apple.com/quicktime/download/standalone.html">QuickTime 
    10 download page</a>. Once QuickTime for Java is installed on your machine, VisBio 
    11 will be able to import QuickTime movies. On Windows systems, VisBio will also 
    12 gain the capability to write QuickTime movies. 
    13  
    14 <p>Unfortunately, the optional QuickTime for Java component is no longer 
    15 installed by default. To enable it, choose to perform a Custom installation 
    16 when the installer asks, then scroll down and ensure the "QuickTime for Java" 
    17 box is checked. 
     10download page</a>. Once QuickTime is installed on your machine, VisBio will be 
     11able to import QuickTime movies. On Windows systems, VisBio will also gain the 
     12capability to write QuickTime movies. 
    1813 
    1914<br><h3>See also:</h3> 
  • trunk/loci/visbio/whatsnew.txt

    r532 r536  
    77- TWEAK: Don't create errors.log unless necessary 
    88- TWEAK: Eliminate some debugging messages from the output console 
     9 
     10- FIXED: Bug in non-image data objects (arbitrary slices, overlays) 
     11- FIXED: Ignore thumbnails in Zeiss LSM images 
     12- FIXED: Better detection of QuickTime v7.0 for Windows 
    913 
    1014 
Note: See TracChangeset for help on using the changeset viewer.