Java Code Examples for loci.formats.IFormatReader#close()
The following examples show how to use
loci.formats.IFormatReader#close() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OrbitImageBioformats.java From orbit-image-analysis with GNU General Public License v3.0 | 5 votes |
private IFormatReader getIFormatReader(String filename, final OrbitModel orbitModel) { IFormatReader r; if (filename.toLowerCase().endsWith("ndpis")) { r = new NDPISReaderOrbit(); if (orbitModel!=null) { // mIHC demuxing active? if (orbitModel.getFeatureDescription().isMihcActive()) { try { BufferedImageReader bir = new BufferedImageReader(r); bir.setId(filename); double[] gains = NDPIUtils.getExposureTimesGain((NDPISReaderOrbit) r); r.close(); MihcConfig mihcConfig = new MihcConfig(orbitModel.getFeatureDescription().getMihcMatrixChannelNames(),orbitModel.getFeatureDescription().getMihcMatrix(),orbitModel.getFeatureDescription().getMihcNormalGain()); r = new MultiplexImageReader(bir,mihcConfig,gains); logger.info("multiplex reader used"); } catch (Exception e) { e.printStackTrace(); } } } } else if (filename.toLowerCase().endsWith("ndpi")) { // this check will become unnecessary when this bug is fixed: https://github.com/ome/bioformats/issues/3544 // could then just use ImageReader() and allow it to auto-detect. r = new NDPIReader(); } else { r = new ImageReader(); } // r.setAllowOpenFiles(true); r.setFlattenedResolutions(false); return r; }
Example 2
Source File: OrbitImageBioformats.java From orbit-image-analysis with GNU General Public License v3.0 | 5 votes |
@Override public void close() throws IOException { synchronized (allReaders) { for (IFormatReader r: allReaders) { try { r.close(); } catch (Exception e) { } } } }