@Override public BitType createOutput() { return new BitType(); } }
@Override public BitType createVariable() { return new BitType(); }
@Override public BitType duplicateTypeOnSameNativeImg() { return new BitType( img ); }
@Override public BitType createVariable() { return new BitType(); }
@Override public BitType createOutput() { return new BitType(); } }
@Override public BitType createOutput() { return new BitType(); } }
@Override public BitType createOutput() { return new BitType(); } }
@Override public BitType copy() { return new BitType( get() ); }
/** * Create an {@link ArrayImg}<{@link BitType}, {@link LongArray}>. */ @SuppressWarnings( "unchecked" ) final static public ArrayImg< BitType, LongArray > bits( final long... dim ) { return ( ArrayImg< BitType, LongArray > ) new ArrayImgFactory<>( new BitType() ).create( dim ); }
/** * Create a new mask image without any specific content, but with * a defined size. */ public static RandomAccessibleInterval<BitType> createMask(long[] dim) { ImgFactory< BitType > imgFactory = new ArrayImgFactory< BitType >(); return imgFactory.create(dim, new BitType()); }
@Test public void testOr() { assertTrue(((BitType) ops.run(BooleanTypeLogic.Or.class, new BitType(true), new BitType(true))).get()); assertTrue(((BitType) ops.run(BooleanTypeLogic.Or.class, new BitType(true), new BitType(false))).get()); assertTrue(((BitType) ops.run(BooleanTypeLogic.Or.class, new BitType(false), new BitType(true))).get()); assertFalse(((BitType) ops.run(BooleanTypeLogic.Or.class, new BitType( false), new BitType(false))).get()); }
@Test public void testXor() { assertFalse(((BitType) ops.run(BooleanTypeLogic.Xor.class, new BitType( true), new BitType(true))).get()); assertTrue(((BitType) ops.run(BooleanTypeLogic.Xor.class, new BitType(true), new BitType(false))).get()); assertTrue(((BitType) ops.run(BooleanTypeLogic.Xor.class, new BitType( false), new BitType(true))).get()); assertFalse(((BitType) ops.run(BooleanTypeLogic.Xor.class, new BitType( false), new BitType(false))).get()); } }
private RandomAccessible<BitType> constantImg(final int numDims) { final long[] dims = new long[numDims]; Arrays.fill(dims, 1); final ArrayImg<BitType, LongArray> bitImg = ArrayImgs.bits(dims); bitImg.setLinkedType(new BitType(bitImg)); bitImg.cursor().next().set(true); return Views.extendBorder(bitImg); }
@Test public void testBitDefaultCellSize() { testDefaultCellSize( new BitType() ); }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void initialize() { createFunc = RAIs.function(ops(), CreateImgFromDimsAndType.class, in(), new BitType()); floodFillComp = (BinaryComputerOp) Computers.binary(ops(), Ops.Morphology.FloodFill.class, RandomAccessibleInterval.class, in(), Localizable.class, structElement); }
@Test public void testObjectsEqual() { assertFalse(((BitType) ops.run(BooleanTypeLogic.ObjectsEqual.class, new BitType(), 2, 1)).get()); assertTrue(((BitType) ops.run(BooleanTypeLogic.ObjectsEqual.class, new BitType(), 2, 2)).get()); assertFalse(((BitType) ops.run(BooleanTypeLogic.ObjectsEqual.class, new BitType(), 2, 3)).get()); }
/** * Tests {@link BitType#setBigInteger(BigInteger)} and ensures that the value * returned is within BitType range. */ @Test public void testSetBigInteger() { final BitType ul = new BitType( false ); assertEquals( ul.get(), false ); final BigInteger bi = new BigInteger( "AAAAAA3141343BBBBBBBBBBB4134", 16 ); ul.setBigInteger( bi ); assertEquals( ul.get(), true ); }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void initialize() { applyThresholdComp = (BinaryComputerOp) Computers.binary(ops(), Ops.Threshold.Apply.class, out() == null ? IterableInterval.class : out(), in(), in().firstElement()); histCreator = (UnaryFunctionOp) Functions.unary(ops(), Ops.Image.Histogram.class, Histogram1d.class, in()); imgCreator = (UnaryFunctionOp) Functions.unary(ops(), Ops.Create.Img.class, Img.class, in(), new BitType()); }
@Test public void testFillHoles() { Img<BitType> result = ops.create().img(imgWithHoles); ops.morphology().fillHoles(result, imgWithHoles, new DiamondShape(1)); Cursor<BitType> resultC = result.cursor(); final BitType one = new BitType(true); while (resultC.hasNext()) { assertEquals(one, resultC.next()); } }