select thumbnail series by "isThumbnailSeries" metadata.

This commit is contained in:
Yoshihiro OKUMURA 2022-09-29 18:03:56 +09:00
parent 847a81534b
commit f81a1c2fbd
2 changed files with 13 additions and 4 deletions

View File

@ -271,8 +271,8 @@ public class BioFormatsImageInfo {
results.put("status", status); results.put("status", status);
results.put("message", message); results.put("message", message);
results.put("format", format); results.put("format", format);
results.put("thumbnail", thumbnail.isEmpty() ? null : thumbnail);
results.put("metadata", metadata.isEmpty() ? null : metadata); results.put("metadata", metadata.isEmpty() ? null : metadata);
results.put("thumbnail", thumbnail.isEmpty() ? null : thumbnail);
System.out.println(getJsonString(results)); System.out.println(getJsonString(results));
if (!status) { if (!status) {

View File

@ -149,12 +149,21 @@ public class BioFormatsImageThumbnail {
throw new BioFormatsImageException("unsupported file: " + path); throw new BioFormatsImageException("unsupported file: " + path);
} }
try { try {
final int series = 0; int series = 0;
final int seriesCount = reader.getSeriesCount();
for (int i = 0; i < seriesCount; i++) {
reader.setSeries(i);
if (reader.isThumbnailSeries()) {
series = i;
break;
}
}
reader.setSeries(series);
final int no = 0; final int no = 0;
// System.out.println("series count: " + reader.getSeriesCount()); // System.out.println("series count: " + seriesCount);
// System.out.println("image count: " + reader.getImageCount()); // System.out.println("image count: " + reader.getImageCount());
// System.out.println("resolution: " + reader.getResolutionCount()); // System.out.println("resolution: " + reader.getResolutionCount());
reader.setSeries(series); // System.out.println("thubmail series: " + series);
ret = reader.openThumbImage(no); ret = reader.openThumbImage(no);
} catch (final Throwable e) { } catch (final Throwable e) {
for (Throwable t = e; t != null; t = t.getCause()) { for (Throwable t = e; t != null; t = t.getCause()) {