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


Java RealLocalizable.getDoublePosition方法代码示例

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


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

示例1: applyInverse

import net.imglib2.RealLocalizable; //导入方法依赖的package包/类
@Override
public void applyInverse( final RealPositionable source, final RealLocalizable target )
{
	if( tps == null )
	{
		for ( int d = 0; d < target.numDimensions(); ++d )
			source.setPosition( target.getDoublePosition( d ), d );
			
		return;
	}
	
	double[] pt = new double[ tps.getNumDims() ];
	for ( int d = 0; d < tps.getNumDims(); ++d )
		pt[ d ] = target.getDoublePosition( d );
	
	double[] ptxfm = tps.apply( pt );
	
	for ( int d = 0; d < tps.getNumDims(); ++d )
		source.setPosition( ptxfm[ d ], d);
	
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:22,代码来源:TpsTransformWrapper.java

示例2: updateFigure

import net.imglib2.RealLocalizable; //导入方法依赖的package包/类
@Override
public void updateFigure(final OverlayView view, final BezierFigure figure) {
	super.updateFigure(view, figure);
	final PolygonOverlay polygonOverlay = downcastOverlay(view.getData());
	final PolygonRegionOfInterest roi = polygonOverlay.getRegionOfInterest();
	final int vertexCount = roi.getVertexCount();
	while (figure.getNodeCount() > vertexCount) {
		figure.removeNode(vertexCount);
	}
	for (int i = 0; i < vertexCount; i++) {
		final RealLocalizable vertex = roi.getVertex(i);
		final double x = vertex.getDoublePosition(0);
		final double y = vertex.getDoublePosition(1);
		if (figure.getNodeCount() == i) {
			figure.addNode(new Node(x, y));
		}
		else {
			final Node node = figure.getNode(i);
			node.mask = 0;
			Arrays.fill(node.x, x);
			Arrays.fill(node.y, y);
		}
	}
}
 
开发者ID:imagej,项目名称:imagej-ui-swing,代码行数:25,代码来源:PolygonJHotDrawAdapter.java

示例3: compute

import net.imglib2.RealLocalizable; //导入方法依赖的package包/类
@Override
public void compute(Polygon input, DoubleType output) {
	final List<? extends RealLocalizable> points = function.calculate(input).getVertices();

	final double angleRad = -angle * Math.PI / 180.0;
	
	double minX = Double.POSITIVE_INFINITY;
	double maxX = Double.NEGATIVE_INFINITY;
	
	for (RealLocalizable p : points) {
		final double tmpX = p.getDoublePosition(0) * Math.cos(angleRad) - p.getDoublePosition(1) * Math.sin(angleRad);
		minX = tmpX < minX ? tmpX : minX;
		maxX = tmpX > maxX ? tmpX : maxX;
	}
	
	output.set(Math.abs(maxX - minX));
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:18,代码来源:DefaultFeretsDiameterForAngle.java

示例4: rotate

import net.imglib2.RealLocalizable; //导入方法依赖的package包/类
/**
 * Rotates the given Polygon consisting of a list of RealPoints by the given
 * angle about the given center.
 *
 * @param inPoly A Polygon consisting of a list of RealPoint RealPoints
 * @param angle the rotation angle
 * @param center the rotation center
 * @return a rotated polygon
 */
private Polygon rotate(final Polygon inPoly, final double angle,
	final RealLocalizable center)
{

	List<RealLocalizable> out = new ArrayList<>();

	for (RealLocalizable RealPoint : inPoly.getVertices()) {

		// double angleInRadians = Math.toRadians(angleInDegrees);
		double cosTheta = Math.cos(angle);
		double sinTheta = Math.sin(angle);

		double x = cosTheta * (RealPoint.getDoublePosition(0) - center
			.getDoublePosition(0)) - sinTheta * (RealPoint.getDoublePosition(1) -
				center.getDoublePosition(1)) + center.getDoublePosition(0);

		double y = sinTheta * (RealPoint.getDoublePosition(0) - center
			.getDoublePosition(0)) + cosTheta * (RealPoint.getDoublePosition(1) -
				center.getDoublePosition(1)) + center.getDoublePosition(1);

		out.add(new RealPoint(x, y));
	}

	return new Polygon(out);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:35,代码来源:DefaultSmallestEnclosingRectangle.java

示例5: compute

import net.imglib2.RealLocalizable; //导入方法依赖的package包/类
@Override
public void compute(Polygon input, DoubleType output) {
	double sum = 0;
	final int numVertices = input.getVertices().size();
	for (int i = 0; i < numVertices; i++) {

		final RealLocalizable p0 = input.getVertices().get(i);
		final RealLocalizable p1 = input.getVertices().get((i + 1) % numVertices);

		final double p0_x = p0.getDoublePosition(0);
		final double p0_y = p0.getDoublePosition(1);
		final double p1_x = p1.getDoublePosition(0);
		final double p1_y = p1.getDoublePosition(1);

		sum += p0_x * p1_y - p0_y * p1_x;
	}
	output.set(Math.abs(sum) / 2d);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:19,代码来源:DefaultSizePolygon.java

示例6: calculate

import net.imglib2.RealLocalizable; //导入方法依赖的package包/类
@Override
public RealLocalizable calculate(final Polygon input) {

	double area = sizeFunc.calculate(input).get();
	double cx = 0;
	double cy = 0;
	for (int i = 0; i < input.getVertices().size(); i++) {
		RealLocalizable p0 = input.getVertices().get(i);
		RealLocalizable p1 = input.getVertices().get((i + 1) % input.getVertices()
				.size());

		double p0_x = p0.getDoublePosition(0);
		double p0_y = p0.getDoublePosition(1);
		double p1_x = p1.getDoublePosition(0);
		double p1_y = p1.getDoublePosition(1);

		cx += (p0_x + p1_x) * (p0_x * p1_y - p1_x * p0_y);
		cy += (p0_y + p1_y) * (p0_x * p1_y - p1_x * p0_y);
	}

	return new RealPoint(cx / (area * 6), cy / (area * 6));
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:23,代码来源:CentroidPolygon.java

示例7: partial

import net.imglib2.RealLocalizable; //导入方法依赖的package包/类
@Override
public double partial( final RealLocalizable pos, final int d, final int param )
{
	final int i = param / ( n + 1 );
	if ( i != d )
		return 0.0;
	final int j = param - i * ( n + 1 );
	return j == n ? 1.0 : pos.getDoublePosition( j );
}
 
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:10,代码来源:AffineWarp.java

示例8: partial

import net.imglib2.RealLocalizable; //导入方法依赖的package包/类
@Override
public double partial(RealLocalizable pos, int d, int param)
{
	// we evaluate at p1,...,p3 = (1,0,0,0) (identity as quat)

	// translational part of Jacobian = I
	if ( param > 3 )
		return ( param - 4 ) == d ? 1.0 : 0.0;

	final int c = lut[d][param];

	// set Quat derivatives according to LUT above (*2)
	return c == 0 ? 0 : ( c < 0 ? -2 * pos.getDoublePosition( -c - 1 ) : 2 * pos.getDoublePosition( c - 1 ) );
}
 
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:15,代码来源:RigidWarp3D.java

示例9: partial

import net.imglib2.RealLocalizable; //导入方法依赖的package包/类
@Override
public double partial(RealLocalizable pos, int d, int param)
{
	
	if (param == 0)
		return (d == 0 ? -1.0 : 1.0) * pos.getDoublePosition( (d + 1) % 2 );

	else
		return d == param-1 ? 1.0 : 0.0;
}
 
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:11,代码来源:RigidWarp2D.java

示例10: squaredDistance

import net.imglib2.RealLocalizable; //导入方法依赖的package包/类
public double squaredDistance( Double[] p, RealLocalizable q )
{
	double dist = 0;
	for( int j = 0; j < p.length; j++ )
	{
		dist += ( p[j].doubleValue() - q.getDoublePosition( j ) ) * ( p[j].doubleValue() - q.getDoublePosition( j ) );
	}
	return dist;
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:10,代码来源:LandmarkTableModel.java

示例11: move

import net.imglib2.RealLocalizable; //导入方法依赖的package包/类
@Override
public void move(RealLocalizable localizable) {
	for ( int d = 0; d < n; ++d )
	{
		final double distance = localizable.getDoublePosition( d );
		position[ d ] += distance;
	}
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:9,代码来源:GridRealRandomAccess.java

示例12: setPosition

import net.imglib2.RealLocalizable; //导入方法依赖的package包/类
@Override
public void setPosition(RealLocalizable localizable) {
	for ( int d = 0; d < n; ++d )
	{
		final double pos = localizable.getDoublePosition( d );
		position[ d ] = pos;
	}
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:9,代码来源:GridRealRandomAccess.java

示例13: calculate

import net.imglib2.RealLocalizable; //导入方法依赖的package包/类
@Override
public Polygon calculate(final Polygon input) {
	double min_x = Double.POSITIVE_INFINITY;
	double max_x = Double.NEGATIVE_INFINITY;
	double min_y = Double.POSITIVE_INFINITY;
	double max_y = Double.NEGATIVE_INFINITY;

	for (RealLocalizable rl : input.getVertices()) {
		if (rl.getDoublePosition(0) < min_x) {
			min_x = rl.getDoublePosition(0);
		}
		if (rl.getDoublePosition(0) > max_x) {
			max_x = rl.getDoublePosition(0);
		}
		if (rl.getDoublePosition(1) < min_y) {
			min_y = rl.getDoublePosition(1);
		}
		if (rl.getDoublePosition(1) > max_y) {
			max_y = rl.getDoublePosition(1);
		}
	}

	final List<RealLocalizable> bounds = new ArrayList<>();

	bounds.add(new RealPoint(min_x, min_y));
	bounds.add(new RealPoint(min_x, max_y));
	bounds.add(new RealPoint(max_x, max_y));
	bounds.add(new RealPoint(max_x, min_y));

	return new Polygon(bounds);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:32,代码来源:DefaultBoundingBox.java

示例14: tetrahedronInertiaTensor

import net.imglib2.RealLocalizable; //导入方法依赖的package包/类
/**
 * The computations are based on this paper:
 * http://docsdrive.com/pdfs/sciencepublications/jmssp/2005/8-11.pdf
 * 
 * Note: In the paper b' and c' are swapped.
 * 
 * @param p1
 *            triangular facet point
 * @param p2
 *            triangular facet point
 * @param p3
 *            triangular facet point
 * @param cent
 *            of the mesh
 * @return inertia tensor of this tetrahedron
 */
private BlockRealMatrix tetrahedronInertiaTensor(final RealLocalizable p1, final RealLocalizable p2,
		final RealLocalizable p3, final RealLocalizable cent) {
	final double originX = cent.getDoublePosition(0);
	final double originY = cent.getDoublePosition(1);
	final double originZ = cent.getDoublePosition(2);

	final double x1 = p1.getDoublePosition(0) - originX;
	final double y1 = p1.getDoublePosition(1) - originY;
	final double z1 = p1.getDoublePosition(2) - originZ;

	final double x2 = p2.getDoublePosition(0) - originX;
	final double y2 = p2.getDoublePosition(1) - originY;
	final double z2 = p2.getDoublePosition(2) - originZ;

	final double x3 = p3.getDoublePosition(0) - originX;
	final double y3 = p3.getDoublePosition(1) - originY;
	final double z3 = p3.getDoublePosition(2) - originZ;

	final double volume = tetrahedronVolume(new Vector3D(x1, y1, z1), new Vector3D(x2, y2, z2),
			new Vector3D(x3, y3, z3));

	final double a = 6 * volume * (y1 * y1 + y1 * y2 + y2 * y2 + y1 * y3 + y2 * y3 + y3 * y3 + z1 * z1 + z1 * z2
			+ z2 * z2 + z1 * z3 + z2 * z3 + z3 * z3) / 60.0;
	final double b = 6 * volume * (x1 * x1 + x1 * x2 + x2 * x2 + x1 * x3 + x2 * x3 + x3 * x3 + z1 * z1 + z1 * z2
			+ z2 * z2 + z1 * z3 + z2 * z3 + z3 * z3) / 60.0;
	final double c = 6 * volume * (x1 * x1 + x1 * x2 + x2 * x2 + x1 * x3 + x2 * x3 + x3 * x3 + y1 * y1 + y1 * y2
			+ y2 * y2 + y1 * y3 + y2 * y3 + y3 * y3) / 60.0;
	final double aa = 6 * volume
			* (2 * y1 * z1 + y2 * z1 + y3 * z1 + y1 * z2 + 2 * y2 * z2 + y3 * z2 + y1 * z3 + y2 * z3 + 2 * y3 * z3)
			/ 120.0;

	final double bb = 6 * volume
			* (2 * x1 * y1 + x2 * y1 + x3 * y1 + x1 * y2 + 2 * x2 * y2 + x3 * y2 + x1 * y3 + x2 * y3 + 2 * x3 * y3)
			/ 120.0;

	final double cc = 6 * volume
			* (2 * x1 * z1 + x2 * z1 + x3 * z1 + x1 * z2 + 2 * x2 * z2 + x3 * z2 + x1 * z3 + x2 * z3 + 2 * x3 * z3)
			/ 120.0;

	final BlockRealMatrix t = new BlockRealMatrix(3, 3);
	t.setRow(0, new double[] { a, -bb, -cc });
	t.setRow(1, new double[] { -bb, b, -aa });
	t.setRow(2, new double[] { -cc, -aa, c });

	return t;
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:63,代码来源:DefaultInertiaTensor3DMesh.java

示例15: ccw

import net.imglib2.RealLocalizable; //导入方法依赖的package包/类
/**
 * 2D cross product of OA and OB vectors, i.e. z-component of ir 3D cross
 * product. Returns a positive value, if OAB makes a counter-clockwise turn,
 * negative for clockwise turn, and zero if RealPoints are collinear.
 *
 * @param o first RealPoint
 * @param a second RealPoint
 * @param b third RealPoint
 * @return Returns a positive value, if OAB makes a counter-clockwise wturn,
 *         negative for clockwise turn, and zero if RealPoints are collinear.
 */
private double ccw(final RealLocalizable o, final RealLocalizable a,
	final RealLocalizable b)
{
	return (a.getDoublePosition(0) - o.getDoublePosition(0)) * (b
		.getDoublePosition(1) - o.getDoublePosition(1)) - (a.getDoublePosition(
			1) - o.getDoublePosition(1)) * (b.getDoublePosition(0) - o
				.getDoublePosition(0));
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:20,代码来源:DefaultConvexHull2D.java


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