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


Java AffineTransform3D.get方法代码示例

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


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

示例1: centerViewOn

import net.imglib2.realtransform.AffineTransform3D; //导入方法依赖的package包/类
public void centerViewOn( final Spot spot )
{
	final int tp = spot.getFeature( Spot.FRAME ).intValue();
	setTimepoint( tp );

	final AffineTransform3D t = new AffineTransform3D();
	state.getViewerTransform( t );
	final double[] spotCoords = new double[] { spot.getFeature( Spot.POSITION_X ), spot.getFeature( Spot.POSITION_Y ), spot.getFeature( Spot.POSITION_Z ) };

	// Translate view so that the target spot is in the middle of the
	// JFrame.
	final double dx = display.getWidth() / 2 - ( t.get( 0, 0 ) * spotCoords[ 0 ] + t.get( 0, 1 ) * spotCoords[ 1 ] + t.get( 0, 2 ) * spotCoords[ 2 ] );
	final double dy = display.getHeight() / 2 - ( t.get( 1, 0 ) * spotCoords[ 0 ] + t.get( 1, 1 ) * spotCoords[ 1 ] + t.get( 1, 2 ) * spotCoords[ 2 ] );
	final double dz = -( t.get( 2, 0 ) * spotCoords[ 0 ] + t.get( 2, 1 ) * spotCoords[ 1 ] + t.get( 2, 2 ) * spotCoords[ 2 ] );

	// But use an animator to do this smoothly.
	final double[] target = new double[] { dx, dy, dz };
	currentAnimator = new TranslationAnimator( t, target, 300 );
	currentAnimator.setTime( System.currentTimeMillis() );
	requestRepaint();
}
 
开发者ID:fiji,项目名称:MaMuT,代码行数:22,代码来源:MamutViewerPanel.java

示例2: extractScale

import net.imglib2.realtransform.AffineTransform3D; //导入方法依赖的package包/类
public static double extractScale( final AffineTransform3D transform, final int axis )
{
	double sqSum = 0;
	final int c = axis;
	for ( int r = 0; r < 2; ++r )
	{
		final double x = transform.get( r, c );
		sqSum += x * x;
	}
	return Math.sqrt( sqSum );
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:12,代码来源:Rotation2DHelpers.java

示例3: extractRotation

import net.imglib2.realtransform.AffineTransform3D; //导入方法依赖的package包/类
public static double extractRotation( AffineTransform3D xfm )
	{
		double x = xfm.get( 0, 0 );
		double y = xfm.get( 0, 1 );
		
//		double theta  = Math.atan2( y, x );
		double theta  = Math.atan2( -y, x );
//		double theta = getAngle( y, x );
		
		return theta;
	}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:12,代码来源:Rotation2DHelpers.java

示例4: isIdentity

import net.imglib2.realtransform.AffineTransform3D; //导入方法依赖的package包/类
public static final boolean isIdentity( final AffineTransform3D transform )
{
	for ( int i = 0; i < 3; i++ )
	{
		if ( transform.get( i, i ) != 1 )
			return false;
	}
	return true;
}
 
开发者ID:fiji,项目名称:MaMuT,代码行数:10,代码来源:TransformUtils.java

示例5: rotateView2d

import net.imglib2.realtransform.AffineTransform3D; //导入方法依赖的package包/类
public synchronized void rotateView2d( boolean isClockwise )
	{
		if ( !transformEnabled )
			return;

		final SourceState< ? > source = state.getSources().get( state.getCurrentSource() );
		final AffineTransform3D sourceTransform = new AffineTransform3D();
		source.getSpimSource().getSourceTransform( state.getCurrentTimepoint(), 0, sourceTransform );

		final AffineTransform3D transform = display.getTransformEventHandler().getTransform();

		// avoid computing angle explicitly ( and thus avoid expensive inverse tan op )
		// and instead do a verbose, but faster if statements
		double m00 = transform.get( 0, 0 );
		double m01 = transform.get( 0, 1 );
		double m10 = transform.get( 1, 0 );
		double m11 = transform.get( 1, 1 );

		boolean xpos = ( m00 + m10 > 0 );
		boolean ypos = ( m01 + m11 > 0 );
		
		RotatePlane2d qTarget;
		if( isClockwise )
		{
			if( xpos && ypos )
				qTarget = RotatePlane2d.qpY;
			else if( xpos && !ypos )
				qTarget = RotatePlane2d.qnX;
			else if( !xpos && ypos )
				qTarget = RotatePlane2d.qpX;
			else if( !xpos && !ypos )
				qTarget = RotatePlane2d.qnY;
			else
				qTarget = null; 
		}
		else
		{
			if( xpos && ypos )
				qTarget = RotatePlane2d.qnY;
			else if( xpos && !ypos )
				qTarget = RotatePlane2d.qpX;
			else if( !xpos && ypos )
				qTarget = RotatePlane2d.qnX;
			else if( !xpos && !ypos )
				qTarget = RotatePlane2d.qpY;
			else
				qTarget = null; 
		}
		
		if( qTarget == null ) return;
		
		double[][] R = new double[4][4];
		LinAlgHelpers.quaternionToR( qTarget.qAlign, R );
		R[3][3] = 1.0;
		destXfm.set( R );
		
		double centerX;
		double centerY;
		if ( mouseCoordinates.isMouseInsidePanel() )
		{
			centerX = mouseCoordinates.getX();
			centerY = mouseCoordinates.getY();
		}
		else
		{
			centerY = getHeight() / 2.0;
			centerX = getWidth() / 2.0;
		}
		
//		currentAnimator = new RotationAnimator( transform, centerX, centerY, q, 300 );
//		currentAnimator = new RotationAnimator( transform, centerX, centerY, qTarget.qAlign, 300 );
		currentAnimator = new RotationAnimator2D( transform, centerX, centerY, destXfm, 300 );

		currentAnimator.setTime( System.currentTimeMillis() );
		transformChanged( transform );
	}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:77,代码来源:BigWarpViewerPanel.java

示例6: paint

import net.imglib2.realtransform.AffineTransform3D; //导入方法依赖的package包/类
/**
 * This paints the box overlay with perspective and scale set such that it
 * fits approximately into the specified screen area.
 *
 * @param graphics
 *            graphics context to paint to.
 * @param sources
 *            source intervals (3D boxes) to be shown.
 * @param targetInterval
 *            target interval (2D box) into which a slice of sourceInterval
 *            is projected.
 * @param boxScreen
 *            (approximate) area of the screen which to fill with the box
 *            visualisation.
 */
public < I extends IntervalAndTransform > void paint( final Graphics2D graphics, final List< I > sources, final Interval targetInterval, final Interval boxScreen )
{
	assert ( targetInterval.numDimensions() >= 2 );

	if ( sources.isEmpty() )
		return;

	final double perspective = 3;
	final double screenBoxRatio = 0.75;

	long maxSourceSize = 0;
	for ( final IntervalAndTransform source : sources )
		maxSourceSize = Math.max( maxSourceSize, Math.max( Math.max( source.getSourceInterval().dimension( 0 ), source.getSourceInterval().dimension( 1 ) ), source.getSourceInterval().dimension( 2 ) ) );
	final long sourceSize = maxSourceSize;
	final long targetSize = Math.max( targetInterval.dimension( 0 ), targetInterval.dimension( 1 ) );

	final AffineTransform3D transform = sources.get( 0 ).getSourceToViewer();
	final double vx = transform.get( 0, 0 );
	final double vy = transform.get( 1, 0 );
	final double vz = transform.get( 2, 0 );
	final double transformScale = Math.sqrt( vx*vx + vy*vy + vz*vz );
	renderBoxHelper.setDepth( perspective * sourceSize * transformScale );

	final double bw = screenBoxRatio * boxScreen.dimension( 0 );
	final double bh = screenBoxRatio * boxScreen.dimension( 1 );
	double scale = Math.min( bw / targetInterval.dimension( 0 ), bh / targetInterval.dimension( 1 ) );

	final double tsScale = transformScale * sourceSize / targetSize;
	if ( tsScale > 1.0 )
		scale /= tsScale;
	renderBoxHelper.setScale( scale );

	final long x = boxScreen.min( 0 ) + boxScreen.dimension( 0 ) / 2;
	final long y = boxScreen.min( 1 ) + boxScreen.dimension( 1 ) / 2;

	final AffineTransform t = graphics.getTransform();
	final AffineTransform translate = new AffineTransform( 1, 0, 0, 1, x, y );
	translate.preConcatenate( t );
	graphics.setTransform( translate );
	paint( graphics, sources, targetInterval );
	graphics.setTransform( t );
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:58,代码来源:MultiBoxOverlay2d.java

示例7: SimilarityTransformAnimator3D

import net.imglib2.realtransform.AffineTransform3D; //导入方法依赖的package包/类
public SimilarityTransformAnimator3D( final AffineTransform3D transformStart, final AffineTransform3D transformEnd, final double cX, final double cY, final long duration )
{
	super( duration );
	this.cX = cX;
	this.cY = cY;

	qStart = new double[ 4 ];
	final double[] qStartInv = new double[ 4 ];
	final double[] qEnd = new double[ 4 ];
	final double[] qEndInv = new double[ 4 ];
	qDiff = new double[ 4 ];
	Affine3DHelpers.extractRotation( transformStart, qStart );
	LinAlgHelpers.quaternionInvert( qStart, qStartInv );

	Affine3DHelpers.extractRotation( transformEnd, qEnd );
	LinAlgHelpers.quaternionInvert( qEnd, qEndInv );

	LinAlgHelpers.quaternionMultiply( qStartInv, qEnd, qDiff );
	if ( qDiff[ 0 ] < 0 )
		LinAlgHelpers.scale( qDiff, -1, qDiff );

	scaleStart = Affine3DHelpers.extractScale( transformStart, 0 );
	scaleEnd = Affine3DHelpers.extractScale( transformEnd, 0 );
	scaleDiff = scaleEnd - scaleStart;

	final double[] tStart = new double[ 3 ];
	final double[] tEnd = new double[ 3 ];
	for ( int d = 0; d < 3; ++d )
	{
		tStart[ d ] = transformStart.get( d, 3 ) / scaleStart;
		tEnd[ d ] = transformEnd.get( d, 3 ) / scaleEnd;
	}

	xg0Start = new double[3];
	final double[] xg0End = new double[3];
	xg0Diff = new double[3];

	final double[][] R = new double[ 3 ][ 3 ];
	LinAlgHelpers.quaternionToR( qStartInv, R );
	LinAlgHelpers.mult( R, tStart, xg0Start );
	LinAlgHelpers.scale( xg0Start, -1, xg0Start );
	LinAlgHelpers.quaternionToR( qEndInv, R );
	LinAlgHelpers.mult( R, tEnd, xg0End );
	LinAlgHelpers.scale( xg0End, -1, xg0End );
	LinAlgHelpers.subtract( xg0End, xg0Start, xg0Diff );
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:47,代码来源:SimilarityTransformAnimator3D.java

示例8: SimilarityTransformAnimator2D

import net.imglib2.realtransform.AffineTransform3D; //导入方法依赖的package包/类
public SimilarityTransformAnimator2D( final AffineTransform3D transformStart, final AffineTransform3D transformEnd, final double cX, final double cY, final long duration )
{
	super( duration );
	
	startAngle = Rotation2DHelpers.extractRotation( transformStart );
	final double endAngle = Rotation2DHelpers.extractRotation( transformEnd );
	
	scaleStart = Rotation2DHelpers.extractScale( transformStart, 0 );
	scaleEnd   = Rotation2DHelpers.extractScale( transformEnd, 0 );
	scaleDiff = scaleEnd - scaleStart;
	
	totalAngle = Rotation2DHelpers.shorterAngleBetweenRotations( startAngle, endAngle );
	
	cosInvAngleStart = Math.cos( -startAngle );
	sinInvAngleStart = Math.sin( -startAngle );
	
	cosInvAngleEnd = Math.cos( -endAngle );
	sinInvAngleEnd = Math.sin( -endAngle );
	
	final double[] tStart = new double[ 3 ];
	final double[] tEnd = new double[ 3 ];
	for ( int d = 0; d < 3; ++d )
	{
		tStart[ d ] = transformStart.get( d, 3 ) / scaleStart;
		tEnd[ d ] = transformEnd.get( d, 3 ) / scaleEnd;
	}
	
	xg0Start = new double[3];
	final double[] xg0End = new double[3];
	xg0Diff = new double[3];
	
	// inverse rotate scaled starting 
	Rotation2DHelpers.cosSinMult( tStart, xg0Start, cosInvAngleStart, sinInvAngleStart );
	LinAlgHelpers.scale( xg0Start, -1, xg0Start );
		
	Rotation2DHelpers.cosSinMult( tEnd, xg0End, cosInvAngleEnd, sinInvAngleEnd );
	LinAlgHelpers.scale( xg0End, -1, xg0End );
	
	LinAlgHelpers.subtract( xg0End, xg0Start, xg0Diff );
	
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:42,代码来源:SimilarityTransformAnimator2D.java

示例9: computeScaleAssumeRigid

import net.imglib2.realtransform.AffineTransform3D; //导入方法依赖的package包/类
public static double computeScaleAssumeRigid( final AffineTransform3D xfm )
{
	return xfm.get( 0, 0 ) + xfm.get( 0, 1 ) + xfm.get( 0, 2 );
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:5,代码来源:BigWarp.java


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