@Test public void testMerlinDataLoaderU32() throws Exception { final String path = testFileFolder + "I13-20150210-101459-1.mib"; IDataHolder dataHolder = LoaderFactory.getData(path, null); IDataset data = dataHolder.getDataset(0); int[] shape = data.getShape(); assertEquals(515, shape[0], 0.0); assertEquals(515, shape[1], 0.0); }
@Test public void testMerlinDataLoader() throws Exception { final String path = testFileFolder + "default1.mib"; IDataHolder dataHolder = LoaderFactory.getData(path, null); IDataset data = dataHolder.getDataset(0); int[] shape = data.getShape(); assertEquals(512, shape[0], 0.0); assertEquals(512, shape[1], 0.0); assertEquals(4095, data.max().intValue(), 0.0); }
@Test public void loadLoaderFactory() throws Exception { IDataHolder dataHolder = LoaderFactory.getData(testFileFolder + file, null); IDataset data = dataHolder.getDataset("Portable Grey Map"); // Check the first data point assertEquals(data.getDouble(0, 0), 0.0, 0.0); // Check the middle data point assertEquals(data.getDouble(512, 511), 15104.0, 0.0); // Check the last data point assertEquals(data.getDouble(1023, 1023), 0.0, 0.0); }
@Test public void lazyLoadLoaderFactory() throws Exception { IDataHolder dataHolder = LoaderFactory.getData(testFileFolder + file, true, true, true, null); ILazyDataset lazy = dataHolder.getLazyDataset("Portable Grey Map"); assertArrayEquals(new int[] {1024, 1024}, lazy.getShape()); IDataset data = lazy.getSlice(); // Check the first data point assertEquals(data.getDouble(0, 0), 0.0, 0.0); // Check the middle data point assertEquals(data.getDouble(512, 511), 15104.0, 0.0); // Check the last data point assertEquals(data.getDouble(1023, 1023), 0.0, 0.0); }
@Test public void testLoaderFactory() throws Exception { IDataHolder dh = LoaderFactory.getData(testfile1, null); if (dh == null || dh.getNames().length < 1) throw new Exception(); }