Search in sources :

Example 1 with NonNegativeLong

use of ome.xml.model.primitives.NonNegativeLong 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 2 with NonNegativeLong

use of ome.xml.model.primitives.NonNegativeLong in project bioformats by openmicroscopy.

the class FakeReader method fillRegions.

private void fillRegions(MetadataStore store, int imageIndex) {
    int roiRefCount = 0;
    String roiID;
    Random random = new Random();
    for (int i = 0; i < ellipses; i++) {
        roiID = ROI_PREFIX + roiCount;
        store.setROIID(roiID, roiCount);
        store.setEllipseID(SHAPE_PREFIX + roiCount, roiCount, 0);
        store.setEllipseX(getX(i) + ROI_SPACING / 2, roiCount, 0);
        store.setEllipseY(getY(i) + ROI_SPACING / 2, roiCount, 0);
        store.setEllipseRadiusX(new Double(ROI_SPACING / 2), roiCount, 0);
        store.setEllipseRadiusY(new Double(ROI_SPACING / 2), roiCount, 0);
        store.setImageROIRef(roiID, imageIndex, roiRefCount);
        roiCount++;
        roiRefCount++;
    }
    for (int i = 0; i < labels; i++) {
        roiID = ROI_PREFIX + roiCount;
        store.setROIID(roiID, roiCount);
        store.setLabelID(SHAPE_PREFIX + roiCount, roiCount, 0);
        store.setLabelX(getX(i), roiCount, 0);
        store.setLabelY(getY(i), roiCount, 0);
        store.setLabelText("Label " + i, roiCount, 0);
        store.setImageROIRef(roiID, imageIndex, roiRefCount);
        roiCount++;
        roiRefCount++;
    }
    for (int i = 0; i < lines; i++) {
        roiID = ROI_PREFIX + roiCount;
        store.setROIID(roiID, roiCount);
        store.setLineID(SHAPE_PREFIX + roiCount, roiCount, 0);
        store.setLineX1(getX(i) + ROI_SPACING / 4, roiCount, 0);
        store.setLineY1(getY(i) + ROI_SPACING / 4, roiCount, 0);
        store.setLineX2(getX(i) + ROI_SPACING / 2, roiCount, 0);
        store.setLineY2(getY(i) + ROI_SPACING / 2, roiCount, 0);
        store.setImageROIRef(roiID, imageIndex, roiRefCount);
        roiCount++;
        roiRefCount++;
    }
    for (int i = 0; i < masks; i++) {
        roiID = ROI_PREFIX + roiCount;
        store.setROIID(roiID, roiCount);
        store.setMaskID(SHAPE_PREFIX + roiCount, roiCount, 0);
        store.setMaskX((double) ROI_SPACING, roiCount, 0);
        store.setMaskY((double) ROI_SPACING, roiCount, 0);
        store.setMaskWidth((double) ROI_SPACING, roiCount, 0);
        store.setMaskHeight((double) ROI_SPACING, roiCount, 0);
        store.setImageROIRef(roiID, imageIndex, roiRefCount);
        byte[] rawBytes = new byte[ROI_SPACING * ROI_SPACING];
        random.nextBytes(rawBytes);
        store.setMaskBinData(rawBytes, roiCount, 0);
        store.setMaskBinDataBigEndian(true, roiCount, 0);
        store.setMaskBinDataLength(new NonNegativeLong((long) ROI_SPACING * ROI_SPACING), roiCount, 0);
        roiCount++;
        roiRefCount++;
    }
    for (int i = 0; i < points; i++) {
        roiID = ROI_PREFIX + roiCount;
        store.setROIID(roiID, roiCount);
        store.setPointID(SHAPE_PREFIX + roiCount, roiCount, 0);
        store.setPointX(getX(i) + ROI_SPACING / 2, roiCount, 0);
        store.setPointY(getY(i) + ROI_SPACING / 2, roiCount, 0);
        store.setImageROIRef(roiID, imageIndex, roiRefCount);
        roiCount++;
        roiRefCount++;
    }
    for (int i = 0; i < polygons; i++) {
        roiID = ROI_PREFIX + roiCount;
        store.setROIID(roiID, roiCount);
        store.setPolygonID(SHAPE_PREFIX + roiCount, roiCount, 0);
        store.setPolygonPoints(getPoints(i), roiCount, 0);
        store.setImageROIRef(roiID, imageIndex, roiRefCount);
        roiCount++;
        roiRefCount++;
    }
    for (int i = 0; i < polylines; i++) {
        roiID = ROI_PREFIX + roiCount;
        store.setROIID(roiID, roiCount);
        store.setPolylineID(SHAPE_PREFIX + roiCount, roiCount, 0);
        store.setPolylinePoints(getPoints(i), roiCount, 0);
        store.setImageROIRef(roiID, imageIndex, roiRefCount);
        roiCount++;
        roiRefCount++;
    }
    for (int i = 0; i < rectangles; i++) {
        roiID = ROI_PREFIX + roiCount;
        store.setROIID(roiID, roiCount);
        store.setRectangleID(SHAPE_PREFIX + roiCount, roiCount, 0);
        store.setRectangleX(getX(i) + ROI_SPACING / 4, roiCount, 0);
        store.setRectangleY(getY(i) + ROI_SPACING / 4, roiCount, 0);
        store.setRectangleWidth(new Double(ROI_SPACING / 2), roiCount, 0);
        store.setRectangleHeight(new Double(ROI_SPACING / 2), roiCount, 0);
        store.setImageROIRef(roiID, imageIndex, roiRefCount);
        roiCount++;
        roiRefCount++;
    }
}
Also used : NonNegativeLong(ome.xml.model.primitives.NonNegativeLong) Random(java.util.Random)

Example 3 with NonNegativeLong

use of ome.xml.model.primitives.NonNegativeLong in project bioformats by openmicroscopy.

the class BaseModelMock method makeImage.

private Image makeImage(int index) {
    // Create <Image/>
    Image image = new Image();
    image.setID("Image:" + index);
    // 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);
        pixels.addChannel(channel);
    }
    // Put <Pixels/> under <Image/>
    image.setPixels(pixels);
    return image;
}
Also used : PositiveInteger(ome.xml.model.primitives.PositiveInteger) NonNegativeLong(ome.xml.model.primitives.NonNegativeLong) BinData(ome.xml.model.BinData) Channel(ome.xml.model.Channel) Image(ome.xml.model.Image) Pixels(ome.xml.model.Pixels)

Aggregations

NonNegativeLong (ome.xml.model.primitives.NonNegativeLong)3 BinData (ome.xml.model.BinData)2 Channel (ome.xml.model.Channel)2 Image (ome.xml.model.Image)2 Pixels (ome.xml.model.Pixels)2 PositiveInteger (ome.xml.model.primitives.PositiveInteger)2 Random (java.util.Random)1 CommentAnnotation (ome.xml.model.CommentAnnotation)1 Instrument (ome.xml.model.Instrument)1 LightPath (ome.xml.model.LightPath)1 LightSourceSettings (ome.xml.model.LightSourceSettings)1 ObjectiveSettings (ome.xml.model.ObjectiveSettings)1