@Override public void close() throws IOException { close(false); }
@Override public void close() throws IOException { close(false); }
@Override public void setId(String id) throws FormatException, IOException { if (getCurrentFile() != null && new Location(id).getAbsolutePath().equals(getCurrentFile())) { // already initialized this file return; } close(); initFile(id); }
@Override public void setId(String id) throws FormatException, IOException { if (getCurrentFile() != null && new Location(id).getAbsolutePath().equals(getCurrentFile())) { // already initialized this file return; } close(); initFile(id); }
fileSet.remove(file); try { reader.close();
@Test public void testUnderlyingReaders() throws IOException, FormatException { FakeReader reader = new FakeReader(); FileStitcher fs = new FileStitcher(reader); assertNotNull(fs.getUnderlyingReaders()); fs.setId("test_z<0-2>.fake"); assertNotNull(fs.getUnderlyingReaders()); fs.close(); }
@Test(dataProvider = "levels") public void testOptionsImplicit(MetadataLevel level) throws IOException, FormatException { FileStitcher fs = new FileStitcher(); fs.getMetadataOptions().setMetadataLevel(level); fs.setId("test_z<0-2>.fake"); for (IFormatReader r: fs.getUnderlyingReaders()) { assertEquals(r.getMetadataOptions().getMetadataLevel(), level); } fs.close(); }
private static void check(String pattern, String[] filenames, Integer[] dims) throws IOException, FormatException { FileStitcher fs = new FileStitcher(); fs.setId(pattern); assertEquals(fs.getFilePattern().getPattern(), pattern); assertEquals(fs.getImageCount(), SIZE_Z * SIZE_T * SIZE_C); assertEquals(fs.getSizeX(), SIZE_X); assertEquals(fs.getSizeY(), SIZE_Y); assertEquals(fs.getSizeZ(), SIZE_Z); assertEquals(fs.getSizeT(), SIZE_T); assertEquals(fs.getSizeC(), SIZE_C); assertEquals(fs.getPixelType(), PIXEL_TYPE); assertEqualsNoOrder(mkBasenames(fs.getUsedFiles()), filenames); checkPlanes(fs, dims); fs.close(); }
@Test public void testOptionsExplicit() throws IOException, FormatException { DynamicMetadataOptions opt = new DynamicMetadataOptions(); opt.set(KEY, VALUE); FileStitcher fs = new FileStitcher(); fs.setMetadataOptions(opt); fs.setId("test_z<0-2>.fake"); checkKV(fs.getUnderlyingReaders(), KEY, VALUE); DynamicMetadataOptions newOpt = new DynamicMetadataOptions(); String newValue = VALUE + "_"; newOpt.set(KEY, newValue); fs.setMetadataOptions(newOpt); checkKV(fs.getUnderlyingReaders(), KEY, newValue); fs.close(); }