Search in sources :

Example 26 with ServiceFactory

use of loci.common.services.ServiceFactory in project bioformats by openmicroscopy.

the class CellH5Reader method initializeJHDFService.

// -- Helper methods --
private void initializeJHDFService(String id) throws IOException, MissingLibraryException {
    try {
        ServiceFactory factory = new ServiceFactory();
        jhdf = factory.getInstance(JHDFService.class);
        jhdf.setFile(id);
    } catch (DependencyException e) {
        throw new MissingLibraryException(JHDFServiceImpl.NO_JHDF_MSG, e);
    }
}
Also used : ServiceFactory(loci.common.services.ServiceFactory) MissingLibraryException(loci.formats.MissingLibraryException) JHDFService(loci.formats.services.JHDFService) DependencyException(loci.common.services.DependencyException)

Example 27 with ServiceFactory

use of loci.common.services.ServiceFactory in project bioformats by openmicroscopy.

the class Schema2011_06_Instrument_Upgrade_Test method setUp.

@BeforeClass
public void setUp() throws Exception {
    InputStream source = this.getClass().getResourceAsStream(ref.FILE_LOCATION);
    ServiceFactory sf = new ServiceFactory();
    OMEXMLService service = sf.getInstance(OMEXMLService.class);
    String xml = XMLTools.transformXML(new StreamSource(source), UPDATE_201106);
    ome = (OME) service.createOMEXMLRoot(xml);
}
Also used : ServiceFactory(loci.common.services.ServiceFactory) InputStream(java.io.InputStream) StreamSource(javax.xml.transform.stream.StreamSource) OMEXMLService(loci.formats.services.OMEXMLService) BeforeClass(org.testng.annotations.BeforeClass)

Example 28 with ServiceFactory

use of loci.common.services.ServiceFactory in project bioformats by openmicroscopy.

the class WriterUtilities method createMetadata.

public static IMetadata createMetadata(String pixelType, int rgbChannels, int seriesCount, boolean littleEndian, int sizeT) throws Exception {
    IMetadata metadata;
    try {
        ServiceFactory factory = new ServiceFactory();
        OMEXMLService service = factory.getInstance(OMEXMLService.class);
        metadata = 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);
    }
    for (int i = 0; i < seriesCount; i++) {
        MetadataTools.populateMetadata(metadata, i, "image #" + i, littleEndian, "XYCZT", pixelType, 160, 160, 1, rgbChannels, sizeT, rgbChannels);
    }
    return metadata;
}
Also used : IMetadata(loci.formats.meta.IMetadata) ServiceException(loci.common.services.ServiceException) ServiceFactory(loci.common.services.ServiceFactory) DependencyException(loci.common.services.DependencyException) OMEXMLService(loci.formats.services.OMEXMLService) FormatException(loci.formats.FormatException)

Example 29 with ServiceFactory

use of loci.common.services.ServiceFactory 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;
}
Also used : PositiveInteger(ome.xml.model.primitives.PositiveInteger) IMetadata(loci.formats.meta.IMetadata) ServiceFactory(loci.common.services.ServiceFactory) OMEXMLService(loci.formats.services.OMEXMLService)

Example 30 with ServiceFactory

use of loci.common.services.ServiceFactory in project bioformats by openmicroscopy.

the class FakeReaderTest method setUp.

@BeforeMethod
public void setUp() throws Exception {
    wd = Files.createTempDirectory(this.getClass().getName());
    reader = new FakeReader();
    ServiceFactory sf = new ServiceFactory();
    service = sf.getInstance(OMEXMLService.class);
    reader.setMetadataStore(service.createOMEXMLMetadata());
}
Also used : ServiceFactory(loci.common.services.ServiceFactory) FakeReader(loci.formats.in.FakeReader) OMEXMLService(loci.formats.services.OMEXMLService) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

ServiceFactory (loci.common.services.ServiceFactory)94 OMEXMLService (loci.formats.services.OMEXMLService)73 DependencyException (loci.common.services.DependencyException)49 FormatException (loci.formats.FormatException)38 IMetadata (loci.formats.meta.IMetadata)35 ServiceException (loci.common.services.ServiceException)30 ImageReader (loci.formats.ImageReader)23 MissingLibraryException (loci.formats.MissingLibraryException)15 BeforeMethod (org.testng.annotations.BeforeMethod)15 MetadataStore (loci.formats.meta.MetadataStore)14 PositiveInteger (ome.xml.model.primitives.PositiveInteger)14 IOException (java.io.IOException)13 CoreMetadata (loci.formats.CoreMetadata)13 Length (ome.units.quantity.Length)12 Location (loci.common.Location)11 OMEXMLMetadata (loci.formats.ome.OMEXMLMetadata)10 InputStream (java.io.InputStream)9 ArrayList (java.util.ArrayList)8 MetadataRetrieve (loci.formats.meta.MetadataRetrieve)8 BeforeClass (org.testng.annotations.BeforeClass)8