Search in sources :

Example 1 with ShortType

use of net.imglib2.type.numeric.integer.ShortType in project imagej-ops by imagej.

the class InvertTest method testShortTypeInvert.

@Test
public void testShortTypeInvert() {
    final Img<ShortType> inShortType = generateShortArrayTestImg(true, 5, 5);
    final Img<ShortType> outShortType = inShortType.factory().create(inShortType, new ShortType());
    assertDefaultInvert(inShortType, outShortType);
    assertDefaultInvertMinMaxProvided(inShortType, outShortType, new ShortType((Short.MIN_VALUE)), new ShortType((short) (Short.MIN_VALUE + 1)));
    assertDefaultInvertMinMaxProvided(inShortType, outShortType, new ShortType((Short.MAX_VALUE)), new ShortType((short) (Short.MAX_VALUE - 1)));
    assertDefaultInvertMinMaxProvided(inShortType, outShortType, new ShortType((Short.MAX_VALUE)), new ShortType((Short.MAX_VALUE)));
}
Also used : ShortType(net.imglib2.type.numeric.integer.ShortType) UnsignedShortType(net.imglib2.type.numeric.integer.UnsignedShortType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 2 with ShortType

use of net.imglib2.type.numeric.integer.ShortType in project imagej-ops by imagej.

the class ConvertIIsTest method createImages.

@Before
public void createImages() {
    final FinalDimensions dims = FinalDimensions.wrap(new long[] { 10, 10 });
    in = ops.create().img(dims, new ShortType());
    addNoise(in);
    out = ops.create().img(dims, new ByteType());
}
Also used : FinalDimensions(net.imglib2.FinalDimensions) ShortType(net.imglib2.type.numeric.integer.ShortType) ByteType(net.imglib2.type.numeric.integer.ByteType) Before(org.junit.Before)

Example 3 with ShortType

use of net.imglib2.type.numeric.integer.ShortType in project imagej-ops by imagej.

the class CreateImgTest method testCreateFromRaiDifferentType.

@Test
public void testCreateFromRaiDifferentType() {
    final IntervalView<ByteType> input = Views.interval(PlanarImgs.bytes(10, 10, 10), new FinalInterval(new long[] { 10, 10, 1 }));
    final Img<?> res = (Img<?>) ops.run(CreateImgFromDimsAndType.class, input, new ShortType());
    assertEquals("Image Type: ", ShortType.class, res.firstElement().getClass());
    assertArrayEquals("Image Dimensions: ", Intervals.dimensionsAsLongArray(input), Intervals.dimensionsAsLongArray(res));
    assertEquals("Image Factory: ", ArrayImgFactory.class, res.factory().getClass());
}
Also used : CreateImgFromImg(net.imagej.ops.create.img.CreateImgFromImg) Img(net.imglib2.img.Img) CreateImgFromDimsAndType(net.imagej.ops.create.img.CreateImgFromDimsAndType) ShortType(net.imglib2.type.numeric.integer.ShortType) FinalInterval(net.imglib2.FinalInterval) UnsignedByteType(net.imglib2.type.numeric.integer.UnsignedByteType) ByteType(net.imglib2.type.numeric.integer.ByteType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Aggregations

ShortType (net.imglib2.type.numeric.integer.ShortType)3 AbstractOpTest (net.imagej.ops.AbstractOpTest)2 ByteType (net.imglib2.type.numeric.integer.ByteType)2 Test (org.junit.Test)2 CreateImgFromDimsAndType (net.imagej.ops.create.img.CreateImgFromDimsAndType)1 CreateImgFromImg (net.imagej.ops.create.img.CreateImgFromImg)1 FinalDimensions (net.imglib2.FinalDimensions)1 FinalInterval (net.imglib2.FinalInterval)1 Img (net.imglib2.img.Img)1 UnsignedByteType (net.imglib2.type.numeric.integer.UnsignedByteType)1 UnsignedShortType (net.imglib2.type.numeric.integer.UnsignedShortType)1 Before (org.junit.Before)1