String file = fileSet.iterator().next(); try { reader.setId(file); } catch (Exception e) { LOGGER.error("setId(\"{}\") failed", file, e);
@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(); }
@Override protected void initFile(String id) throws FormatException, IOException { // read the pattern from the file // the file should just contain a single line with the relative or // absolute file pattern currentId = new Location(id).getAbsolutePath(); String pattern = DataTools.readFile(id).trim(); String dir = new Location(id).getAbsoluteFile().getParent(); if (new Location(pattern).getParent() == null) { pattern = dir + File.separator + pattern; } helper.setUsingPatternIds(true); helper.setCanChangePattern(false); helper.setId(pattern); core = helper.getCoreMetadataList(); }
@Override protected void initFile(String id) throws FormatException, IOException { // read the pattern from the file // the file should just contain a single line with the relative or // absolute file pattern currentId = new Location(id).getAbsolutePath(); String pattern = DataTools.readFile(id).trim(); String dir = new Location(id).getAbsoluteFile().getParent(); if (new Location(pattern).getParent() == null) { pattern = dir + File.separator + pattern; } helper.setUsingPatternIds(true); helper.setCanChangePattern(false); helper.setId(pattern); core = helper.getCoreMetadataList(); }
@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(); }
fileStitcher.setId(id); fileStitcher.setUsingPatternIds(true); fileStitcher.setCanChangePattern(false);
fileStitcher.setId(id); fileStitcher.setUsingPatternIds(true); fileStitcher.setCanChangePattern(false);