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


Java Views.interval方法代码示例

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


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

示例1: testCube

import net.imglib2.view.Views; //导入方法依赖的package包/类
/**
 * Tests the op on a cube. All vectors should enter and exit it, i.e. their
 * length should be 0.5.
 */
@Test
public void testCube() {
	final Img<BitType> cube = ArrayImgs.bits(100, 100, 100);
	final IntervalView<BitType> foreground = Views.interval(cube, new long[] {
		1, 1, 1 }, new long[] { 98, 98, 98 });
	foreground.cursor().forEachRemaining(BitType::setOne);
	final double expectedLength = 1.0 / 2.0;

	@SuppressWarnings("unchecked")
	final List<Vector3d> milVectors =
		(List<Vector3d>) ((ArrayList<Object>) IMAGE_J.op().run(MILGrid.class,
			cube, IDENTITY_ROTATION, 10L, DEFAULT_INCREMENT, new Random(0xc0ff33)))
				.get(0);

	assertEquals("Regression test failed: some vectors have unexpected length",
		milVectors.size(), milVectors.stream().filter(v -> v
			.length() == expectedLength).count());
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:23,代码来源:MILGridTest.java

示例2: testXZSheets

import net.imglib2.view.Views; //导入方法依赖的package包/类
@Test
public void testXZSheets() {
	// SETUP
	final Img<BitType> sheets = ArrayImgs.bits(100, 100, 100);
	// Draw 19 XZ sheets
	final long numSheets = 19;
	for (long y = 5; y < 100; y += 5) {
		final IntervalView<BitType> sheet = Views.interval(sheets, new long[] { 0,
			y, 0 }, new long[] { 99, y, 99 });
		sheet.cursor().forEachRemaining(BitType::setOne);
	}

	// EXECUTE
	@SuppressWarnings("unchecked")
	final List<Vector3d> milVectors =
		(List<Vector3d>) ((ArrayList<Object>) IMAGE_J.op().run(MILGrid.class,
			sheets, IDENTITY_ROTATION, DEFAULT_BINS, DEFAULT_INCREMENT, new Random(
				0xc0ff33))).get(0);

	// VERIFY
	final Stream<Vector3d> yVectors = milVectors.stream().filter(v -> isParallel
		.test(v, new Vector3d(0, 1, 0)));
	assertTrue("MIL vectors in the Y-direction have unexpected length", yVectors
		.allMatch(v -> v.length() == 1.0 / (2 * numSheets)));
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:26,代码来源:MILGridTest.java

示例3: intersect

import net.imglib2.view.Views; //导入方法依赖的package包/类
public static < T, U, V > void intersect(
			final RandomAccessibleInterval< T > source1,
			final RandomAccessibleInterval< U > source2,
			final RandomAccessibleInterval< V > target,
//			Filter< T, U > filter, // can be handled in writer? only writer: requires write for every pixel but simpler interface
			final Converter< Pair< T, U >, V > writer )
	{
		final RandomAccessiblePair< T, U > sourcesPair = new RandomAccessiblePair< >( source1, source2 );
		final RandomAccessiblePair< Pair< T, U >, V > sourcesTargetPair = new RandomAccessiblePair< >( sourcesPair, target );

		for ( final Pair< Pair< T, U >, V > entry : Views.interval( sourcesTargetPair, target ) )
		{
			final Pair< T, U > sources = entry.getA();
			writer.convert( sources, entry.getB() );
		}
	}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:17,代码来源:LabelRestrictToSegmentController.java

示例4: getVisibleIds

import net.imglib2.view.Views; //导入方法依赖的package包/类
@Override
public synchronized TLongHashSet getVisibleIds()
{
	final TLongHashSet visibleIds = new TLongHashSet();
	final int w = viewer.getWidth();
	final int h = viewer.getHeight();
	final AffineTransform3D viewerTransform = new AffineTransform3D();
	viewer.getState().getViewerTransform( viewerTransform );
	IntervalView< LabelMultisetType > screenLabels =
			Views.interval(
					Views.hyperSlice(
							RealViews.affine( labels, viewerTransform ), 2, 0 ),
					new FinalInterval( w, h ) );

	for ( final LabelMultisetType pixel : Views.iterable( screenLabels ) )
	{
		for ( final Entry< Label > entry : pixel.entrySet() )
				visibleIds.add( entry.getElement().id() );
	}

	return visibleIds;
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:23,代码来源:LabelMultiSetIdPicker.java

示例5: compute

import net.imglib2.view.Views; //导入方法依赖的package包/类
@Override
public void compute(final RandomAccessibleInterval<T> input,
	final RandomAccessibleInterval<T> output)
{
	// input may potentially be translated
	final long[] translation = new long[input.numDimensions()];
	input.min(translation);

	final IntervalView<T> tmpInterval = Views.interval(Views.translate(
		(RandomAccessible<T>) tmpCreator.calculate(input), translation), output);

	gauss1.compute(input, tmpInterval);
	gauss2.compute(input, output);

	// TODO: Match the Subtract Op in initialize() once we have BinaryOp
	ops().run(Ops.Math.Subtract.class, output, output, tmpInterval);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:18,代码来源:DefaultDoG.java

示例6: act

import net.imglib2.view.Views; //导入方法依赖的package包/类
@Override
public < T extends RealType< T > > void act(
		final int iteration,
		final RandomAccessibleInterval< T > matrix,
		final RandomAccessibleInterval< T > scaledMatrix,
		final double[] lut,
		final int[] permutation,
		final int[] inversePermutation,
		final double[] multipliers,
		final RandomAccessibleInterval< double[] > estimatedFit )
{
	final T dummy = scaledMatrix.randomAccess().get().createVariable();
	dummy.setReal( Double.NaN );
	final String path = fileDir( iteration );
	if ( iteration == 0 )
		createParentDirectory( path );
	final LUTRealTransform tf = new LUTRealTransform( lut, 2, 2 );

	final RealTransformRealRandomAccessible< T, InverseRealTransform > transformed = RealViews.transformReal( Views.interpolate( Views.extendValue( scaledMatrix, dummy ), new NLinearInterpolatorFactory<>() ), tf );
	final double s = 1.0 / ( lut[ lut.length - 1 ] - lut[ 0 ] ) * lut.length;
	final double o = -lut[ 0 ];
	final ScaleAndTranslation scaleAndTranslation = new ScaleAndTranslation( new double[] { s, s }, new double[] { o, o } );
	final IntervalView< T > offset = Views.interval( Views.raster( RealViews.transformReal( transformed, scaleAndTranslation ) ), scaledMatrix );
	final RandomAccessibleInterval< T > strip = MatrixStripConversion.matrixToStrip( offset, range, dummy );
	new FileSaver( ImageJFunctions.wrap( strip, "" ) ).saveAsTiff( path );
}
 
开发者ID:saalfeldlab,项目名称:z-spacing,代码行数:27,代码来源:MatrixVisitor.java

示例7: addLeadingZeros

import net.imglib2.view.Views; //导入方法依赖的package包/类
/**
 * Add 0s before axis minimum.
 * 
 * @param input Input RAI
 * @return An extended and cropped version of input
 */
private <T extends RealType<T>> RandomAccessibleInterval<T> addLeadingZeros(
	RandomAccessibleInterval<T> input)
{
	final long[] min = Intervals.minAsLongArray(input);
	final long[] max = Intervals.maxAsLongArray(input);

	for (int i = 0; i < max.length; i++) {
		min[i]--;
	}

	final T realZero = Util.getTypeFromInterval(input).copy();
	realZero.setZero();

	final ExtendedRandomAccessibleInterval<T, RandomAccessibleInterval<T>> extendedImg = Views.extendValue(input,
		realZero);
	final IntervalView<T> offsetInterval = Views.interval(extendedImg,
		min, max);
	
	return Views.zeroMin(offsetInterval);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:27,代码来源:LocalThresholdIntegral.java

示例8: testCreateFromRaiDifferentType

import net.imglib2.view.Views; //导入方法依赖的package包/类
@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());
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:18,代码来源:CreateImgTest.java

示例9: computeEdgelFeatures

import net.imglib2.view.Views; //导入方法依赖的package包/类
protected double[] computeEdgelFeatures( Edgel e )
	{
		
		RandomAccessible<T> e1View = 
				EdgelTools.edgelToView(e, img, patchSize);
		
//		CrackCorrection.computeCrackDepthNormalMask(e, mask, patchSize, depth1);
		
		// compute intensity statistics
		IterableIntervalPointSet ptset = new IterableIntervalPointSet( img );
		
		StatCalculator<T> sc = new StatCalculator<T>( 
				new RealImageFunction<T,T>(
						Views.interval( e1View, new long[patchSize.length], ArrayUtil.toLong(patchSize)), img.firstElement()),
				ptset );
		
		double[] feats = new double[4];

		feats[0] = sc.arithmeticMean();
		feats[1] = sc.sampleStdDev();
		feats[2] = sc.sampleSkew();
		feats[3] = sc.sampleKurtosis();
		
		
		return feats;
	}
 
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:27,代码来源:EdgelMatching.java

示例10: drawXYSheets

import net.imglib2.view.Views; //导入方法依赖的package包/类
private static Img<BitType> drawXYSheets() {
	final Img<BitType> sheets = ArrayImgs.bits(100, 100, 100);
	long z = 5;
	for (int i = 0; i < 10; i++) {
		final IntervalView<BitType> sheet = Views.interval(sheets, new long[] { 0,
			0, z }, new long[] { 99, 99, z });
		sheet.cursor().forEachRemaining(BitType::setOne);
		z += 10;
	}
	return sheets;
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:12,代码来源:MILGridTest.java

示例11: writeMask

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

示例12: getVisibleIds

import net.imglib2.view.Views; //导入方法依赖的package包/类
@Override
public synchronized TLongHashSet getVisibleIds()
{
	final TLongHashSet visibleIds = new TLongHashSet();
	final int w = viewer.getWidth();
	final int h = viewer.getHeight();
	final AffineTransform3D viewerTransform = new AffineTransform3D();
	viewer.getState().getViewerTransform( viewerTransform );
	final IntervalView< Pair< LabelMultisetType, LongType > > screenLabels =
			Views.interval(
					Views.hyperSlice(
							RealViews.affine( labels, viewerTransform ), 2, 0 ),
					new FinalInterval( w, h ) );

	for ( final Pair< LabelMultisetType, LongType > pixel : Views.iterable( screenLabels ) )
	{
		final long b = pixel.getB().get();
		if ( b == Label.TRANSPARENT )
		{
			final LabelMultisetType a = pixel.getA();
			for ( final Entry< Label > entry : a.entrySet() )
				visibleIds.add( entry.getElement().id() );
		}
		else
			visibleIds.add( b );
	}

	return visibleIds;
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:30,代码来源:PairLabelMultiSetLongIdPicker.java

示例13: getSource

import net.imglib2.view.Views; //导入方法依赖的package包/类
@Override
public RandomAccessibleInterval< T > getSource( final int t, final int level )
{
	return Views.interval(
			Views.raster( getInterpolatedSource( t, level, Interpolation.NEARESTNEIGHBOR ) ),
			estimateBoundingInterval( t, level ));
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:8,代码来源:WarpedSource.java

示例14: getSource

import net.imglib2.view.Views; //导入方法依赖的package包/类
@Override
public RandomAccessibleInterval<T> getSource( int t, int level ) 
{
	return Views.interval( Views.raster( 
			getInterpolatedSource( t, level, Interpolation.NEARESTNEIGHBOR ) ), 
			interval );
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:8,代码来源:GridSource.java

示例15: act

import net.imglib2.view.Views; //导入方法依赖的package包/类
@Override
public < T extends RealType< T > > void act(
		final int iteration,
		final RandomAccessibleInterval< T > matrix,
		final RandomAccessibleInterval< T > scaledMatrix,
		final double[] lut,
		final int[] permutation,
		final int[] inversePermutation,
		final double[] multipliers,
		final RandomAccessibleInterval< double[] > estimatedFit )
{

	final ArrayImg< DoubleType, DoubleArray > coordinateImage = ArrayImgs.doubles( lut, lut.length );
	final PermutationTransform transform = new PermutationTransform( permutation, 1, 1 );
	final IntervalView< DoubleType > permuted = Views.interval( new TransformView< DoubleType >( coordinateImage, transform ), coordinateImage );

	try
	{
		final String path = fileDir( iteration );
		createParentDirectory( path );
		write( new IndexedIterable<>( separator, permuted ), path );
	}
	catch ( final IOException e )
	{
		// catch exceptions?
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

}
 
开发者ID:saalfeldlab,项目名称:z-spacing,代码行数:31,代码来源:PermutedLUTVisitor.java


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