disabled to output metadata of empty annotations.

This commit is contained in:
Yoshihiro OKUMURA 2022-07-12 18:28:51 +09:00
parent ccb264871f
commit 4f15c0d94b

View File

@ -33,14 +33,13 @@ public class BioFormatsImageInfo {
MetadataStore ms = reader.getMetadataStore();
MetadataRetrieve mr = ms instanceof MetadataRetrieve ? (MetadataRetrieve) ms : null;
for (int j = 0; j < seriesCount; j++) {
// read basic metadata for series #j
reader.setSeries(j);
Map<String, Object> seriesMetadata = new LinkedHashMap<String, Object>();
// read basic metadata for series #j
int imageCount = reader.getImageCount();
int resolutionCount = reader.getResolutionCount();
// output basic metadata for series #i
String seriesName = mr == null ? null : mr.getImageName(j);
if (seriesName != null) {
seriesMetadata.put("name", seriesName);
@ -174,8 +173,8 @@ public class BioFormatsImageInfo {
return ret;
}
protected static LinkedHashMap<String, Object> makeRectangle(int width, int height) {
LinkedHashMap<String, Object> ret = new LinkedHashMap<String, Object>();
protected static Map<String, Object> makeRectangle(int width, int height) {
Map<String, Object> ret = new LinkedHashMap<String, Object>();
ret.put("width", width);
ret.put("height", height);
return ret;
@ -185,8 +184,8 @@ public class BioFormatsImageInfo {
ObjectMapper mapper = new ObjectMapper();
String json = null;
try {
json = mapper.writeValueAsString(map);
// json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(map);
json = mapper.writeValueAsString(map);
} catch (Exception e) {
// return "null" if conversion error occured
json = "null";
@ -223,7 +222,10 @@ public class BioFormatsImageInfo {
reader.setResolution(0);
// info.printGlobalMetadata();
// info.printOriginalMetadata();
metadata.put("annotations", readAnnotations(reader));
Map<String, Object> annotations = readAnnotations(reader);
if (!annotations.isEmpty()) {
metadata.put("annotations", annotations);
}
} catch (Exception e) {
throw new BioFormatsImageException(e);
} finally {