Skip to content

Commit

Permalink
Don't copy over any original annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
dgault committed Feb 11, 2024
1 parent 0130777 commit 75814b4
Showing 1 changed file with 23 additions and 15 deletions.
38 changes: 23 additions & 15 deletions src/loci/formats/in/ZarrReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -1041,24 +1041,32 @@ private void parseOMEXML(Location omeMetaFile, MetadataStore store, ArrayList<St
}
setSeries(oldSeries);

// Remove old PyramidResolution annotations
OME root = (OME) omexmlMeta.getRoot();
StructuredAnnotations annotations = root.getStructuredAnnotations();
if (annotations != null) {
int numMapAnnotations = annotations.sizeOfMapAnnotationList();
int index = 0;
for (int i = 0; i < numMapAnnotations; i++) {
MapAnnotation mapAnnotation = annotations.getMapAnnotation(index);
String namespace = mapAnnotation.getNamespace();
if (namespace != null && namespace.toLowerCase().contains("pyramidresolution")) {
annotations.removeMapAnnotation(mapAnnotation);
}
else {
index++;

// Optionally remove all annotations
if (!saveAnnotations()) {
root.setStructuredAnnotations(null);
omexmlMeta.setRoot((MetadataRoot) root);
}
else {
// Remove old PyramidResolution annotations
StructuredAnnotations annotations = root.getStructuredAnnotations();
if (annotations != null) {
int numMapAnnotations = annotations.sizeOfMapAnnotationList();
int index = 0;
for (int i = 0; i < numMapAnnotations; i++) {
MapAnnotation mapAnnotation = annotations.getMapAnnotation(index);
String namespace = mapAnnotation.getNamespace();
if (namespace != null && namespace.toLowerCase().contains("pyramidresolution")) {
annotations.removeMapAnnotation(mapAnnotation);
}
else {
index++;
}
}
root.setStructuredAnnotations(annotations);
omexmlMeta.setRoot((MetadataRoot) root);
}
root.setStructuredAnnotations(annotations);
omexmlMeta.setRoot((MetadataRoot) root);
}

// Remove old Screen and Plate metadata
Expand Down

0 comments on commit 75814b4

Please sign in to comment.