示例#1
0
  @Test
  public void loadLoaderFactoryMetaData() throws Exception {

    IMetadata meta = LoaderFactory.getMetadata(testFileFolder + file, null);
    assertEquals(meta.getMetaValue("MagicNumber"), "P5");
    assertEquals(meta.getMetaValue("Width"), "1024");
    assertEquals(meta.getMetaValue("Height"), "1024");
    assertEquals(meta.getMetaValue("Maxval"), "65535");
  }
示例#2
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);
  }
示例#3
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);
  }
示例#4
0
 @Before
 public void setup() {
   // clear state left over from any previous tests
   LoaderFactory.clear();
 }