当前位置: 首页>>代码示例>>Java>>正文


Java DiamondShape类代码示例

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


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

示例1: click

import net.imglib2.algorithm.neighborhood.DiamondShape; //导入依赖的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

示例2: testListDilate

import net.imglib2.algorithm.neighborhood.DiamondShape; //导入依赖的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

示例3: testListDilateFull

import net.imglib2.algorithm.neighborhood.DiamondShape; //导入依赖的package包/类
@Test
public void testListDilateFull() {
	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, true);
	final Img<ByteType> out2 = Dilation.dilateFull(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

示例4: testFillHoles1

import net.imglib2.algorithm.neighborhood.DiamondShape; //导入依赖的package包/类
@Test
public void testFillHoles1() {
	Img<BitType> result = ops.create().img(invertedImgWithFilledHoles);
	Img<BitType> inverted = ops.create().img(invertedImgWithFilledHoles);
	ops.image().invert(inverted, imgWithHoles);
	ops.morphology().fillHoles(result, inverted, new DiamondShape(1));

	Cursor<BitType> resultC = result.localizingCursor();
	RandomAccess<BitType> groundTruthRA = invertedImgWithFilledHoles.randomAccess();

	while (resultC.hasNext()) {
		boolean r = resultC.next().get();
		groundTruthRA.setPosition(resultC);
		assertEquals(groundTruthRA.get().get(), r);
	}
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:17,代码来源:MorphologyOpsTest.java

示例5: fillMask

import net.imglib2.algorithm.neighborhood.DiamondShape; //导入依赖的package包/类
private < T extends BooleanType< T > > GrowingStoreRandomAccessibleSingletonAccess< T > fillMask( final AffineTransform3D tf, final long[] initialMin, final long[] initialMax, final Point p, final GrowingStoreRandomAccessibleSingletonAccess.Factory< T > factory, final T notVisited, final T fillLabel )
{
	final GrowingStoreRandomAccessibleSingletonAccess< T > tmpFill = new GrowingStoreRandomAccessibleSingletonAccess<>( initialMin, initialMax, factory, notVisited.createVariable() );

	final AccessBoxRandomAccessible< LongType > accessTrackingExtendedPaintedLabels = new AccessBoxRandomAccessible<>(
			Views.extendValue(
					paintedLabels,
					new LongType( Label.TRANSPARENT ) ) );

	final AffineRandomAccessible< LongType, AffineGet > transformedPaintedLabels =
			RealViews.affine(
					Views.interpolate(
							accessTrackingExtendedPaintedLabels,
							new NearestNeighborInterpolatorFactory<>() ),
					tf );
	final MixedTransformView< LongType > hyperSlice = Views.hyperSlice( Views.raster( transformedPaintedLabels ), 2, 0 );

	final AffineRandomAccessible< LabelMultisetType, AffineGet > transformedLabels = RealViews.affine( Views.interpolate( Views.extendValue( labels, new LabelMultisetType() ), new NearestNeighborInterpolatorFactory<>() ), tf );
	final MixedTransformView< LabelMultisetType > hyperSliceLabels = Views.hyperSlice( Views.raster( transformedLabels ), 2, 0 );

	final RandomAccessiblePair< LabelMultisetType, LongType > labelsPaintedLabelsPair = new RandomAccessiblePair<>( hyperSliceLabels, hyperSlice );

	final RandomAccessiblePair< LabelMultisetType, LongType >.RandomAccess pairAccess = labelsPaintedLabelsPair.randomAccess();
	pairAccess.setPosition( p );
	final long seedPaint = pairAccess.get().getB().getIntegerLong();
	final long seedFragmentLabel = getBiggestLabel( pairAccess.getA() );

	FloodFill.fill( labelsPaintedLabelsPair, tmpFill, p, new ValuePair< LabelMultisetType, LongType >( new LabelMultisetType(), new LongType( selectionController.getActiveFragmentId() ) ), fillLabel, new DiamondShape( 1 ), new SegmentAndPaintFilter2D< T >( seedPaint, seedFragmentLabel, assignment ), new TypeWriter<>() );

	dirtyLabelsInterval.touch( accessTrackingExtendedPaintedLabels.createAccessInterval() );

	return tmpFill;
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:34,代码来源:LabelFillController.java

示例6: testSingleTopHat

import net.imglib2.algorithm.neighborhood.DiamondShape; //导入依赖的package包/类
@Test
public void testSingleTopHat() {
	final Shape shape = new DiamondShape(1);
	final List<Shape> shapes = Arrays.asList(shape);
	@SuppressWarnings("unchecked")
	final Img<ByteType> out1 = (Img<ByteType>) ops.run(ListTopHat.class,
		Img.class, in, shapes);
	final Img<ByteType> out2 = TopHat.topHat(in, shape, 1);
	assertIterationsEqual(out2, out1);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:11,代码来源:TopHatTest.java

示例7: testListTopHat

import net.imglib2.algorithm.neighborhood.DiamondShape; //导入依赖的package包/类
@Test
public void testListTopHat() {
	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(ListTopHat.class, IterableInterval.class, in, shapes);
	final Img<ByteType> out2 = TopHat.topHat(in, shapes, 1);
	assertIterationsEqual(out2, out1);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:14,代码来源:TopHatTest.java

示例8: testSingleClose

import net.imglib2.algorithm.neighborhood.DiamondShape; //导入依赖的package包/类
@Test
public void testSingleClose() {
	final Shape shape = new DiamondShape(1);
	final List<Shape> shapes = Arrays.asList(shape);
	@SuppressWarnings("unchecked")
	final Img<ByteType> out1 = (Img<ByteType>) ops.run(ListClose.class,
		Img.class, in, shapes);
	final Img<ByteType> out2 = Closing.close(in, shape, 1);
	assertIterationsEqual(out2, out1);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:11,代码来源:ClosingTest.java

示例9: testListClose

import net.imglib2.algorithm.neighborhood.DiamondShape; //导入依赖的package包/类
@Test
public void testListClose() {
	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(ListClose.class, IterableInterval.class, in, shapes);
	final Img<ByteType> out2 = Closing.close(in, shapes, 1);
	assertIterationsEqual(out2, out1);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:14,代码来源:ClosingTest.java

示例10: testSingleBlackTopHat

import net.imglib2.algorithm.neighborhood.DiamondShape; //导入依赖的package包/类
@Test
public void testSingleBlackTopHat() {
	final Shape shape = new DiamondShape(1);
	final List<Shape> shapes = Arrays.asList(shape);
	@SuppressWarnings("unchecked")
	final Img<ByteType> out1 = (Img<ByteType>) ops.run(ListBlackTopHat.class,
		Img.class, in, shapes);
	final Img<ByteType> out2 = BlackTopHat.blackTopHat(in, shape, 1);
	assertIterationsEqual(out2, out1);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:11,代码来源:BlackTopHatTest.java

示例11: testListBlackTopHat

import net.imglib2.algorithm.neighborhood.DiamondShape; //导入依赖的package包/类
@Test
public void testListBlackTopHat() {
	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(ListBlackTopHat.class, IterableInterval.class, in, shapes);
	final Img<ByteType> out2 = BlackTopHat.blackTopHat(in, shapes, 1);
	assertIterationsEqual(out2, out1);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:14,代码来源:BlackTopHatTest.java

示例12: testSingleErode

import net.imglib2.algorithm.neighborhood.DiamondShape; //导入依赖的package包/类
@Test
public void testSingleErode() {
	final Shape shape = new DiamondShape(1);
	@SuppressWarnings("unchecked")
	final Img<ByteType> out1 = (Img<ByteType>) ops.run(DefaultErode.class,
		Img.class, in, shape, false);
	final Img<ByteType> out2 = Erosion.erode(in, shape, 1);
	assertIterationsEqual(out1, out2);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:10,代码来源:ErosionTest.java

示例13: testSingleErodeBitType

import net.imglib2.algorithm.neighborhood.DiamondShape; //导入依赖的package包/类
@Test
public void testSingleErodeBitType() {
	final Shape shape = new DiamondShape(1);
	@SuppressWarnings("unchecked")
	final Img<BitType> out1 = (Img<BitType>) ops.run(DefaultErode.class,
		Img.class, bitIn, shape, false);
	final Img<BitType> out2 = Erosion.erode(bitIn, shape, 1);
	final Cursor<BitType> c1 = out1.cursor();
	final Cursor<BitType> c2 = out2.cursor();
	while (c1.hasNext())
		assertEquals(c1.next().get(), c2.next().get());
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:13,代码来源:ErosionTest.java

示例14: testSingleErodeFull

import net.imglib2.algorithm.neighborhood.DiamondShape; //导入依赖的package包/类
@Test
public void testSingleErodeFull() {
	final Shape shape = new DiamondShape(1);
	@SuppressWarnings("unchecked")
	final Img<ByteType> out1 = (Img<ByteType>) ops.run(DefaultErode.class,
		Img.class, in, shape, true);
	final Img<ByteType> out2 = Erosion.erodeFull(in, shape, 1);
	assertIterationsEqual(out1, out2);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:10,代码来源:ErosionTest.java

示例15: testListErode

import net.imglib2.algorithm.neighborhood.DiamondShape; //导入依赖的package包/类
public void testListErode() {
	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));
	final Img<ByteType> out2 = in.copy();
	Erosion.erode(Views.extendValue(in, new ByteType((byte) -128)), out2,
		shapes, 1);
	@SuppressWarnings("unchecked")
	final IterableInterval<ByteType> out1 = (IterableInterval<ByteType>) ops
		.run(ListErode.class, IterableInterval.class, in, shapes, false);
	assertIterationsEqual(out1, out2);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:15,代码来源:ErosionTest.java


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