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