use of ome.xml.model.Pixels in project bioformats by openmicroscopy.
the class OMEXMLServiceImpl method removeChannels.
/**
* @see OMEXMLService#removeChannels(OMEXMLMetadata, int, int)
*/
@Override
public void removeChannels(OMEXMLMetadata omexmlMeta, int image, int sizeC) {
omexmlMeta.resolveReferences();
OMEXMLMetadataRoot root = (OMEXMLMetadataRoot) omexmlMeta.getRoot();
Pixels img = root.getImage(image).getPixels();
List<Channel> channels = img.copyChannelList();
for (int c = 0; c < channels.size(); c++) {
Channel channel = channels.get(c);
if (channel.getID() == null || c >= sizeC) {
img.removeChannel(channel);
}
}
omexmlMeta.setRoot(root);
}
use of ome.xml.model.Pixels 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);
}
use of ome.xml.model.Pixels 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);
}
use of ome.xml.model.Pixels in project bioformats by openmicroscopy.
the class InOutCurrentTest method testValidPixelsNode.
@Test(dependsOnMethods = { "testValidImageNode" })
public void testValidPixelsNode() {
Pixels pixels = ome.getImage(0).getPixels();
assertEquals(SIZE_X, pixels.getSizeX().getValue());
assertEquals(SIZE_Y, pixels.getSizeY().getValue());
assertEquals(SIZE_Z, pixels.getSizeZ().getValue());
assertEquals(SIZE_C, pixels.getSizeC().getValue());
assertEquals(SIZE_T, pixels.getSizeT().getValue());
assertEquals(DIMENSION_ORDER, pixels.getDimensionOrder());
assertEquals(PIXEL_TYPE, pixels.getType());
assertEquals(1, pixels.sizeOfTiffDataList());
}
use of ome.xml.model.Pixels in project bioformats by openmicroscopy.
the class InOutCurrentTest method testValidChannelNode.
@Test(dependsOnMethods = { "testValidPixelsNode" })
public void testValidChannelNode() {
Pixels pixels = ome.getImage(0).getPixels();
assertEquals(3, pixels.sizeOfChannelList());
for (Channel channel : pixels.copyChannelList()) {
assertNotNull(channel.getID());
}
}
Aggregations