Ticket #310 (closed enhancement: fixed)

Opened 11 years ago

Last modified 9 years ago

Overhaul Bio-Formats Importer

Reported by: curtis Owned by: curtis
Priority: critical Milestone: bio-formats-4.2
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:1 Changed 11 years ago by curtis

  • Status changed from new to assigned

comment:2 Changed 11 years ago 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 10 years ago 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 10 years ago 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 9 years ago 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 9 years ago by melissa

  • Milestone bio-formats-4.2 deleted

Milestone bio-formats-4.2 deleted

comment:7 Changed 9 years ago by melissa

  • Milestone set to bio-formats-4.2
Note: See TracTickets for help on using tickets.