Search in sources :

Example 6 with CommentAnnotation

use of ome.xml.model.CommentAnnotation in project bioformats by openmicroscopy.

the class InOutCurrentTest method testValidDetectorAnnotation.

@Test(dependsOnMethods = { "testValidDetectorNode" })
public void testValidDetectorAnnotation() {
    Annotation n = ome.getInstrument(0).getDetector(0).getLinkedAnnotation(0);
    assertNotNull(n);
    assertEquals(DETECTOR_ANNOTATION_ID, n.getID());
    assertEquals(n.getNamespace(), GENERAL_ANNOTATION_NAMESPACE);
    assertTrue(n instanceof CommentAnnotation);
    CommentAnnotation string = (CommentAnnotation) n;
    assertEquals(DETECTOR_ANNOTATION_VALUE, string.getValue());
}
Also used : CommentAnnotation(ome.xml.model.CommentAnnotation) ListAnnotation(ome.xml.model.ListAnnotation) CommentAnnotation(ome.xml.model.CommentAnnotation) Annotation(ome.xml.model.Annotation) LongAnnotation(ome.xml.model.LongAnnotation) TimestampAnnotation(ome.xml.model.TimestampAnnotation) XMLAnnotation(ome.xml.model.XMLAnnotation) BooleanAnnotation(ome.xml.model.BooleanAnnotation) Test(org.testng.annotations.Test)

Example 7 with CommentAnnotation

use of ome.xml.model.CommentAnnotation in project bioformats by openmicroscopy.

the class ObjectBasedOMEModelMock method makeROI.

private ROI makeROI() {
    ROI roi = new ROI();
    roi.setID(InOutCurrentTest.ROI_ID);
    CommentAnnotation roiAnnotation = new CommentAnnotation();
    roiAnnotation.setID(InOutCurrentTest.ROI_ANNOTATION_ID);
    roiAnnotation.setValue(InOutCurrentTest.ROI_ANNOTATION_VALUE);
    roiAnnotation.setNamespace(InOutCurrentTest.GENERAL_ANNOTATION_NAMESPACE);
    roi.linkAnnotation(roiAnnotation);
    annotations.addCommentAnnotation(roiAnnotation);
    Union shapeUnion = new Union();
    Rectangle rect = new Rectangle();
    rect.setID(InOutCurrentTest.SHAPE_ID);
    rect.setX(InOutCurrentTest.RECTANGLE_X);
    rect.setY(InOutCurrentTest.RECTANGLE_Y);
    rect.setWidth(InOutCurrentTest.RECTANGLE_WIDTH);
    rect.setHeight(InOutCurrentTest.RECTANGLE_HEIGHT);
    shapeUnion.addShape(rect);
    roi.setUnion(shapeUnion);
    return roi;
}
Also used : CommentAnnotation(ome.xml.model.CommentAnnotation) Rectangle(ome.xml.model.Rectangle) ROI(ome.xml.model.ROI) Union(ome.xml.model.Union)

Example 8 with CommentAnnotation

use of ome.xml.model.CommentAnnotation in project bioformats by openmicroscopy.

the class Upgrade201004Test method validateUpgrade.

@Test
public void validateUpgrade() throws ServiceException {
    assertEquals(1, ome.sizeOfImageList());
    // StringAnnotation --> CommentAnnotation
    StructuredAnnotations structuredAnnotations = ome.getStructuredAnnotations();
    assertNotNull(structuredAnnotations);
    assertEquals(1, structuredAnnotations.sizeOfCommentAnnotationList());
    CommentAnnotation commentAnnotation = structuredAnnotations.getCommentAnnotation(0);
    assertEquals("StringAnnotation:0", commentAnnotation.getID());
    assertEquals("Transform", commentAnnotation.getNamespace());
    assertEquals("Foobar", commentAnnotation.getValue());
}
Also used : CommentAnnotation(ome.xml.model.CommentAnnotation) StructuredAnnotations(ome.xml.model.StructuredAnnotations) Test(org.testng.annotations.Test)

Example 9 with CommentAnnotation

use of ome.xml.model.CommentAnnotation in project bioformats by openmicroscopy.

the class SPWModelMock method makeImage.

private Image makeImage(int index) {
    // <Instrument/> for later linking, etc.
    Instrument instrument = ome.getInstrument(0);
    // Create <Image/>
    Image image = new Image();
    image.setID("Image:" + index);
    CommentAnnotation commentAnnotation = new CommentAnnotation();
    commentAnnotation.setID("Annotation:" + index);
    commentAnnotation.setNamespace(GENERAL_ANNOTATION_NAMESPACE);
    commentAnnotation.setValue("Image:" + index + " annotation.");
    annotations.addCommentAnnotation(commentAnnotation);
    image.linkAnnotation(commentAnnotation);
    // Create <Pixels/>
    Pixels pixels = new Pixels();
    pixels.setID("Pixels:" + index);
    pixels.setSizeX(new PositiveInteger(SIZE_X));
    pixels.setSizeY(new PositiveInteger(SIZE_Y));
    pixels.setSizeZ(new PositiveInteger(SIZE_Z));
    pixels.setSizeC(new PositiveInteger(SIZE_C));
    pixels.setSizeT(new PositiveInteger(SIZE_T));
    pixels.setDimensionOrder(DIMENSION_ORDER);
    pixels.setType(PIXEL_TYPE);
    // Create <BinData/>
    for (int i = 0; i < SIZE_Z * SIZE_C * SIZE_T; i++) {
        BinData binData = new BinData();
        binData.setBigEndian(false);
        binData.setCompression(Compression.NONE);
        binData.setLength(new NonNegativeLong((long) (SIZE_X * SIZE_Y * BYTES_PER_PIXEL)));
        pixels.addBinData(binData);
    }
    // Create <Channel/> under <Pixels/>
    for (int i = 0; i < SIZE_C; i++) {
        Channel channel = new Channel();
        channel.setID("Channel:" + i);
        // Create <LightSourceSettings/> and link to <Channel/>
        LightSourceSettings settings = new LightSourceSettings();
        settings.setID(LIGHTSOURCE_LASER_ID);
        channel.setLightSourceSettings(settings);
        // Create <LightPath/> and link to <Channel/>
        LightPath lightPath = new LightPath();
        lightPath.linkEmissionFilter(instrument.getFilter(0));
        lightPath.linkExcitationFilter(instrument.getFilter(1));
        channel.setLightPath(lightPath);
        pixels.addChannel(channel);
    }
    // Put <Pixels/> under <Image/>
    image.setPixels(pixels);
    // Link <Instrument/> to <Image/>
    image.linkInstrument(instrument);
    // Create <ObjectiveSettings/> and link to <Image/>
    ObjectiveSettings settings = new ObjectiveSettings();
    settings.setID(OBJECTIVE_ID);
    image.setObjectiveSettings(settings);
    return image;
}
Also used : PositiveInteger(ome.xml.model.primitives.PositiveInteger) LightSourceSettings(ome.xml.model.LightSourceSettings) NonNegativeLong(ome.xml.model.primitives.NonNegativeLong) LightPath(ome.xml.model.LightPath) CommentAnnotation(ome.xml.model.CommentAnnotation) BinData(ome.xml.model.BinData) Channel(ome.xml.model.Channel) ObjectiveSettings(ome.xml.model.ObjectiveSettings) Instrument(ome.xml.model.Instrument) Image(ome.xml.model.Image) Pixels(ome.xml.model.Pixels)

Example 10 with CommentAnnotation

use of ome.xml.model.CommentAnnotation in project bioformats by openmicroscopy.

the class InOutCurrentTest method testValidLaserAnnotation.

@Test(dependsOnMethods = { "testValidLaserMetadata" }, enabled = false)
public void testValidLaserAnnotation() {
    Annotation n = ome.getInstrument(0).getLightSource(0).getLinkedAnnotation(0);
    assertNotNull(n);
    assertEquals(LIGHTSOURCE_LASER_ANNOTATION_ID, n.getID());
    assertEquals(n.getNamespace(), GENERAL_ANNOTATION_NAMESPACE);
    assertTrue(n instanceof CommentAnnotation);
    CommentAnnotation string = (CommentAnnotation) n;
    assertEquals(LIGHTSOURCE_LASER_ANNOTATION_VALUE, string.getValue());
}
Also used : CommentAnnotation(ome.xml.model.CommentAnnotation) ListAnnotation(ome.xml.model.ListAnnotation) CommentAnnotation(ome.xml.model.CommentAnnotation) Annotation(ome.xml.model.Annotation) LongAnnotation(ome.xml.model.LongAnnotation) TimestampAnnotation(ome.xml.model.TimestampAnnotation) XMLAnnotation(ome.xml.model.XMLAnnotation) BooleanAnnotation(ome.xml.model.BooleanAnnotation) Test(org.testng.annotations.Test)

Aggregations

CommentAnnotation (ome.xml.model.CommentAnnotation)14 Test (org.testng.annotations.Test)11 Annotation (ome.xml.model.Annotation)10 BooleanAnnotation (ome.xml.model.BooleanAnnotation)10 ListAnnotation (ome.xml.model.ListAnnotation)10 LongAnnotation (ome.xml.model.LongAnnotation)10 TimestampAnnotation (ome.xml.model.TimestampAnnotation)10 XMLAnnotation (ome.xml.model.XMLAnnotation)10 Image (ome.xml.model.Image)2 Instrument (ome.xml.model.Instrument)2 LightEmittingDiode (ome.xml.model.LightEmittingDiode)2 Power (ome.units.quantity.Power)1 Arc (ome.xml.model.Arc)1 BinData (ome.xml.model.BinData)1 Channel (ome.xml.model.Channel)1 Detector (ome.xml.model.Detector)1 Dichroic (ome.xml.model.Dichroic)1 Filament (ome.xml.model.Filament)1 Filter (ome.xml.model.Filter)1 FilterSet (ome.xml.model.FilterSet)1