Search in sources :

Example 6 with ChannelFiller

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

the class BaseModelNoBinDataReaderTest method testSetId.

@Test
public void testSetId() throws Exception {
    reader = new MinMaxCalculator(new ChannelSeparator(new ChannelFiller(new ImageReader())));
    metadata = new OMEXMLMetadataImpl();
    reader.setMetadataStore(metadata);
    reader.setId(temporaryFile.getAbsolutePath());
}
Also used : MinMaxCalculator(loci.formats.MinMaxCalculator) ChannelFiller(loci.formats.ChannelFiller) ImageReader(loci.formats.ImageReader) ChannelSeparator(loci.formats.ChannelSeparator) OMEXMLMetadataImpl(loci.formats.ome.OMEXMLMetadataImpl) Test(org.testng.annotations.Test)

Example 7 with ChannelFiller

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

the class ImageInfo method configureReaderPreInit.

public void configureReaderPreInit() throws FormatException, IOException {
    if (omexml) {
        reader.setOriginalMetadataPopulated(originalMetadata);
        try {
            ServiceFactory factory = new ServiceFactory();
            OMEXMLService service = factory.getInstance(OMEXMLService.class);
            reader.setMetadataStore(service.createOMEXMLMetadata(null, omexmlVersion));
        } catch (DependencyException de) {
            throw new MissingLibraryException(OMEXMLServiceImpl.NO_OME_XML_MSG, de);
        } catch (ServiceException se) {
            throw new FormatException(se);
        }
    }
    // check file format
    if (reader instanceof ImageReader) {
        // determine format
        ImageReader ir = (ImageReader) reader;
        if (new Location(id).exists()) {
            LOGGER.info("Checking file format [{}]", ir.getFormat(id));
        }
    } else {
        // verify format
        LOGGER.info("Checking {} format [{}]", reader.getFormat(), reader.isThisType(id) ? "yes" : "no");
    }
    LOGGER.info("Initializing reader");
    if (stitch) {
        reader = new FileStitcher(reader, true);
        Location f = new Location(id);
        String pat = null;
        if (!f.exists()) {
            ((FileStitcher) reader).setUsingPatternIds(true);
            pat = id;
        } else {
            pat = FilePattern.findPattern(f);
        }
        if (pat != null)
            id = pat;
    }
    if (expand)
        reader = new ChannelFiller(reader);
    if (separate)
        reader = new ChannelSeparator(reader);
    if (merge)
        reader = new ChannelMerger(reader);
    if (cache) {
        if (cachedir != null) {
            reader = new Memoizer(reader, 0, new File(cachedir));
        } else {
            reader = new Memoizer(reader, 0);
        }
    }
    minMaxCalc = null;
    if (minmax || autoscale)
        reader = minMaxCalc = new MinMaxCalculator(reader);
    dimSwapper = null;
    if (swapOrder != null || shuffleOrder != null) {
        reader = dimSwapper = new DimensionSwapper(reader);
    }
    reader = biReader = new BufferedImageReader(reader);
    reader.close();
    reader.setNormalized(normalize);
    reader.setMetadataFiltered(filter);
    reader.setGroupFiles(group);
    options.setMetadataLevel(doMeta ? MetadataLevel.ALL : MetadataLevel.MINIMUM);
    options.setValidate(validate);
    reader.setMetadataOptions(options);
    reader.setFlattenedResolutions(flat);
}
Also used : ServiceFactory(loci.common.services.ServiceFactory) Memoizer(loci.formats.Memoizer) ChannelMerger(loci.formats.ChannelMerger) ChannelFiller(loci.formats.ChannelFiller) BufferedImageReader(loci.formats.gui.BufferedImageReader) DependencyException(loci.common.services.DependencyException) OMEXMLService(loci.formats.services.OMEXMLService) FormatException(loci.formats.FormatException) ChannelSeparator(loci.formats.ChannelSeparator) ServiceException(loci.common.services.ServiceException) FileStitcher(loci.formats.FileStitcher) MinMaxCalculator(loci.formats.MinMaxCalculator) MissingLibraryException(loci.formats.MissingLibraryException) DimensionSwapper(loci.formats.DimensionSwapper) ImageReader(loci.formats.ImageReader) BufferedImageReader(loci.formats.gui.BufferedImageReader) File(java.io.File) Location(loci.common.Location)

Example 8 with ChannelFiller

use of loci.formats.ChannelFiller 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 9 with ChannelFiller

use of loci.formats.ChannelFiller 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 10 with ChannelFiller

use of loci.formats.ChannelFiller 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

ChannelFiller (loci.formats.ChannelFiller)12 ChannelSeparator (loci.formats.ChannelSeparator)11 ImageReader (loci.formats.ImageReader)11 MinMaxCalculator (loci.formats.MinMaxCalculator)11 DimensionSwapper (loci.formats.DimensionSwapper)6 ChannelMerger (loci.formats.ChannelMerger)5 FormatException (loci.formats.FormatException)5 Test (org.testng.annotations.Test)5 FileStitcher (loci.formats.FileStitcher)4 IFormatReader (loci.formats.IFormatReader)4 OMEXMLMetadataImpl (loci.formats.ome.OMEXMLMetadataImpl)4 IOException (java.io.IOException)3 DataProvider (org.testng.annotations.DataProvider)3 Location (loci.common.Location)2 DependencyException (loci.common.services.DependencyException)2 ServiceException (loci.common.services.ServiceException)2 ServiceFactory (loci.common.services.ServiceFactory)2 Memoizer (loci.formats.Memoizer)2 MissingLibraryException (loci.formats.MissingLibraryException)2 OMEXMLService (loci.formats.services.OMEXMLService)2