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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -48,6 +48,7 @@
import loci.formats.ChannelSeparator;
import loci.formats.ClassList;
import loci.formats.DimensionSwapper;
import loci.formats.FilePattern;
import loci.formats.FileStitcher;
import loci.formats.FormatException;
import loci.formats.FormatTools;
Expand Down Expand Up @@ -495,7 +496,8 @@ private void initializeFile() throws FormatException, IOException {
baseReader.getMetadataOptions().setMetadataLevel(
MetadataLevel.NO_OVERLAYS);
}
baseReader.setId(options.getId());
baseReader.setId(options.isUsingPatternIds() ?
new FilePattern(options.getId()).getFiles()[0] : options.getId());

boolean mustGroup = baseReader.fileGroupOption(options.getId()) == FormatTools.MUST_GROUP;
options.setMustGroup(mustGroup);
Expand Down Expand Up @@ -615,7 +617,8 @@ private void createBaseReader() throws FormatException, IOException {
if (options.isLocal() || options.isHTTP()) {
BF.status(options.isQuiet(), "Identifying " + idName);
imageReader = LociPrefs.makeImageReader();
baseReader = imageReader.getReader(options.getId());
baseReader = imageReader.getReader(options.isUsingPatternIds() ?
new FilePattern(options.getId()).getFiles()[0] : options.getId());
}
else if (options.isOMERO()) {
BF.status(options.isQuiet(), "Establishing server connection");
Expand Down
Expand Up @@ -154,6 +154,9 @@ public class ImporterOptions extends OptionsList {
private List<List<DoubleOption>> customColors =
new ArrayList<List<DoubleOption>>();

// whether to treat the given id as a file pattern directly
private boolean usePatternIds;

// -- Constructor --

public ImporterOptions() throws IOException {
Expand Down Expand Up @@ -510,6 +513,9 @@ public String getCustomColorKey(int s, int c) {
return s + "_" + c;
}

public boolean isUsingPatternIds() { return usePatternIds; }
public void setUsingPatternIds(boolean b) { usePatternIds = b; }

// -- Helper methods --

private <T extends Object> void set(List<T> list,
Expand Down