/** * Create a ModuloAlong* annotation corresponding to the given * {@link loci.formats.Modulo}. * @param meta the OMEXMLMetadata in which to create the annotation * @param modulo the Modulo object that contains the annotation data * @param annotations the list of existing annotations * @param image the Image to which the new annotation should be linked * @param imageIdx the index of the Image * @param annotationIndex the index to be assigned to the new annotation * @param imageAnnotation the index to be assigned to the new annotation link */ private void createModulo( final OMEXMLMetadata meta, final Modulo modulo, final StructuredAnnotations annotations, final Image image, final int imageIdx, final int annotationIndex, final int imageAnnotation) { ModuloAnnotation annotation = new ModuloAnnotation(); annotation.setModulo(meta, modulo); String id = MetadataTools.createLSID("Annotation", annotationIndex); annotation.setID(id); annotations.addXMLAnnotation(annotation); meta.setImageAnnotationRef(id, imageIdx, imageAnnotation); image.linkAnnotation(annotation); }
/** * Create a ModuloAlong* annotation corresponding to the given * {@link loci.formats.Modulo}. * @param meta the OMEXMLMetadata in which to create the annotation * @param modulo the Modulo object that contains the annotation data * @param annotations the list of existing annotations * @param image the Image to which the new annotation should be linked * @param imageIdx the index of the Image * @param annotationIndex the index to be assigned to the new annotation * @param imageAnnotation the index to be assigned to the new annotation link */ private void createModulo( final OMEXMLMetadata meta, final Modulo modulo, final StructuredAnnotations annotations, final Image image, final int imageIdx, final int annotationIndex, final int imageAnnotation) { ModuloAnnotation annotation = new ModuloAnnotation(); annotation.setModulo(meta, modulo); String id = MetadataTools.createLSID("Annotation", annotationIndex); annotation.setID(id); annotations.addXMLAnnotation(annotation); meta.setImageAnnotationRef(id, imageIdx, imageAnnotation); image.linkAnnotation(annotation); }
((Image) object).linkAnnotation(annotation);
@BeforeClass public void setUp() throws Exception { // Add an Image/Pixels Image image = new Image(); image.setID("Image:0"); Pixels pixels = new Pixels(); pixels.setID("Pixels:0"); image.setPixels(pixels); // Add a Map Annotation List<MapPair> map = new ArrayList<MapPair>(); map.add(new MapPair("a", "1")); map.add(new MapPair("d", "2")); map.add(new MapPair("c", "3")); map.add(new MapPair("b", "4")); map.add(new MapPair("e", "5")); map.add(new MapPair("c", "6")); MapAnnotation mapAnnotation = new MapAnnotation(); mapAnnotation.setID("Annotation:0"); mapAnnotation.setValue(map); StructuredAnnotations structuredAnnotations = new StructuredAnnotations(); structuredAnnotations.addMapAnnotation(mapAnnotation); ome.setStructuredAnnotations(structuredAnnotations ); image.linkAnnotation(mapAnnotation); ome.addImage(image); }
annotation.setNamespace(InOutCurrentTest.GENERAL_ANNOTATION_NAMESPACE); listAnnotation.linkAnnotation(annotation); image.linkAnnotation(listAnnotation); annotations.addBooleanAnnotation(annotation);
commentAnnotation.setValue("Image:" + index + " annotation."); annotations.addCommentAnnotation(commentAnnotation); image.linkAnnotation(commentAnnotation);