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


Java RealViews.affine方法代码示例

本文整理汇总了Java中net.imglib2.realtransform.RealViews.affine方法的典型用法代码示例。如果您正苦于以下问题:Java RealViews.affine方法的具体用法?Java RealViews.affine怎么用?Java RealViews.affine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.imglib2.realtransform.RealViews的用法示例。


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

示例1: fillMask

import net.imglib2.realtransform.RealViews; //导入方法依赖的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

示例2: writeMask

import net.imglib2.realtransform.RealViews; //导入方法依赖的package包/类
private void writeMask( final GrowingStoreRandomAccessibleSingletonAccess< BitType > tmpFill, final AffineTransform3D tf, final long label )
{
	final IntervalView< BitType > tmpFillInterval = Views.interval( tmpFill, tmpFill.getIntervalOfSizeOfStore() );

	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 net.imglib2.Cursor< BitType > s = tmpFillInterval.cursor();
	final net.imglib2.Cursor< LongType > t = Views.interval( hyperSlice, tmpFillInterval ).cursor();
	while ( s.hasNext() )
	{
		t.fwd();
		if ( s.next().get() )
			t.get().set( label );
	}

	dirtyLabelsInterval.touch( accessTrackingExtendedPaintedLabels.createAccessInterval() );
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:28,代码来源:LabelFillController.java

示例3: getTransformedSource

import net.imglib2.realtransform.RealViews; //导入方法依赖的package包/类
protected static < T, A extends AffineGet & Concatenable< AffineGet > > RandomAccessible< T > getTransformedSource( final AffineTransformType< A > transformType, final RenderSource< T, A > source, final A viewerTransform, final A screenScaleTransform ) {
    final RealRandomAccessible< T > img = source.getInterpolatedSource();

    final A sourceToScreen = transformType.createTransform();
    transformType.set( sourceToScreen, screenScaleTransform );
    sourceToScreen.concatenate( viewerTransform );
    sourceToScreen.concatenate( source.getSourceTransform() );

    return RealViews.affine( img, sourceToScreen );
}
 
开发者ID:fjug,项目名称:IDDEA,代码行数:11,代码来源:InjectableMultiResolutionRenderer.java

示例4: getCurrentCorrelation

import net.imglib2.realtransform.RealViews; //导入方法依赖的package包/类
public double getCurrentCorrelation(final RandomAccessibleInterval< T > image)
{
	final RealRandomAccessible< T > interpolated = Views.interpolate( Views.extendBorder( image ), new NLinearInterpolatorFactory< T >() );
	final RandomAccessible< T > warped = RealViews.affine( interpolated, currentTransform );
	return PhaseCorrelation2Util.getCorrelation( Views.interval( warped, template ), template );
}
 
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:7,代码来源:Align.java

示例5: computeDifference

import net.imglib2.realtransform.RealViews; //导入方法依赖的package包/类
/**
 * Compute the pixel-wise difference between an affine-transformed source
 * image and a target image.
 *
 * @param source
 *            The source image.
 * @param transform
 *            A coordinate transformation to apply to the source image.
 * @param target
 *            The target image.
 * @param difference
 *            Output image. The pixel-wise difference between the
 *            transformed source image and the target image is stored here.
 *            
 * @param <T> pixel type source
 * @param <S> pixel type target
 */
public static < T extends RealType< T >,  S extends RealType< S > > void computeDifference(
		final RandomAccessible< T > source,
		final AffineTransform transform,
		final RandomAccessible< T > target,
		final RandomAccessibleInterval< S > difference,
		final ExecutorService service,
		final int nTasks)
{
	final RealRandomAccessible< T > interpolated = Views.interpolate( source, new NLinearInterpolatorFactory< T >() );
	final RandomAccessible< T > warped = RealViews.affine( interpolated, transform );

	final long stepSize = Views.iterable( difference ).size() / nTasks;

	final List<Callable< Void >> tasks = new ArrayList<>();
	final AtomicInteger ai = new AtomicInteger( 0 );
	for (int iO = 0; iO<nTasks; iO++)
	{
		tasks.add( new Callable< Void >()
		{
			@Override
			public Void call() throws Exception
			{
				final int i = ai.getAndIncrement();
				final Cursor< T > cw = Views.flatIterable( Views.interval( warped, difference ) ).cursor();
				final Cursor< T > ct = Views.flatIterable( Views.interval( target, difference ) ).cursor();
				final Cursor< S > cd = Views.flatIterable( difference ).cursor();

				cw.jumpFwd( stepSize * i );
				ct.jumpFwd( stepSize * i );
				cd.jumpFwd( stepSize * i );

				final long end = i == nTasks - 1 ? Views.iterable( difference ).size() - stepSize * i : stepSize;
				int count = 0;
				while (count++ < end)
				{
					cd.next().setReal( ( cw.next().getRealDouble() - ct.next().getRealDouble() ));
				}
				return null;
			}
		} );
	}

	try
	{
		List< Future< Void > > futures = service.invokeAll( tasks );
		for (Future< Void > f: futures)
			f.get();
	}
	catch ( InterruptedException | ExecutionException e )
	{
		e.printStackTrace();
	}
}
 
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:71,代码来源:Align.java

示例6: testPCRealShift

import net.imglib2.realtransform.RealViews; //导入方法依赖的package包/类
@Test
public void testPCRealShift() {
	
	// TODO: very large shifts (nearly no overlap) lead to incorrect shift determination (as expected)
	// maybe we can optimize behaviour in this situation
	Img< FloatType > img = ArrayImgs.floats( 200, 200 );
	Random rnd = new Random( System.currentTimeMillis() );
	
	for( FloatType t : img )
		t.set( rnd.nextFloat());
	
	double shiftX = -20.9;
	double shiftY = 1.9;
	
	// to test < 0.5 px off
	final double eps = 0.5;
	
	FinalInterval interval2 = new FinalInterval(new long[] {50, 50});
	
	

	AffineRandomAccessible< FloatType, AffineGet > imgTr = RealViews.affine( Views.interpolate( Views.extendZero( img ), new NLinearInterpolatorFactory<>() ), new Translation2D( shiftX, shiftY ));
	IntervalView< FloatType > img2 = Views.interval( Views.raster( imgTr ), interval2);
	
	int [] extension = new int[img.numDimensions()];
	Arrays.fill(extension, 10);
	
	RandomAccessibleInterval<FloatType> pcm = PhaseCorrelation2.calculatePCM(Views.zeroMin(img2), Views.zeroMin(Views.interval(img, interval2)), extension, new ArrayImgFactory<FloatType>(), 
			new FloatType(), new ArrayImgFactory<ComplexFloatType>(), new ComplexFloatType(), Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()));
	
	PhaseCorrelationPeak2 shiftPeak = PhaseCorrelation2.getShift(pcm, Views.zeroMin(img2), Views.zeroMin(Views.interval(img, interval2)), 20, 0, true, Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()));
	
	
	double[] expected = new double[]{shiftX, shiftY};
	double[] found = new double[img.numDimensions()];
	
	
	
	
	shiftPeak.getSubpixelShift().localize(found);
	
	System.out.println( Util.printCoordinates( found ) );
	
	
	for (int d = 0; d < expected.length; d++)
		assertTrue( Math.abs( expected[d] - found[d] ) < eps );
	
}
 
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:49,代码来源:PhaseCorrelationTest.java


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