Skip to content

Commit

Permalink
Fix for true single well plates, add one more test for multiple direc…
Browse files Browse the repository at this point in the history
…tories
  • Loading branch information
melissalinkert committed Jul 21, 2024
1 parent 411a030 commit b7d3286
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
27 changes: 20 additions & 7 deletions src/main/java/com/glencoesoftware/bioformats2raw/BioTekReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,18 +240,31 @@ protected void initFile(String id) throws FormatException, IOException {
LOGGER.debug("plate directory = {}", plateDir);
String[] wellDirs = plateDir.list(true);
ArrayList<String> allFiles = new ArrayList<String>();
boolean multipleDirs = true;
for (String well : wellDirs) {
Location wellDir = new Location(plateDir, well).getAbsoluteFile();
LOGGER.debug("looking in well directory = {}", wellDir);
String[] f = wellDir.list(true);
for (String file : f) {
LOGGER.debug(" adding well file {}", file);
allFiles.add(new Location(wellDir, file).getAbsolutePath());
if (wellDir == null) {
multipleDirs = false;
}
else {
String[] f = wellDir.list(true);
if (f == null) {
multipleDirs = false;
}
else {
for (String file : f) {
LOGGER.debug(" adding well file {}", file);
allFiles.add(new Location(wellDir, file).getAbsolutePath());
}
}
}
}
if (multipleDirs) {
LOGGER.debug("found files = {}", allFiles);
files = allFiles.toArray(new String[allFiles.size()]);
Arrays.sort(files);
}
LOGGER.debug("found files = {}", allFiles);
files = allFiles.toArray(new String[allFiles.size()]);
Arrays.sort(files);
}

Pattern regexA = Pattern.compile(TIFF_REGEX_A);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,21 @@ static Stream<Arguments> getTestCases() {
Arguments.of(new String[] {
"B2/B2_1_Bright Field_1_001_02.tif",
"D3/D3_1_Bright Field_1_001_02.tif",
}, new int[] {1, 3}, new int[] {1, 2}, 1, 1, 1, 1)
}, new int[] {1, 3}, new int[] {1, 2}, 1, 1, 1, 1),
Arguments.of(new String[] {
"ID_A9 info/A9_-1_1_1_Phase Contrast_001.tif",
"ID_A9 info/A9_-1_2_1_GFP_001.tif",
"ID_A9 info/A9_-1_3_1_DAPI_001.tif",
"ID_A10 info/A10_-1_1_1_Phase Contrast_001.tif",
"ID_A10 info/A10_-1_2_1_GFP_001.tif",
"ID_A10 info/A10_-1_3_1_DAPI_001.tif",
"ID_E9 info/E9_-1_1_1_Phase Contrast_001.tif",
"ID_E9 info/E9_-1_2_1_GFP_001.tif",
"ID_E9 info/E9_-1_3_1_DAPI_001.tif",
"ID_E10 info/E10_-1_1_1_Phase Contrast_001.tif",
"ID_E10 info/E10_-1_2_1_GFP_001.tif",
"ID_E10 info/E10_-1_3_1_DAPI_001.tif",
}, new int[] {0, 0, 4, 4}, new int[] {8, 9, 8, 9}, 1, 1, 3, 1)
);
}

Expand Down

0 comments on commit b7d3286

Please sign in to comment.