use of net.imglib2.type.numeric.integer.ByteType 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());
}
use of net.imglib2.type.numeric.integer.ByteType in project imagej-ops by imagej.
the class CreateImgTest method testImageType.
@Test
public void testImageType() {
final Dimensions dim = new FinalDimensions(10, 10, 10);
assertEquals("Image Type: ", BitType.class, ((Img<?>) ops.run(CreateImgFromDimsAndType.class, dim, new BitType())).firstElement().getClass());
assertEquals("Image Type: ", ByteType.class, ((Img<?>) ops.run(CreateImgFromDimsAndType.class, dim, new ByteType())).firstElement().getClass());
assertEquals("Image Type: ", UnsignedByteType.class, ((Img<?>) ops.create().img(dim, new UnsignedByteType())).firstElement().getClass());
assertEquals("Image Type: ", IntType.class, ((Img<?>) ops.run(CreateImgFromDimsAndType.class, dim, new IntType())).firstElement().getClass());
assertEquals("Image Type: ", FloatType.class, ((Img<?>) ops.run(CreateImgFromDimsAndType.class, dim, new FloatType())).firstElement().getClass());
assertEquals("Image Type: ", DoubleType.class, ((Img<?>) ops.run(CreateImgFromDimsAndType.class, dim, new DoubleType())).firstElement().getClass());
}
use of net.imglib2.type.numeric.integer.ByteType in project imagej-ops by imagej.
the class CreateImgTest method testImgFromImg.
@Test
public void testImgFromImg() {
// create img
final Img<ByteType> img = ops.create().img(new FinalDimensions(1), new ByteType());
@SuppressWarnings("unchecked") final Img<ByteType> newImg = (Img<ByteType>) ops.run(CreateImgFromImg.class, img);
// should both be ByteType. New Img shouldn't be DoubleType (default)
assertEquals(img.firstElement().getClass(), newImg.firstElement().getClass());
}
Aggregations