Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setFilePatternIds method to ImporterOptions #3019

Merged
merged 1 commit into from Jan 18, 2018

Conversation

ctrueden
Copy link
Member

@ctrueden ctrueden commented Dec 10, 2017

When coupled with setGroupFiles(true), this lets you pass a file pattern directly to the ImporterOptions as an id, similarly to what you can do with the interactive FilePatternDialog.

See:

The following code now works in my tests:

final String id = "/Users/curtis/data/mri-stack/slice00<05-24>_mri-stack.tif";

ImporterOptions options = new ImporterOptions();
options.setUsingPatternIds(true);
options.setGroupFiles(true);
options.setId(id);

ImagePlus[] imps = BF.openImagePlus(options);
for (final ImagePlus imp : imps)
  imp.show();

(The TIFFs were created by splitting the MRI Stack sample and saving each as a separate slice.)

There is still some weirdness: the title bar reads slice00<01-27>_mri-stack.tif even though we used a narrower range; I guess a file pattern is still computed from the first file of the above pattern, even if it is not ultimately used. This same behavior can be seen when specifying the above pattern via the UI dialogs.

When coupled with setGroupFiles(true), this lets you pass a file pattern
directly to the ImporterOptions as an id, similarly to what you can do
with the interactive FilePatternDialog.
@dgault
Copy link
Member

dgault commented Jan 5, 2018

This seem likes a nice option to add as currently there is no nice way of doing this directly from the Bio-Formats plugin.

The FilePattern dialog is able to able to handle this using the existing options but due to the sequencing of the import process this wont work from the Java example scenario listed. I was also playing around with other possibilities similar to https://github.com/openmicroscopy/bioformats/blob/develop/components/bio-formats-plugins/utils/Mass_Importer.java but there is no simple way of doing this currently and reworking the import process is significantly more work.

This is a nicer solution and the naming of the options also matches up with the existing naming conventions for setting patterns.

For testing I used a small Java plugin similar to that listed above and a range of different patterns based on the examples in https://docs.openmicroscopy.org/bio-formats/5.7.2/formats/pattern-file.html. All tests passed as expected with the correct selection of files being opened.

The issue with the title bar is also present when using the standard FilePatternDialog so is not specifically related to this PR and is something which can be followed up on seperately.

@dgault dgault added this to the 5.8.0 milestone Jan 12, 2018
@dgault
Copy link
Member

dgault commented Jan 18, 2018

With all the file pattern testing passing this PR is ready for inclusion in the 5.8.0 release.

@dgault dgault merged commit 801f12c into ome:develop Jan 18, 2018
@ctrueden ctrueden deleted the bf-file-pattern-ids branch February 6, 2018 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants