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());
}
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);
}
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;
}
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;
}
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;
}
Aggregations