Search in sources :

Example 1 with LightSourceSettings

use of ome.xml.model.LightSourceSettings 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 LightSourceSettings

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

the class Schema2011_06_Instrument_Upgrade_Test method testChannel0ToLightsourceSettings.

@Test(groups = { "11-06-i-links" }, dependsOnGroups = { "11-06-i-image", "11-06-i-lightsource" })
public void testChannel0ToLightsourceSettings() {
    Assert.assertNotNull(channel0);
    LightSourceSettings lightsourceSettings = channel0.getLightSourceSettings();
    Assert.assertNotNull(lightsourceSettings);
    Assert.assertEquals(ref.Image0LightSourceSettings0Attenuation, lightsourceSettings.getAttenuation());
    Assert.assertEquals(ref.Image0LightSourceSettings0Wavelength, lightsourceSettings.getWavelength());
    Assert.assertNull(lightsourceSettings.getMicrobeamManipulation());
}
Also used : LightSourceSettings(ome.xml.model.LightSourceSettings) Test(org.testng.annotations.Test)

Example 3 with LightSourceSettings

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

the class PumpWithLightSourceSettingsTest method setUp.

@BeforeClass
public void setUp() throws Exception {
    Instrument instrument = new Instrument();
    instrument.setID("Instrument:0");
    // Add a Laser with an Arc pump
    Laser laser = new Laser();
    laser.setID("Laser:0");
    Arc pump = new Arc();
    pump.setID("Arc:0");
    laser.linkPump(pump);
    instrument.addLightSource(laser);
    instrument.addLightSource(pump);
    ome.addInstrument(instrument);
    // Add an Image/Pixels with a LightSourceSettings reference to the Pump
    // on one of its channels.
    Image image = new Image();
    image.setID("Image:0");
    Pixels pixels = new Pixels();
    pixels.setID("Pixels:0");
    Channel channel = new Channel();
    channel.setID("Channel:0");
    LightSourceSettings settings = new LightSourceSettings();
    settings.setID("Arc:0");
    channel.setLightSourceSettings(settings);
    pixels.addChannel(channel);
    image.setPixels(pixels);
    ome.addImage(image);
}
Also used : LightSourceSettings(ome.xml.model.LightSourceSettings) Arc(ome.xml.model.Arc) Laser(ome.xml.model.Laser) Channel(ome.xml.model.Channel) Instrument(ome.xml.model.Instrument) Image(ome.xml.model.Image) Pixels(ome.xml.model.Pixels) BeforeClass(org.testng.annotations.BeforeClass)

Example 4 with LightSourceSettings

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

the class Schema2011_06_Instrument_Upgrade_Test method testChannel0ToLightsourceLinkage.

@Test(enabled = false, groups = { "11-06-i-links" }, dependsOnGroups = { "11-06-i-image", "11-06-i-lightsource" })
public void testChannel0ToLightsourceLinkage() {
    Assert.assertNotNull(channel0);
    LightSourceSettings lightsourceSettings = channel0.getLightSourceSettings();
    Assert.assertNotNull(lightsourceSettings);
    Assert.assertNotNull(lightsourceSettings.getLightSource());
    Assert.assertEquals(lightsource0, lightsourceSettings.getLightSource());
}
Also used : LightSourceSettings(ome.xml.model.LightSourceSettings) Test(org.testng.annotations.Test)

Example 5 with LightSourceSettings

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

the class GenericExcitationMapTest method setUp.

@BeforeClass
public void setUp() throws Exception {
    Instrument instrument = new Instrument();
    instrument.setID("Instrument:0");
    // Add a GenericExcitationSource with an Map
    GenericExcitationSource geSource = new GenericExcitationSource();
    geSource.setID("LightSource:0");
    List<MapPair> dataMap = new ArrayList<MapPair>();
    dataMap.add(new MapPair("a", "1"));
    dataMap.add(new MapPair("d", "2"));
    dataMap.add(new MapPair("c", "3"));
    dataMap.add(new MapPair("b", "4"));
    dataMap.add(new MapPair("e", "5"));
    dataMap.add(new MapPair("c", "6"));
    assertEquals(6, dataMap.size());
    geSource.setMap(dataMap);
    instrument.addLightSource(geSource);
    ome.addInstrument(instrument);
    // Add an Image/Pixels with a LightSourceSettings reference to the
    // GenericExcitationSource on one of its channels.
    Image image = new Image();
    image.setID("Image:0");
    Pixels pixels = new Pixels();
    pixels.setID("Pixels:0");
    Channel channel = new Channel();
    channel.setID("Channel:0");
    LightSourceSettings settings = new LightSourceSettings();
    settings.setID("LightSource:0");
    channel.setLightSourceSettings(settings);
    pixels.addChannel(channel);
    image.setPixels(pixels);
    ome.addImage(image);
}
Also used : MapPair(ome.xml.model.MapPair) LightSourceSettings(ome.xml.model.LightSourceSettings) GenericExcitationSource(ome.xml.model.GenericExcitationSource) Channel(ome.xml.model.Channel) Instrument(ome.xml.model.Instrument) ArrayList(java.util.ArrayList) Image(ome.xml.model.Image) Pixels(ome.xml.model.Pixels) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

LightSourceSettings (ome.xml.model.LightSourceSettings)5 Channel (ome.xml.model.Channel)3 Image (ome.xml.model.Image)3 Instrument (ome.xml.model.Instrument)3 Pixels (ome.xml.model.Pixels)3 BeforeClass (org.testng.annotations.BeforeClass)2 Test (org.testng.annotations.Test)2 ArrayList (java.util.ArrayList)1 Arc (ome.xml.model.Arc)1 BinData (ome.xml.model.BinData)1 CommentAnnotation (ome.xml.model.CommentAnnotation)1 GenericExcitationSource (ome.xml.model.GenericExcitationSource)1 Laser (ome.xml.model.Laser)1 LightPath (ome.xml.model.LightPath)1 MapPair (ome.xml.model.MapPair)1 ObjectiveSettings (ome.xml.model.ObjectiveSettings)1 NonNegativeLong (ome.xml.model.primitives.NonNegativeLong)1 PositiveInteger (ome.xml.model.primitives.PositiveInteger)1