Search in sources :

Example 1 with Label

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

the class PrintROIs method printShape.

/**
 * Print the given shape.
 */
public static void printShape(Shape shapeObject) {
    if (shapeObject instanceof Ellipse) {
        Ellipse ellipse = (Ellipse) shapeObject;
        System.out.println("    Ellipse:");
        System.out.println("      Text = " + ellipse.getText());
        System.out.println("      X = " + ellipse.getX());
        System.out.println("      Y = " + ellipse.getY());
        System.out.println("      Radius (X) = " + ellipse.getRadiusX());
        System.out.println("      Radius (Y) = " + ellipse.getRadiusY());
    } else if (shapeObject instanceof Line) {
        Line line = (Line) shapeObject;
        System.out.println("    Line:");
        System.out.println("      Text = " + line.getText());
        System.out.println("      X1 = " + line.getX1());
        System.out.println("      Y1 = " + line.getY1());
        System.out.println("      X2 = " + line.getX2());
        System.out.println("      Y2 = " + line.getY2());
    } else if (shapeObject instanceof Point) {
        Point point = (Point) shapeObject;
        System.out.println("    Point:");
        System.out.println("      Text = " + point.getText());
        System.out.println("      X = " + point.getX());
        System.out.println("      Y = " + point.getY());
    } else if (shapeObject instanceof Polyline) {
        Polyline polyline = (Polyline) shapeObject;
        System.out.println("    Polyline:");
        System.out.println("      Text = " + polyline.getText());
        System.out.println("      Points = " + polyline.getPoints());
    } else if (shapeObject instanceof Polygon) {
        Polygon polygon = (Polygon) shapeObject;
        System.out.println("    Polygon:");
        System.out.println("      Text = " + polygon.getText());
        System.out.println("      Points = " + polygon.getPoints());
    } else if (shapeObject instanceof Rectangle) {
        Rectangle rectangle = (Rectangle) shapeObject;
        System.out.println("    Rectangle:");
        System.out.println("      Text = " + rectangle.getText());
    } else if (shapeObject instanceof Mask) {
        Mask mask = (Mask) shapeObject;
        System.out.println("    Mask:");
        System.out.println("      Text = " + mask.getText());
        System.out.println("      X = " + mask.getX());
        System.out.println("      Y = " + mask.getY());
        System.out.println("      Width = " + mask.getWidth());
        System.out.println("      Height = " + mask.getHeight());
    } else if (shapeObject instanceof Label) {
        Label text = (Label) shapeObject;
        System.out.println("    Label:");
        System.out.println("      Text = " + text.getText());
        System.out.println("      X = " + text.getX());
        System.out.println("      Y = " + text.getY());
    }
}
Also used : Line(ome.xml.model.Line) Ellipse(ome.xml.model.Ellipse) Polyline(ome.xml.model.Polyline) Rectangle(ome.xml.model.Rectangle) Mask(ome.xml.model.Mask) Label(ome.xml.model.Label) Point(ome.xml.model.Point) Polygon(ome.xml.model.Polygon)

Example 2 with Label

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

the class Upgrade201106Test method validateUpgrade.

@Test
public void validateUpgrade() throws ServiceException {
    assertEquals(1, ome.sizeOfImageList());
    Image image = ome.getImage(0);
    assertNotNull(image.getAcquisitionDate());
    assertEquals(1, ome.sizeOfROIList());
    ROI roi = ome.getROI(0);
    Union union = roi.getUnion();
    assertEquals(1, union.sizeOfShapeList());
    Shape shape = union.getShape(0);
    assertTrue(shape instanceof Label);
    assertNotNull(shape.getText());
}
Also used : Shape(ome.xml.model.Shape) Label(ome.xml.model.Label) Image(ome.xml.model.Image) ROI(ome.xml.model.ROI) Union(ome.xml.model.Union) Test(org.testng.annotations.Test)

Example 3 with Label

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

the class Schema2011_06_File_Upgrade_Test method testShape3.

@Test(groups = { "11-06-u-roi" }, dependsOnMethods = { "testROI2AndUnion" })
public void testShape3() {
    Assert.assertNotNull(union2);
    shape3 = union2.getShape(0);
    Assert.assertEquals(Label.class.getName(), shape3.getClass().getName());
    Label label3 = (Label) shape3;
    Assert.assertEquals(ref.ROI2Shape3FillRule, label3.getFillRule());
    Assert.assertEquals(ref.ROI2Shape3FontFamily, label3.getFontFamily());
    Assert.assertEquals(ref.ROI2Shape3FontStyle, label3.getFontStyle());
    Assert.assertEquals(ref.ROI2Shape3TextX, label3.getX());
    Assert.assertEquals(ref.ROI2Shape3TextY, label3.getY());
    Assert.assertEquals(ref.ROI2Shape3TextValue, label3.getText());
}
Also used : Label(ome.xml.model.Label) Test(org.testng.annotations.Test)

Example 4 with Label

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

the class Schema2011_06_File_Upgrade_Test method testShape13.

@Test(groups = { "11-06-u-roi" }, dependsOnMethods = { "testROI4AndUnion" })
public void testShape13() {
    Assert.assertNotNull(union4);
    shape13 = union4.getShape(1);
    Assert.assertEquals(Label.class.getName(), shape13.getClass().getName());
    Label label13 = (Label) shape13;
    Assert.assertEquals(MESSAGE_REMOVED_PATH, label13.getText());
    Assert.assertEquals(Double.valueOf(0), label13.getX());
    Assert.assertEquals(Double.valueOf(0), label13.getY());
}
Also used : Label(ome.xml.model.Label) Test(org.testng.annotations.Test)

Example 5 with Label

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

the class Schema2011_06_File_Upgrade_Test method testShape11.

@Test(groups = { "11-06-u-roi" }, dependsOnMethods = { "testROI3AndUnion" })
public void testShape11() {
    Assert.assertNotNull(union3);
    shape11 = union3.getShape(0);
    Assert.assertEquals(Label.class.getName(), shape11.getClass().getName());
    Label label11 = (Label) shape11;
    Assert.assertEquals(MESSAGE_REMOVED_PATH, label11.getText());
    Assert.assertEquals(Double.valueOf(0), label11.getX());
    Assert.assertEquals(Double.valueOf(0), label11.getY());
}
Also used : Label(ome.xml.model.Label) Test(org.testng.annotations.Test)

Aggregations

Label (ome.xml.model.Label)6 Test (org.testng.annotations.Test)5 Ellipse (ome.xml.model.Ellipse)1 Image (ome.xml.model.Image)1 Line (ome.xml.model.Line)1 Mask (ome.xml.model.Mask)1 Point (ome.xml.model.Point)1 Polygon (ome.xml.model.Polygon)1 Polyline (ome.xml.model.Polyline)1 ROI (ome.xml.model.ROI)1 Rectangle (ome.xml.model.Rectangle)1 Shape (ome.xml.model.Shape)1 Union (ome.xml.model.Union)1