// Non-standard, have to add a "Series" annotation
//
// First, see if we have one for this series before
// creating a new one
//
StructuredAnnotations sa = ome.getStructuredAnnotations();
if (sa == null) {
ome.setStructuredAnnotations(sa = new StructuredAnnotations());
}
LongAnnotation seriesAnnotation = null;
for (int saIdx=0; saIdx<sa.sizeOfLongAnnotationList(); saIdx++) {
final LongAnnotation candidate = sa.getLongAnnotation(saIdx);
if ((candidate.getDescription().equals(description)) &&
(candidate.getNamespace().equals(ANNOTATION_NAMESPACE)) &&
(candidate.getValue().equals(value))) {
seriesAnnotation = candidate;
break;
}
}
if (seriesAnnotation == null) {
seriesAnnotation = new LongAnnotation();
seriesAnnotation.setDescription(description);
seriesAnnotation.setNamespace(ANNOTATION_NAMESPACE);
seriesAnnotation.setValue(value);
seriesAnnotation.setID(String.format("%s/%s/%d", ANNOTATION_NAMESPACE, description, value));
sa.addLongAnnotation(seriesAnnotation);
}
plane.linkAnnotation(seriesAnnotation);
}