Search in sources :

Example 1 with OutOfBoundsMirrorFactory

use of net.imglib2.outofbounds.OutOfBoundsMirrorFactory in project imagej-ops by imagej.

the class DefaultCoarsenessFeature method mean.

/**
 * Apply mean filter with given size of reactangle shape
 *
 * @param input
 *            Input image
 * @param i
 *            Size of rectangle shape
 * @return Filered mean image
 */
@SuppressWarnings("unchecked")
private Img<I> mean(final RandomAccessibleInterval<I> input, final int i) {
    long[] dims = new long[input.numDimensions()];
    input.dimensions(dims);
    final byte[] array = new byte[(int) Intervals.numElements(new FinalInterval(dims))];
    Img<I> meanImg = (Img<I>) ArrayImgs.unsignedBytes(array, dims);
    OutOfBoundsMirrorFactory<ByteType, Img<ByteType>> oobFactory = new OutOfBoundsMirrorFactory<>(Boundary.SINGLE);
    ops().run(MeanFilterOp.class, meanImg, input, new RectangleShape(i, true), oobFactory);
    return meanImg;
}
Also used : Img(net.imglib2.img.Img) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) FinalInterval(net.imglib2.FinalInterval) ByteType(net.imglib2.type.numeric.integer.ByteType) OutOfBoundsMirrorFactory(net.imglib2.outofbounds.OutOfBoundsMirrorFactory)

Example 2 with OutOfBoundsMirrorFactory

use of net.imglib2.outofbounds.OutOfBoundsMirrorFactory in project imagej-ops by imagej.

the class LocalThresholdTest method testLocalShanbhagThreshold.

/**
 * @see LocalShanbhagThreshold
 */
@Test
public void testLocalShanbhagThreshold() {
    ops.run(Shanbhag.class, out, in, new RectangleShape(1, false), new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(Boundary.SINGLE));
    assertEquals(false, out.firstElement().get());
}
Also used : Img(net.imglib2.img.Img) ArrayImg(net.imglib2.img.array.ArrayImg) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) ByteType(net.imglib2.type.numeric.integer.ByteType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 3 with OutOfBoundsMirrorFactory

use of net.imglib2.outofbounds.OutOfBoundsMirrorFactory in project imagej-ops by imagej.

the class LocalThresholdTest method testLocalNiblackThresholdIntegral.

/**
 * @see LocalNiblackThresholdIntegral
 */
@Test
public void testLocalNiblackThresholdIntegral() {
    ops.run(LocalNiblackThresholdIntegral.class, out, in, new RectangleShape(3, false), new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(Boundary.SINGLE), 0.2, 0.0);
    assertEquals(true, out.firstElement().get());
}
Also used : Img(net.imglib2.img.Img) ArrayImg(net.imglib2.img.array.ArrayImg) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) ByteType(net.imglib2.type.numeric.integer.ByteType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 4 with OutOfBoundsMirrorFactory

use of net.imglib2.outofbounds.OutOfBoundsMirrorFactory in project imagej-ops by imagej.

the class LocalThresholdTest method testLocalNiblackThreshold.

/**
 * @see LocalNiblackThreshold
 */
@Test
public void testLocalNiblackThreshold() {
    ops.run(LocalNiblackThreshold.class, out, in, new RectangleShape(1, false), new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(Boundary.SINGLE), 0.2, 0.0);
    assertEquals(true, out.firstElement().get());
}
Also used : Img(net.imglib2.img.Img) ArrayImg(net.imglib2.img.array.ArrayImg) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) ByteType(net.imglib2.type.numeric.integer.ByteType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 5 with OutOfBoundsMirrorFactory

use of net.imglib2.outofbounds.OutOfBoundsMirrorFactory in project imagej-ops by imagej.

the class LocalThresholdTest method testLocalLiThreshold.

/**
 * @see LocalLiThreshold
 */
@Test
public void testLocalLiThreshold() {
    ops.run(Li.class, out, in, new RectangleShape(1, false), new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(Boundary.SINGLE));
    assertEquals(true, out.firstElement().get());
}
Also used : Img(net.imglib2.img.Img) ArrayImg(net.imglib2.img.array.ArrayImg) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) ByteType(net.imglib2.type.numeric.integer.ByteType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Aggregations

RectangleShape (net.imglib2.algorithm.neighborhood.RectangleShape)35 ByteType (net.imglib2.type.numeric.integer.ByteType)35 AbstractOpTest (net.imagej.ops.AbstractOpTest)34 Img (net.imglib2.img.Img)34 Test (org.junit.Test)34 ArrayImg (net.imglib2.img.array.ArrayImg)33 IncompatibleTypeException (net.imglib2.exception.IncompatibleTypeException)4 BitType (net.imglib2.type.logic.BitType)4 RandomAccessibleInterval (net.imglib2.RandomAccessibleInterval)2 OutOfBoundsMirrorFactory (net.imglib2.outofbounds.OutOfBoundsMirrorFactory)2 EigenvalueDecomposition (Jama.EigenvalueDecomposition)1 Matrix (Jama.Matrix)1 ArrayList (java.util.ArrayList)1 FinalInterval (net.imglib2.FinalInterval)1 DiamondShape (net.imglib2.algorithm.neighborhood.DiamondShape)1