use of loci.formats.services.OMEXMLService in project bioformats by openmicroscopy.
the class WriterUtilities method createMetadata.
public static IMetadata createMetadata() throws DependencyException, ServiceException {
ServiceFactory sf = new ServiceFactory();
OMEXMLService service = sf.getInstance(OMEXMLService.class);
IMetadata metadata = service.createOMEXMLMetadata();
metadata.setPixelsDimensionOrder(DimensionOrder.XYZCT, 0);
metadata.setPixelsSizeX(new PositiveInteger(SIZE_X), 0);
metadata.setPixelsSizeY(new PositiveInteger(SIZE_Y), 0);
metadata.setPixelsSizeT(new PositiveInteger(SIZE_T), 0);
metadata.setPixelsSizeZ(new PositiveInteger(SIZE_Z), 0);
metadata.setPixelsSizeC(new PositiveInteger(SIZE_C), 0);
metadata.setPixelsType(PixelType.UINT8, 0);
metadata.setPixelsBinDataBigEndian(true, 0, 0);
metadata.setImageID("Image:1", 0);
metadata.setPixelsID("Pixels:1", 0);
metadata.setChannelID("Channel:1", 0, 0);
metadata.setChannelSamplesPerPixel(new PositiveInteger(1), 0, 0);
return metadata;
}
use of loci.formats.services.OMEXMLService in project bioformats by openmicroscopy.
the class LosslessJPEG2000Test method setUp.
@BeforeMethod
public void setUp() throws Exception {
File temp8 = File.createTempFile("test", ".jp2");
File temp16 = File.createTempFile("test", ".jp2");
temp8.deleteOnExit();
temp16.deleteOnExit();
Location.mapId(FILE_8, temp8.getAbsolutePath());
Location.mapId(FILE_16, temp16.getAbsolutePath());
IMetadata metadata8;
try {
ServiceFactory factory = new ServiceFactory();
OMEXMLService service = factory.getInstance(OMEXMLService.class);
metadata8 = service.createOMEXMLMetadata();
} catch (DependencyException exc) {
throw new FormatException("Could not create OME-XML store.", exc);
} catch (ServiceException exc) {
throw new FormatException("Could not create OME-XML store.", exc);
}
MetadataTools.populateMetadata(metadata8, 0, "foo", false, "XYCZT", "uint8", 1, 1, 1, 1, 1, 1);
IFormatWriter writer8 = new JPEG2000Writer();
writer8.setMetadataRetrieve(metadata8);
writer8.setId(FILE_8);
writer8.saveBytes(0, PIXELS_8);
writer8.close();
IMetadata metadata16;
try {
ServiceFactory factory = new ServiceFactory();
OMEXMLService service = factory.getInstance(OMEXMLService.class);
metadata16 = service.createOMEXMLMetadata();
} catch (DependencyException exc) {
throw new FormatException("Could not create OME-XML store.", exc);
} catch (ServiceException exc) {
throw new FormatException("Could not create OME-XML store.", exc);
}
MetadataTools.populateMetadata(metadata16, 0, "foo", false, "XYCZT", "uint16", 1, 1, 1, 1, 1, 1);
IFormatWriter writer16 = new JPEG2000Writer();
writer16.setMetadataRetrieve(metadata16);
writer16.setId(FILE_16);
writer16.saveBytes(0, PIXELS_16);
writer16.close();
}
use of loci.formats.services.OMEXMLService in project bioformats by openmicroscopy.
the class MissingOMEXMLServiceTest method testInstantiate.
@Test(expectedExceptions = { DependencyException.class })
public void testInstantiate() throws DependencyException {
OMEXMLService service = sf.getInstance(OMEXMLService.class);
assertNotNull(service);
}
use of loci.formats.services.OMEXMLService in project bioformats by openmicroscopy.
the class OMETiffWriterLargeImageWidthTest method setUp.
@BeforeClass
public void setUp() throws Exception {
target = File.createTempFile("OMETiffWriterTest", ".ome.tiff");
ServiceFactory sf = new ServiceFactory();
OMEXMLService service = sf.getInstance(OMEXMLService.class);
ms = service.createOMEXMLMetadata();
ms.setImageID("Image:1", 0);
ms.setPixelsID("Pixels:1", 0);
ms.setPixelsDimensionOrder(DimensionOrder.XYZCT, 0);
ms.setPixelsSizeX(new PositiveInteger(SIZE_X), 0);
ms.setPixelsSizeY(new PositiveInteger(SIZE_Y), 0);
ms.setPixelsSizeZ(new PositiveInteger(SIZE_Z), 0);
ms.setPixelsSizeC(new PositiveInteger(SIZE_C), 0);
ms.setPixelsSizeT(new PositiveInteger(SIZE_T), 0);
ms.setPixelsType(PixelType.UINT8, 0);
ms.setPixelsBinDataBigEndian(true, 0, 0);
ms.setChannelID("Channel:1", 0, 0);
ms.setChannelSamplesPerPixel(new PositiveInteger(1), 0, 0);
}
use of loci.formats.services.OMEXMLService in project bioformats by openmicroscopy.
the class OMETiffWriterBigTiffLargeImageWidthTest method setUp.
@BeforeClass
public void setUp() throws Exception {
target = File.createTempFile("OMETiffWriterTest", ".ome.tiff");
ServiceFactory sf = new ServiceFactory();
OMEXMLService service = sf.getInstance(OMEXMLService.class);
ms = service.createOMEXMLMetadata();
ms.setImageID("Image:1", 0);
ms.setPixelsID("Pixels:1", 0);
ms.setPixelsDimensionOrder(DimensionOrder.XYZCT, 0);
ms.setPixelsSizeX(new PositiveInteger(SIZE_X), 0);
ms.setPixelsSizeY(new PositiveInteger(SIZE_Y), 0);
ms.setPixelsSizeZ(new PositiveInteger(SIZE_Z), 0);
ms.setPixelsSizeC(new PositiveInteger(SIZE_C), 0);
ms.setPixelsSizeT(new PositiveInteger(SIZE_T), 0);
ms.setPixelsType(PixelType.UINT8, 0);
ms.setPixelsBinDataBigEndian(true, 0, 0);
ms.setChannelID("Channel:1", 0, 0);
ms.setChannelSamplesPerPixel(new PositiveInteger(1), 0, 0);
}
Aggregations