Ticket #310 (closed enhancement: fixed)
Opened 2008-07-09T13:34:52-05:00
Last modified 2010-07-13T17:02:57-05:00
Overhaul Bio-Formats Importer
Reported by: | curtis | Owned by: | curtis |
---|---|---|---|
Priority: | critical | Milestone: |
|
Component: | plugins | Severity: | serious |
Keywords: | Cc: | acardona@… | |
Blocked By: | Blocking: |
Description
The Bio-Formats Importer plugin has become quite complex. The logic is primarily encapsulated in two classes, Importer.java and ImporterOptions.java, nearly 1000 lines of code each. Much of the code would be useful outside the context of the importer proper, and as such should be split out into additional classes, helper methods, or otherwise encapsulated to make working with Bio-Formats within ImageJ easier for third party plugin developers.
In addition, the Importer dialog has become cluttered with more and more options, some of which have functions that are not completely clear from their labels. We currently offer no further documentation on what these options do, but should. As such, the Importer dialog should be reorganized to improve clarity, and tooltips or other interactive help should be added to assist in understanding the available features.
Ticket #289 is very related to this ticket.
Change History
comment:2 Changed 2008-10-29T20:22:37-05:00 by curtis
The second half of this ticket, better organization of options with interactive help describing them, is done. All that remains is some code reorganization to provide better developer hooks to ImageJ-specific Bio-Formats functionality.
comment:3 Changed 2009-10-08T22:33:33-05:00 by curtis
ImporterOptions has been split up into more modular pieces. All that remains is to break apart Importer.java itself now.
comment:4 Changed 2010-01-05T19:56:54-06:00 by curtis
- Cc acardona@… added
- Milestone set to bio-formats-4.2
In particular, it needs to be possible to acquire an ImagePlus (or ImagePluses) in a high-level manner while guaranteeing no dialogs are shown. The refactoring of loci.plugins.importer.Importer will enable such functionality.
comment:5 Changed 2010-06-03T18:04:53-05:00 by curtis
- Status changed from assigned to closed
- Resolution set to fixed
Nearly two years later, we finally have a much better API for programmatically invoking the Bio-Formats Importer plugin. There are still a few kinks to be worked out over the next few days, but the refactoring is largely complete. The simplest syntax is:
import loci.plugins.BF; ... String path = "/path/to/myImage.tif"; // any format will work ImagePlus[] imps = BF.openImagePlus(path);
This will open the images using the default importer options (which at the moment, is defined as the options last used). If you want more control over the options, you can do something like:
import loci.common.Region; import loci.plugins.BF; ... String path = "/path/to/myImage.tif"; // any format will work ImporterOptions options = new ImporterOptions(); options.setId(path); options.setGroupFiles(true); // e.g. options.setCrop(true); options.setCropRegion(seriesNo, new Region(x, y, w, h)); //... more API calls to options object to set additional parameters ... ImagePlus[] imps = BF.openImagePlus(options);
The BF.openImagePlus method will throw FormatException or IOException if something goes wrong, so best practice is to catch those.
This method should never have any GUI side effects—no dialogs or updates to the IJ status bar (if it does, it's a bug).
comment:6 Changed 2010-07-09T12:55:02-05:00 by melissa
- Milestone bio-formats-4.2 deleted
Milestone bio-formats-4.2 deleted