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


Java Point类代码示例

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


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

示例1: calcIndex

import net.imglib2.Point; //导入依赖的package包/类
/**
 * Calculates the index of a point in a buffer of a Tensor of the given
 * shape
 */
private int calcIndex(final long[] shape, final int[] mapping, final Point p) {
	assert p.numDimensions() == shape.length;
	int n = shape.length;

	// switch index and value of the mapping
	int[] switchedMapping = new int[mapping.length];
	IntStream.range(0, mapping.length).forEach(i -> switchedMapping[mapping[i]] = i);

	int index = 0;
	for (int dimPreSize = 1, d = n - 1; d >= 0; d--) {
		index += dimPreSize * p.getIntPosition(switchedMapping[d]);
		dimPreSize *= shape[d];
	}
	return index;
}
 
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:20,代码来源:TensorsTest.java

示例2: main

import net.imglib2.Point; //导入依赖的package包/类
public static void main(String[] args) {
	
	double o1 = 6;
	double o2 = Double.NEGATIVE_INFINITY;
	int np1 = 30;
	int np2 = 20;

	System.out.println( Double.isInfinite( o2 ));

	int ccCompare = Double.compare(o1, o2);
	if (ccCompare != 0)
		System.out.println( ccCompare );
	else 
		System.out.println( (int)(np1 - np2) );
	
	System.exit( 0 );
	PhaseCorrelationPeak2 peaks = new PhaseCorrelationPeak2(new Point(new int[] {10, 10}), 1.0);
	Dimensions pcmDims = new FinalDimensions(new int[] {50, 50});
	Dimensions imgDims = new FinalDimensions(new int[] {30, 30});
	PhaseCorrelation2Util.expandPeakToPossibleShifts(peaks, pcmDims, imgDims, imgDims);
	
}
 
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:23,代码来源:PhaseCorrelationPeak2.java

示例3: click

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

示例4: testCorners

import net.imglib2.Point; //导入依赖的package包/类
public void testCorners() {
	long[] window = new long[]{10, 10, 10};
	int numDimensions = window.length;
	Point[] offsets = new Point[(int)Math.pow(2, numDimensions)];
	for (int i=0; i<offsets.length; ++i) offsets[i] = new Point(numDimensions);
	int d = 0;
	while (d < numDimensions) {
		final int flip = (int)Math.pow(2, d);
		int sign = -1;
		for (int i=0; i<offsets.length;) {
			offsets[i].setPosition(sign * window[d] / 2, d);
			++i;
			if (0 == i % flip) sign *= -1;
		}
		++d;
	}
	for (int i=0; i<offsets.length; ++i) {
		System.out.println(offsets[i].toString());
	}
}
 
开发者ID:imglib,项目名称:imglib2-script,代码行数:21,代码来源:TestHistograms.java

示例5: getInsidePoints

import net.imglib2.Point; //导入依赖的package包/类
@SuppressWarnings( "unchecked" )
static ArrayList< Point >[] getInsidePoints( final ArrayList< Point > points, final double[][] planes )
{
	final int nPlanes = planes.length;
	final int n = points.get( 0 ).numDimensions();
	final ArrayList< Point > inside = new ArrayList< Point >();
	final ArrayList< Point > outside = new ArrayList< Point >();
	A: for ( final Point p : points )
	{
		for ( int i = 0; i < nPlanes; ++i )
		{
			final double[] plane = planes[ i ];
			double dot = 0;
			for ( int d = 0; d < n; ++d )
				dot += p.getDoublePosition( d ) * plane[ d ];
			if ( dot < plane[ n ] )
			{
				outside.add( p );
				continue A;
			}
		}
		inside.add( p );
	}
	return new ArrayList[] { inside, outside };
}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:26,代码来源:ClipConvexPolytopeKDTreeBenchmark.java

示例6: gaussianSmooth

import net.imglib2.Point; //导入依赖的package包/类
/**
 * Gaussian Smooth of the input image using intermediate float format.
 * @param <T>
 * @param img
 * @param sigma
 * @return
 */
public static <T extends RealType<T> & NativeType<T>> RandomAccessibleInterval<T> gaussianSmooth(
		RandomAccessibleInterval<T> img, double[] sigma) {
	Interval interval = Views.iterable(img);

	ImgFactory<T> outputFactory = new ArrayImgFactory<T>();
	final long[] dim = new long[ img.numDimensions() ];
	img.dimensions(dim);
	RandomAccessibleInterval<T> output = outputFactory.create( dim,
			img.randomAccess().get().createVariable() );

	final long[] pos = new long[ img.numDimensions() ];
	Arrays.fill(pos, 0);
	Localizable origin = new Point(pos);

	ImgFactory<FloatType> tempFactory = new ArrayImgFactory<FloatType>();
	RandomAccessible<T> input = Views.extendMirrorSingle(img);
	Gauss.inFloat(sigma, input, interval, output, origin, tempFactory);

	return output;
}
 
开发者ID:fiji,项目名称:Colocalisation_Analysis,代码行数:28,代码来源:TestImageAccessor.java

示例7: checkImage

import net.imglib2.Point; //导入依赖的package包/类
/** Checks one image for the dimensions and marked points */
private <T extends RealType<T>> void checkImage(final Img<T> img, final int n, final long[] dims,
		final List<Point> points) {
	assertArrayEquals(dims, Intervals.dimensionsAsLongArray(img));
	assertEquals(n, img.numDimensions());
	checkPoints(img, points);
}
 
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:8,代码来源:TensorsTest.java

示例8: testImg2TensorReverseForType

import net.imglib2.Point; //导入依赖的package包/类
/** Tests the tensor(RAI) function for one image */
private <T extends RealType<T>> void testImg2TensorReverseForType(final Img<T> img, final int n, final long[] shape,
		final DataType t) {
	// Put some values to check into the image
	List<Point> points = createTestPoints(n);
	markPoints(img, points);

	Tensor tensor = Tensors.tensor(img);

	assertArrayEquals(shape, tensor.shape());
	assertEquals(n, tensor.numDimensions());
	assertEquals(t, tensor.dataType());
	checkPointsTensor(tensor, IntStream.range(0, n).map(i -> n - 1 - i).toArray(), points);
}
 
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:15,代码来源:TensorsTest.java

示例9: testImg2TensorDirectForType

import net.imglib2.Point; //导入依赖的package包/类
/** Tests the tensorDirect(RAI) function for one image */
private <T extends RealType<T>> void testImg2TensorDirectForType(final Img<T> img, final int n, final long[] shape,
		final DataType t) {
	// Put some values to check into the image
	List<Point> points = createTestPoints(n);
	markPoints(img, points);

	Tensor tensor = Tensors.tensorDirect(img);

	assertArrayEquals(shape, tensor.shape());
	assertEquals(n, tensor.numDimensions());
	assertEquals(t, tensor.dataType());
	checkPointsTensor(tensor, IntStream.range(0, n).toArray(), points);
}
 
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:15,代码来源:TensorsTest.java

示例10: testImg2TensorMappingForType

import net.imglib2.Point; //导入依赖的package包/类
/** Tests the tensor(RAI, int[]) function for one image */
private <T extends RealType<T>> void testImg2TensorMappingForType(final Img<T> img, final int[] mapping,
		final int n, final long[] shape, final DataType t) {
	// Put some values to check into the image
	List<Point> points = createTestPoints(n);
	markPoints(img, points);
	Tensor tensor = Tensors.tensor(img, mapping);

	assertArrayEquals(shape, tensor.shape());
	assertEquals(n, tensor.numDimensions());
	assertEquals(t, tensor.dataType());
	checkPointsTensor(tensor, mapping, points);
}
 
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:14,代码来源:TensorsTest.java

示例11: createTestPoints

import net.imglib2.Point; //导入依赖的package包/类
/** Creates some interesting points to mark */
private List<Point> createTestPoints(int n) {
	List<Point> points = new ArrayList<>();
	points.add(new Point(n));
	for (int d = 0; d < n; d++) {
		Point p = new Point(n);
		p.fwd(d);
		points.add(p);
	}
	return points;
}
 
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:12,代码来源:TensorsTest.java

示例12: markPoints

import net.imglib2.Point; //导入依赖的package包/类
/** Marks a list of points in an image */
private <T extends RealType<T>> void markPoints(final Img<T> img, final List<Point> points) {
	for (int i = 0; i < points.size(); i++) {
		RandomAccess<T> randomAccess = img.randomAccess();
		randomAccess.setPosition(points.get(i));
		randomAccess.get().setReal(i + 1);
	}
}
 
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:9,代码来源:TensorsTest.java

示例13: checkPoints

import net.imglib2.Point; //导入依赖的package包/类
/** Checks if points in an image are set to the right value */
private <T extends RealType<T>> void checkPoints(final Img<T> img, List<Point> points) {
	for (int i = 0; i < points.size(); i++) {
		RandomAccess<T> randomAccess = img.randomAccess();
		randomAccess.setPosition(points.get(i));
		assertEquals(i + 1, randomAccess.get().getRealFloat(), 0.001);
	}
}
 
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:9,代码来源:TensorsTest.java

示例14: execForPointsWithBufferIndex

import net.imglib2.Point; //导入依赖的package包/类
/**
 * Calculates the index of a point in a Tensor buffer and executes the
 * BiConsumer with the index and the value of the point (which is the index
 * in the list + 1).
 */
private void execForPointsWithBufferIndex(final long[] shape, final int[] mapping, final List<Point> points,
		final BiConsumer<Integer, Integer> exec) {
	for (int i = 0; i < points.size(); i++) {
		exec.accept(calcIndex(shape, mapping, points.get(i)), i + 1);
	}
}
 
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:12,代码来源:TensorsTest.java

示例15: main

import net.imglib2.Point; //导入依赖的package包/类
public static void main(String[] args)
{
	RigidWarp3D warp = new RigidWarp3D();
	AffineGet affine = warp
			.getAffine( new double[] { Math.cos( Math.PI / 4 ) - 1, 0, 0, Math.sin( Math.PI / 4 ), 2, 2, 2 } );
	System.out.println( Util.printCoordinates( affine.getRowPackedCopy() ) );

	for ( int d = 0; d < 3; d++ )
		for ( int p = 0; p < warp.numParameters(); p++ )
			System.out.println( warp.partial( new Point( 1, 2, 3 ), d, p ) );
}
 
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:12,代码来源:RigidWarp3D.java


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