use of loci.formats.Memoizer in project bioformats by openmicroscopy.
the class MemoizerTest method testConstructorReaderTimeElapsed.
@Test
public void testConstructorReaderTimeElapsed() throws Exception {
Memoizer memoizer = new Memoizer(reader, 0);
checkMemoFile(memoizer.getMemoFile(id));
checkMemo(memoizer, id);
}
use of loci.formats.Memoizer in project bioformats by openmicroscopy.
the class MemoizerTest method testDefaultConstructor.
public void testDefaultConstructor() throws Exception {
Memoizer memoizer = new Memoizer();
checkMemoFile(memoizer.getMemoFile(id));
}
use of loci.formats.Memoizer in project bioformats by openmicroscopy.
the class FormatReaderTest method setupReader.
// -- Helper methods --
/**
* Sets up the current IFormatReader.
*/
private void setupReader() {
// Remove external SlideBook6Reader class for testing purposes
ImageReader ir = new ImageReader();
reader = new BufferedImageReader(new FileStitcher(new Memoizer(ir, Memoizer.DEFAULT_MINIMUM_ELAPSED, new File(""))));
reader.setMetadataOptions(new DefaultMetadataOptions(MetadataLevel.NO_OVERLAYS));
reader.setNormalized(true);
reader.setOriginalMetadataPopulated(false);
reader.setMetadataFiltered(true);
MetadataStore store = null;
try {
store = omexmlService.createOMEXMLMetadata();
} catch (ServiceException e) {
LOGGER.warn("Could not parse OME-XML", e);
}
reader.setMetadataStore(store);
}
use of loci.formats.Memoizer 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.Memoizer in project bioformats by openmicroscopy.
the class MemoizerTest method testWrappedReader.
@Test
public void testWrappedReader() throws Exception {
Memoizer memoizer = new Memoizer(reader, 0);
File memoFile = memoizer.getMemoFile(id);
assertFalse(memoFile.exists());
reader.setId(id);
assertFalse(memoFile.exists());
reader.close();
checkMemo(memoizer, id);
}
Aggregations