JiffleDescriptor.create( sources, sourceNames,
/** * Registers the MaskedConvolve operation and its * associated image factories across all supported operation modes. * * @param registry The registry with which to register the operations * and their factories. */ public void updateRegistry(OperationRegistry registry) { OperationDescriptor op = new JiffleDescriptor(); registry.registerDescriptor(op); String descName = op.getName(); RenderedImageFactory rif = new JiffleRIF(); registry.registerFactory(RenderedRegistryMode.MODE_NAME, descName, productName, rif); } }
@Test public void testCopyNonDefaults() { RenderedImage src = buildTestImage(10, 10); RenderedOp op = JiffleDescriptor.create(new RenderedImage[] {src}, new String[] {"a"}, "b", "b = a;", null, DataBuffer.TYPE_BYTE, null, null, null); assertCopy(src, op, DataBuffer.TYPE_BYTE); }
/** * Registers the MaskedConvolve operation and its * associated image factories across all supported operation modes. * * @param registry The registry with which to register the operations * and their factories. */ public void updateRegistry(OperationRegistry registry) { OperationDescriptor op = new JiffleDescriptor(); registry.registerDescriptor(op); String descName = op.getName(); RenderedImageFactory rif = new JiffleRIF(); registry.registerFactory(RenderedRegistryMode.MODE_NAME, descName, productName, rif); } }
@Test public void testCopyDefaults() { RenderedImage src = buildTestImage(10, 10); RenderedOp op = JiffleDescriptor.create(new RenderedImage[] {src}, null, null, "dest = src;", null, null, null, null, null); assertCopy(src, op, DataBuffer.TYPE_DOUBLE); }
@Test public void testCopyRemappedDefaults() { RenderedImage src = buildTestImage(10, 10); BandTransform transform = (x, y, b) -> 0; RenderedOp op = JiffleDescriptor.create(new RenderedImage[] {src}, null, null, "dest = src[10];", null, null, null, new BandTransform[] {transform}, null); assertCopy(src, op, DataBuffer.TYPE_DOUBLE); }
@Test public void testSum() { RenderedImage src1 = buildTestImage(10, 10); RenderedImage src2 = buildTestImage(10, 10); RenderedOp op = JiffleDescriptor.create(new RenderedImage[] {src1, src2}, new String[] {"a", "b"}, "res", "res = a + b;", null, DataBuffer.TYPE_INT, null, null, null); // check same size and expected assertEquals(src1.getMinX(), op.getMinX()); assertEquals(src1.getWidth(), op.getWidth()); assertEquals(src1.getMinY(), op.getMinY()); assertEquals(src1.getHeight(), op.getHeight()); assertEquals(DataBuffer.TYPE_INT, op.getSampleModel().getDataType()); RandomIter srcIter = RandomIterFactory.create(src1, null); RandomIter opIter = RandomIterFactory.create(op, null); for(int y = src1.getMinY(); y < src1.getMinY() + src1.getHeight(); y++) { for(int x = src1.getMinX(); x < src1.getMinX() + src1.getWidth(); x++) { double expected = srcIter.getSampleDouble(x, y, 0) * 2; double actual = opIter.getSampleDouble(x, y, 0); assertEquals(expected, actual, 0d); } } }