• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ByteType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.imglib2.type.numeric.integer.ByteType的典型用法代码示例。如果您正苦于以下问题:Java ByteType类的具体用法?Java ByteType怎么用?Java ByteType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ByteType类属于net.imglib2.type.numeric.integer包,在下文中一共展示了ByteType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testImgToTensorMapping

import net.imglib2.type.numeric.integer.ByteType; //导入依赖的package包/类
/** Tests the tensor(RAI, int[]) function */
@Test
public void testImgToTensorMapping() {
	assertEquals(1, 1);

	final long[] dims = new long[] { 5, 4, 3, 2 };
	final int[] mapping = new int[] { 1, 3, 0, 2 }; // A strange mapping
	final long[] shape = new long[] { 3, 5, 2, 4 };
	final int n = dims.length;

	// ByteType
	testImg2TensorMappingForType(new ArrayImgFactory<ByteType>().create(dims, new ByteType()), mapping, n, shape,
			DataType.UINT8);

	// DoubleType
	testImg2TensorMappingForType(new ArrayImgFactory<DoubleType>().create(dims, new DoubleType()), mapping, n,
			shape, DataType.DOUBLE);

	// FloatType
	testImg2TensorMappingForType(new ArrayImgFactory<FloatType>().create(dims, new FloatType()), mapping, n, shape,
			DataType.FLOAT);

	// IntType
	testImg2TensorMappingForType(new ArrayImgFactory<IntType>().create(dims, new IntType()), mapping, n, shape,
			DataType.INT32);

	// LongType
	testImg2TensorMappingForType(new ArrayImgFactory<LongType>().create(dims, new LongType()), mapping, n, shape,
			DataType.INT64);
}
 
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:31,代码来源:TensorsTest.java


示例2: testSplitSubspacesEmptySubspaces

import net.imglib2.type.numeric.integer.ByteType; //导入依赖的package包/类
/**
 * Test that subspaces is empty, if we try to split into subspaces that don't
 * exist in the stack
 */
@Test
public void testSplitSubspacesEmptySubspaces() throws Exception {
	// SETUP
	final Img<ByteType> img = ArrayImgs.bytes(2, 2);
	final ImgPlus<ByteType> imgPlus = new ImgPlus<>(img, "", X_AXIS, Y_AXIS);
	final List<AxisType> subspaceTypes = Collections.singletonList(
		Axes.CHANNEL);

	// EXECUTE
	final Stream<Subspace<ByteType>> subspaces = splitSubspaces(imgPlus,
		subspaceTypes);

	// VERIFY
	assertEquals(0, subspaces.count());
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:20,代码来源:HyperstackUtilsTest.java


示例3: testSplitSubspacesNoImgPlusMeta

import net.imglib2.type.numeric.integer.ByteType; //导入依赖的package包/类
/**
 * Test that subspaces is empty, if we ImgPlus has no metadata about axis
 * types
 */
@Test
public void testSplitSubspacesNoImgPlusMeta() throws Exception {
	// SETUP
	final Img<ByteType> img = ArrayImgs.bytes(2, 2, 2);
	final ImgPlus<ByteType> imgPlus = new ImgPlus<>(img, "", BAD_AXIS, BAD_AXIS,
		BAD_AXIS);
	final List<AxisType> subspaceTypes = Arrays.asList(Axes.X, Axes.Y);

	// EXECUTE
	final Stream<Subspace<ByteType>> subspaces = splitSubspaces(imgPlus,
		subspaceTypes);

	// VERIFY
	assertEquals(0, subspaces.count());
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:20,代码来源:HyperstackUtilsTest.java


示例4: testSplitSubspacesIdentical

import net.imglib2.type.numeric.integer.ByteType; //导入依赖的package包/类
/**
 * Test that the subspace stream is identical to the input hyperstack, if
 * subspace dimensions are equal
 */
@Test
public void testSplitSubspacesIdentical() throws Exception {
	// SETUP
	final Img<ByteType> img = ArrayImgs.bytes(2, 3);
	final AxisType[] types = new AxisType[] { Axes.X, Axes.Y };
	final ImgPlus<ByteType> imgPlus = new ImgPlus<>(img, "", types);

	// EXECUTE
	final List<Subspace<ByteType>> subspaces = splitSubspaces(imgPlus, Arrays
		.asList(types)).collect(Collectors.toList());

	// VERIFY
	assertEquals(1, subspaces.size());
	assertEquals(imgPlus, subspaces.get(0).interval);
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:20,代码来源:HyperstackUtilsTest.java


示例5: testSplit3DSubspacesWith2DImgPlus

import net.imglib2.type.numeric.integer.ByteType; //导入依赖的package包/类
@Test
public void testSplit3DSubspacesWith2DImgPlus() throws Exception {
	// SETUP
	final long height = 3;
	final Img<ByteType> img = ArrayImgs.bytes(2, height);
	final ImgPlus<ByteType> imgPlus = new ImgPlus<>(img, "", X_AXIS, Y_AXIS);
	final List<AxisType> subspaceTypes = Arrays.asList(Axes.X, Axes.Z);

	// EXECUTE
	final List<Subspace<ByteType>> subspaces = splitSubspaces(imgPlus,
		subspaceTypes).collect(Collectors.toList());

	// VERIFY
	assertEquals(height, subspaces.size());
	subspaces.forEach(s -> {
		final List<AxisType> resultTypes = s.getAxisTypes().collect(Collectors
			.toList());
		assertEquals(1, resultTypes.size());
		assertEquals(Axes.Y, resultTypes.get(0));
	});
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:22,代码来源:HyperstackUtilsTest.java


示例6: testSplitSubspacesMultipleSubspaceTypes

import net.imglib2.type.numeric.integer.ByteType; //导入依赖的package包/类
/**
 * Test that, for example, if you want a {X, Y, T} subspaces of a {X, Y, Z, T,
 * T} hyperstack, the subspaces contain all the time axes. You should get n
 * {X, Y, T, T} subspaces, where n is the size of the Z-dimension.
 */
@Test
public void testSplitSubspacesMultipleSubspaceTypes() throws Exception {
	// SETUP
	final long depth = 5;
	final Img<ByteType> img = ArrayImgs.bytes(2, 2, depth, 13, 14);
	final ImgPlus<ByteType> imgPlus = new ImgPlus<>(img, "", X_AXIS, Y_AXIS,
		Z_AXIS, T_AXIS, T_AXIS);
	final List<AxisType> subspaceTypes = Arrays.asList(Axes.X, Axes.Y,
		Axes.TIME);

	// EXECUTE
	final Stream<Subspace<ByteType>> subspaces = splitSubspaces(imgPlus,
		subspaceTypes);

	// VERIFY
	assertEquals(depth, subspaces.count());
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:23,代码来源:HyperstackUtilsTest.java


示例7: testGetSpatialUnitInconvertibleUnits

import net.imglib2.type.numeric.integer.ByteType; //导入依赖的package包/类
@Test
public void testGetSpatialUnitInconvertibleUnits() throws Exception {
	final String[][] units = { { "m", "" }, { "cm", "kg" } };
	final Img<ByteType> img = ArrayImgs.bytes(1, 1);
	final ImgPlus<ByteType> imgPlus = new ImgPlus<>(img);

	for (final String[] unit : units) {
		final DefaultLinearAxis xAxis = new DefaultLinearAxis(Axes.X, unit[0]);
		final DefaultLinearAxis yAxis = new DefaultLinearAxis(Axes.Y, unit[1]);
		imgPlus.setAxis(xAxis, 0);
		imgPlus.setAxis(yAxis, 1);

		final Optional<String> result = AxisUtils.getSpatialUnit(imgPlus,
			unitService);

		assertTrue(result.isPresent());
		assertTrue("Unit should be empty", result.get().isEmpty());
	}
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:20,代码来源:AxisUtilsTest.java


示例8: click

import net.imglib2.type.numeric.integer.ByteType; //导入依赖的package包/类
@Override
public void click( final int x, final int y )
{
	if ( filledPixelsOverlay.visible() )
	{
		synchronized ( viewer )
		{
			viewer.setCursor( Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR ) );

			final Point p = new Point( x, y );

			final ArrayImg< ByteType, ByteArray > img = wrapBufferedImage( filledPixelsOverlay.img );

			final ByteType extension = new ByteType( ( byte ) 1 );

			final long t0 = System.currentTimeMillis();
			final ArrayRandomAccess< ByteType > ra = img.randomAccess();
			ra.setPosition( p );
			FloodFill.fill( Views.extendValue( img, extension ), Views.extendValue( img, extension ), p, extension.copy(), extension.copy(), new DiamondShape( 1 ), filter );
			final long t1 = System.currentTimeMillis();
			System.out.println( "Filling took " + ( t1 - t0 ) + " ms" );
			viewer.setCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR ) );
			viewer.getDisplay().repaint();
		}
	}
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:27,代码来源:DrawProjectAndIntersectController.java


示例9: mean

import net.imglib2.type.numeric.integer.ByteType; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:26,代码来源:DefaultCoarsenessFeature.java


示例10: generateKnownSquareIntegralImage

import net.imglib2.type.numeric.integer.ByteType; //导入依赖的package包/类
private Img<ByteType> generateKnownSquareIntegralImage() {
	final long[] dims = new long[] { 3, 3 };
	final byte[] array = new byte[9];

	array[0] = (byte) 16;
	array[1] = (byte) 32;
	array[2] = (byte) 36;

	array[3] = (byte) 32;
	array[4] = (byte) 64;
	array[5] = (byte) 72;

	array[6] = (byte) 36;
	array[7] = (byte) 72;
	array[8] = (byte) 116;

	Img<ByteType> bytes = ArrayImgs.bytes(array, dims);
	return bytes;
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:20,代码来源:SquareIntegralImgTest.java


示例11: testMedianFilter

import net.imglib2.type.numeric.integer.ByteType; //导入依赖的package包/类
/**
 * @see MedianFilterOp
 * @see DefaultMedianFilter
 */
@Test
public void testMedianFilter() {
	ops.run(MedianFilterOp.class, out, in, shape, oobFactory);

	ArrayList<ByteType> items = new ArrayList<>();
	NeighborhoodsIterableInterval<ByteType> neighborhoods =
		shape.neighborhoods(Views.interval(Views.extendMirrorSingle(in), in));
	for (ByteType t : neighborhoods.firstElement()) {
		items.add(t.copy());
	}

	Collections.sort(items);

	assertEquals(items.get(5).get(), out.firstElement().get());
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:20,代码来源:NonLinearFiltersTest.java


示例12: generateKnownByteArrayTestImg

import net.imglib2.type.numeric.integer.ByteType; //导入依赖的package包/类
public ArrayImg<ByteType, ByteArray> generateKnownByteArrayTestImg() {
	final long[] dims = new long[] { 3, 3 };
	final byte[] array = new byte[9];

	array[0] = (byte) 1;
	array[1] = (byte) 2;
	array[2] = (byte) 3;

	array[3] = (byte) 4;
	array[4] = (byte) 5;
	array[5] = (byte) 6;

	array[6] = (byte) 7;
	array[7] = (byte) 8;
	array[8] = (byte) 9;

	return ArrayImgs.bytes(array, dims);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:19,代码来源:IntegralCursorTest.java


示例13: setUpImgs

import net.imglib2.type.numeric.integer.ByteType; //导入依赖的package包/类
@Before
public void setUpImgs() {
	// create an input
	img1 = createConstantImg(new long[] { x, y }, 1.0f);
	img2 = createConstantImg(new long[] { x, y }, 2.0f);
	img3 = createConstantImg(new long[] { x, y }, 3.0f);
	imgzero = createConstantImg(new long[] { x, y }, 0.0f);

	byteimg = new ArrayImgFactory<ByteType>().create(new long[] { 20000,
		20000 }, new ByteType());

	float1 = new float[(int) size];
	float2 = new float[(int) size];
	float3 = new float[(int) size];
	float4 = new float[(int) size];

	for (int i = 0; i < size; i++) {
		float1[i] = 1.0f;
		float2[i] = 2.0f;
		float3[i] = 3.0f;
		float4[i] = 0.0f;

	}

}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:26,代码来源:MathBenchmarkTest.java


示例14: testScaling

import net.imglib2.type.numeric.integer.ByteType; //导入依赖的package包/类
@Test
public void testScaling() {
	Img<ByteType> in = generateByteArrayTestImg(true, new long[] { 10, 10 });
	double[] scaleFactors = new double[] { 2, 2 };
	@SuppressWarnings("unchecked")
	RandomAccessibleInterval<ByteType> out = (RandomAccessibleInterval<ByteType>) ops.run(DefaultScaleView.class, in,
		scaleFactors, new NLinearInterpolatorFactory<ByteType>());

	assertEquals(out.dimension(0), 20);
	assertEquals(out.dimension(1), 20);

	RandomAccess<ByteType> inRA = in.randomAccess();
	RandomAccess<ByteType> outRA = out.randomAccess();
	inRA.setPosition(new long[] { 5, 5 });
	outRA.setPosition(new long[] { 10, 10 });
	assertEquals(inRA.get().get(), outRA.get().get());

}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:19,代码来源:ScaleViewTest.java


示例15: testIIAndIIInplace

import net.imglib2.type.numeric.integer.ByteType; //导入依赖的package包/类
@Test
public void testIIAndIIInplace() {
	final Img<ByteType> first = generateByteArrayTestImg(true, 10, 10);
	final Img<ByteType> firstCopy = first.copy();
	final Img<ByteType> second = generateByteArrayTestImg(false, 10, 10);
	for (final ByteType px : second)
		px.set((byte) 1);
	final Img<ByteType> secondCopy = second.copy();
	final Img<ByteType> secondDiffDims = generateByteArrayTestImg(false, 10, 10,
		2);

	sub = Inplaces.binary(ops, Ops.Math.Subtract.class, ByteType.class);
	final BinaryInplaceOp<? super Img<ByteType>, Img<ByteType>> map = Inplaces
		.binary(ops, MapIIAndIIInplace.class, firstCopy, second, sub);
	map.run(firstCopy, second, firstCopy);
	map.run(first, secondCopy, secondCopy);

	assertImgSubEquals(first, second, firstCopy);
	assertImgSubEquals(first, second, secondCopy);

	// Expect exception when in2 has different dimensions
	thrown.expect(IllegalArgumentException.class);
	ops.op(MapIIAndIIInplace.class, first, secondDiffDims, sub);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:25,代码来源:MapTest.java


示例16: testIIAndIIInplaceParallel

import net.imglib2.type.numeric.integer.ByteType; //导入依赖的package包/类
@Test
public void testIIAndIIInplaceParallel() {
	final Img<ByteType> first = generateByteArrayTestImg(true, 10, 10);
	final Img<ByteType> firstCopy = first.copy();
	final Img<ByteType> second = generateByteArrayTestImg(false, 10, 10);
	for (final ByteType px : second)
		px.set((byte) 1);
	final Img<ByteType> secondCopy = second.copy();
	final Img<ByteType> secondDiffDims = generateByteArrayTestImg(false, 10, 10,
		2);

	sub = Inplaces.binary(ops, Ops.Math.Subtract.class, ByteType.class);
	final BinaryInplaceOp<? super Img<ByteType>, Img<ByteType>> map = Inplaces
		.binary(ops, MapIIAndIIInplaceParallel.class, firstCopy, second, sub);
	map.run(firstCopy, second, firstCopy);
	map.run(first, secondCopy, secondCopy);

	assertImgSubEquals(first, second, firstCopy);
	assertImgSubEquals(first, second, secondCopy);

	// Expect exception when in2 has different dimensions
	thrown.expect(IllegalArgumentException.class);
	ops.op(MapIIAndIIInplaceParallel.class, first, secondDiffDims, sub);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:25,代码来源:MapTest.java


示例17: testListDilate

import net.imglib2.type.numeric.integer.ByteType; //导入依赖的package包/类
@Test
public void testListDilate() {
	final List<Shape> shapes = new ArrayList<>();
	shapes.add(new DiamondShape(1));
	shapes.add(new DiamondShape(1));
	shapes.add(new RectangleShape(1, false));
	shapes.add(new HorizontalLineShape(2, 1, false));
	@SuppressWarnings("unchecked")
	final IterableInterval<ByteType> out1 = (IterableInterval<ByteType>) ops
		.run(ListDilate.class, IterableInterval.class, in, shapes, false);
	final Img<ByteType> out2 = Dilation.dilate(in, shapes, 1);
	final Cursor<ByteType> c1 = out1.cursor();
	final Cursor<ByteType> c2 = out2.cursor();
	while (c1.hasNext())
		assertEquals(c1.next().get(), c2.next().get());
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:17,代码来源:DilationTest.java


示例18: testIIAndIIInplaceParallelCellImg

import net.imglib2.type.numeric.integer.ByteType; //导入依赖的package包/类
@Test
public void testIIAndIIInplaceParallelCellImg() {
	final Img<ByteType> first = generateByteTestCellImg(true, 40, 20);
	final Img<ByteType> firstCopy = first.copy();
	final Img<ByteType> second = generateByteTestCellImg(false, 40, 20);
	for (final ByteType px : second)
		px.set((byte) 1);
	final Img<ByteType> secondCopy = second.copy();

	sub = Inplaces.binary(ops, Ops.Math.Subtract.class, ByteType.class);
	final BinaryInplaceOp<? super Img<ByteType>, Img<ByteType>> map = Inplaces
		.binary(ops, MapIIAndIIInplaceParallel.class, firstCopy, second, sub);
	map.run(firstCopy, second, firstCopy);
	map.run(first, secondCopy, secondCopy);

	assertImgSubEquals(first, second, firstCopy);
	assertImgSubEquals(first, second, secondCopy);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:19,代码来源:MapTest.java


示例19: testBigImage

import net.imglib2.type.numeric.integer.ByteType; //导入依赖的package包/类
@Test
public void testBigImage() {
	final byte[] data = { 7, 8, 9, 1, 2, 3, 7, 9, 8, 1, 3, 2, 8, 7, 9, 2, 1, 3, 8, 9, 7, 2, 3, 1, 9, 7, 8, 3, 1, 2,
			9, 8, 7, 3, 2, 1 };
	final Img<ByteType> in = ArrayImgs.bytes(data, 6, 6);
	final Img<ByteType> out = generateByteArrayTestImg(false, 6, 6);

	ops.run(DefaultBilateral.class, out, in, 15, 5, 2);

	final byte[] expected = { 8, 7, 6, 4, 3, 2, 8, 7, 6, 4, 3, 2, 8, 7, 6, 4, 3, 2, 8, 7, 6, 4, 3, 2, 8, 7, 6, 4, 3,
			2, 8, 7, 6, 4, 3, 2 };

	Cursor<ByteType> cout = out.cursor();
	for (int i = 0; i < expected.length; i++) {
		assertEquals(cout.next().get(), expected[i]);
	}
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:18,代码来源:DefaultBilateralTest.java


示例20: init

import net.imglib2.type.numeric.integer.ByteType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@BeforeClass
public static void init() {
	in1II = ArrayImgs.bytes(2, 2);
	in2II = ArrayImgs.bytes(2, 2);
	outII = ArrayImgs.bytes(2, 2);
	in1LargeII = ArrayImgs.bytes(3, 3);
	in2LargeII = ArrayImgs.bytes(3, 3);
	outLargeII = ArrayImgs.bytes(3, 3);
	in1RAI = (RandomAccessibleInterval<ByteType>) in1II;
	in2RAI = (RandomAccessibleInterval<ByteType>) in2II;
	outRAI = (RandomAccessibleInterval<ByteType>) outII;
	in1LargeRAI = (RandomAccessibleInterval<ByteType>) in1LargeII;
	in2LargeRAI = (RandomAccessibleInterval<ByteType>) in2LargeII;
	outLargeRAI = (RandomAccessibleInterval<ByteType>) outLargeII;
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:17,代码来源:MapCompatibleTest.java



注:本文中的net.imglib2.type.numeric.integer.ByteType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SATFactory类代码示例发布时间:2022-05-22
下一篇:
Java UmengMessageHandler类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap