Search in sources :

Example 41 with ImageReader

use of loci.formats.ImageReader in project bioformats by openmicroscopy.

the class ImageReaderTest method testOptionsExplicit.

@Test
public void testOptionsExplicit() throws Exception {
    DynamicMetadataOptions opt = new DynamicMetadataOptions();
    opt.set(KEY, VALUE);
    ImageReader reader = new ImageReader();
    reader.setMetadataOptions(opt);
    reader.setId("test.fake");
    MetadataOptions rOpt = reader.getReader().getMetadataOptions();
    assertTrue(rOpt instanceof DynamicMetadataOptions);
    String v = ((DynamicMetadataOptions) rOpt).get(KEY);
    assertNotNull(v);
    assertEquals(v, VALUE);
    reader.close();
}
Also used : MetadataOptions(loci.formats.in.MetadataOptions) DynamicMetadataOptions(loci.formats.in.DynamicMetadataOptions) DynamicMetadataOptions(loci.formats.in.DynamicMetadataOptions) ImageReader(loci.formats.ImageReader) Test(org.testng.annotations.Test)

Example 42 with ImageReader

use of loci.formats.ImageReader in project bioformats by openmicroscopy.

the class IsThisTypeTests method setUp.

@BeforeMethod
public void setUp() {
    openReader = new ImageReader();
    noOpenReader = new ImageReader();
    noOpenReader.setAllowOpenFiles(false);
}
Also used : ImageReader(loci.formats.ImageReader) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 43 with ImageReader

use of loci.formats.ImageReader in project bioformats by openmicroscopy.

the class ReaderEqualityTest method createEqualWrappers.

@DataProvider(name = "equalWrappers")
public Object[][] createEqualWrappers() {
    Location.mapId(TEST_FILE_A, TEST_FILE_A);
    Location.mapId(TEST_FILE_B, TEST_FILE_B);
    Object[][] wrappers = new Object[][] { { new ImageReader(), new ImageReader() }, { new ImageReader(), new ImageReader() }, { new MinMaxCalculator(new ChannelSeparator(new ChannelFiller())), new MinMaxCalculator(new ChannelSeparator(new ChannelFiller())) }, { new DimensionSwapper(new ChannelMerger()), new DimensionSwapper(new ChannelMerger()) } };
    for (int i = 1; i < wrappers.length; i++) {
        IFormatReader readerA = (IFormatReader) wrappers[i][0];
        IFormatReader readerB = (IFormatReader) wrappers[i][1];
        try {
            readerA.setId(TEST_FILE_A);
            readerB.setId(TEST_FILE_B);
        } catch (FormatException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    return wrappers;
}
Also used : IFormatReader(loci.formats.IFormatReader) MinMaxCalculator(loci.formats.MinMaxCalculator) ChannelMerger(loci.formats.ChannelMerger) DimensionSwapper(loci.formats.DimensionSwapper) ChannelFiller(loci.formats.ChannelFiller) IOException(java.io.IOException) ImageReader(loci.formats.ImageReader) ChannelSeparator(loci.formats.ChannelSeparator) FormatException(loci.formats.FormatException) DataProvider(org.testng.annotations.DataProvider)

Example 44 with ImageReader

use of loci.formats.ImageReader in project bioformats by openmicroscopy.

the class ReaderEqualityTest method createUnequalWrappers.

@DataProvider(name = "unequalWrappers")
public Object[][] createUnequalWrappers() {
    Object[][] wrappers = new Object[][] { { new ImageReader(), new ImageReader() }, { new ImageReader(), new ImageReader() }, { new MinMaxCalculator(new ChannelSeparator(new ChannelFiller())), new MinMaxCalculator(new ChannelSeparator()) }, { new DimensionSwapper(new ChannelMerger()), new DimensionSwapper(new ChannelMerger()) } };
    for (int i = 0; i < wrappers.length; i++) {
        IFormatReader readerA = (IFormatReader) wrappers[i][0];
        IFormatReader readerB = (IFormatReader) wrappers[i][1];
        try {
            if (i != 1) {
                readerA.setId(TEST_FILE_A);
            } else {
                readerA.setId(TEST_FILE_B);
            }
            if (i > 1) {
                readerB.setId(TEST_FILE_B);
            } else if (i == 1) {
                readerB.setId(TEST_FILE_A);
            }
        } catch (FormatException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    return wrappers;
}
Also used : IFormatReader(loci.formats.IFormatReader) MinMaxCalculator(loci.formats.MinMaxCalculator) ChannelMerger(loci.formats.ChannelMerger) DimensionSwapper(loci.formats.DimensionSwapper) ChannelFiller(loci.formats.ChannelFiller) IOException(java.io.IOException) ImageReader(loci.formats.ImageReader) ChannelSeparator(loci.formats.ChannelSeparator) FormatException(loci.formats.FormatException) DataProvider(org.testng.annotations.DataProvider)

Example 45 with ImageReader

use of loci.formats.ImageReader in project bioformats by openmicroscopy.

the class WrapperTest method createWrappers.

@DataProvider(name = "wrappers")
public Object[][] createWrappers() {
    Location.mapId(TEST_FILE, TEST_FILE);
    Object[][] wrappers = new Object[][] { { new ChannelFiller() }, { new ChannelMerger() }, { new ChannelSeparator() }, { new DimensionSwapper() }, { new FileStitcher() }, { new ImageReader() }, { new MinMaxCalculator() }, { new Memoizer() } };
    for (int i = 0; i < wrappers.length; i++) {
        IFormatReader reader = (IFormatReader) wrappers[i][0];
        try {
            reader.setId(TEST_FILE);
        } catch (FormatException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    return wrappers;
}
Also used : IFormatReader(loci.formats.IFormatReader) Memoizer(loci.formats.Memoizer) ChannelMerger(loci.formats.ChannelMerger) ChannelFiller(loci.formats.ChannelFiller) IOException(java.io.IOException) ChannelSeparator(loci.formats.ChannelSeparator) FormatException(loci.formats.FormatException) FileStitcher(loci.formats.FileStitcher) MinMaxCalculator(loci.formats.MinMaxCalculator) DimensionSwapper(loci.formats.DimensionSwapper) ImageReader(loci.formats.ImageReader) DataProvider(org.testng.annotations.DataProvider)

Aggregations

ImageReader (loci.formats.ImageReader)71 ServiceFactory (loci.common.services.ServiceFactory)23 OMEXMLService (loci.formats.services.OMEXMLService)23 FormatException (loci.formats.FormatException)20 IFormatReader (loci.formats.IFormatReader)20 IMetadata (loci.formats.meta.IMetadata)19 Test (org.testng.annotations.Test)15 IOException (java.io.IOException)11 ChannelFiller (loci.formats.ChannelFiller)11 DependencyException (loci.common.services.DependencyException)10 ServiceException (loci.common.services.ServiceException)10 ChannelSeparator (loci.formats.ChannelSeparator)10 MinMaxCalculator (loci.formats.MinMaxCalculator)10 BufferedImageReader (loci.formats.gui.BufferedImageReader)8 ImageWriter (loci.formats.ImageWriter)7 File (java.io.File)6 FileStitcher (loci.formats.FileStitcher)6 OMETiffWriter (loci.formats.out.OMETiffWriter)6 Location (loci.common.Location)5 DimensionSwapper (loci.formats.DimensionSwapper)5