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


Java Source.getSource方法代码示例

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


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

示例1: create

import bdv.viewer.Source; //导入方法依赖的package包/类
@Override
public TrackMateModelView create( final Model model, final Settings settings, final SelectionModel selectionModel )
{
	final SourceSettings ss = ( SourceSettings ) settings;
	final List< SourceAndConverter< ? >> sources = ss.getSources();
	final int numTimePoints = ss.nframes;
	final CacheControl cache = ss.getCacheControl();
	final Bookmarks bookmarks = new Bookmarks();
	// Test if we have 2D images.
	boolean is2D = true;
	for ( final SourceAndConverter< ? > sac : sources )
	{
		final Source< ? > source = sac.getSpimSource();
		for ( int t = 0; t < numTimePoints; t++ )
		{
			if ( source.isPresent( t ) )
			{
				final RandomAccessibleInterval< ? > level = source.getSource( t, 0 );
				if ( level.dimension( 2 ) > 1 )
					is2D = false;

				break;
			}
		}
	}

	final ViewerOptions options = ViewerOptions.options();
	if ( is2D )
		options.transformEventHandlerFactory( BehaviourTransformEventHandlerPlanar.factory() );

	return new MamutViewer( DEFAULT_WIDTH, DEFAULT_HEIGHT,
			sources, numTimePoints, cache,
			model, selectionModel,
			options,
			bookmarks );
}
 
开发者ID:fiji,项目名称:MaMuT,代码行数:37,代码来源:MamutViewerFactory.java

示例2: getImgPatch

import bdv.viewer.Source; //导入方法依赖的package包/类
@SuppressWarnings( { "rawtypes", "unchecked" } )
public static final Img< ? > getImgPatch( final long[] pos, final int frame, final int width, final int height, final int depth, final Source source )
{
	/*
	 * Here be generics massacre...
	 */

	final Type type = ( Type ) source.getType();
	final RealType rtype = ( RealType ) type.createVariable();
	rtype.setZero();
	final NativeType ntype = ( NativeType ) rtype;
	final long[] size = new long[] { width, height, depth };

	final RandomAccessibleInterval img = source.getSource( frame, 0 );

	// Get coords
	final long x = pos[ 0 ];
	final long y = pos[ 1 ];
	final long z = pos[ 2 ];

	final int xp = width / 2;
	final int xm = width - xp;
	final int yp = height / 2;
	final int ym = height - yp;
	final int zp = depth / 2;
	final int zm = depth - zp;


	// Crop
	final Interval cropInterval = Intervals.createMinMax( x - xm, y - ym, z - zm, x + xp, y + yp, z + zp );

	if ( isEmpty( cropInterval ) )
	{
		final Img ret = new ArrayImgFactory().create( size, ntype );
		return ret;
	}
	else
	{
		final ExtendedRandomAccessibleInterval extendZero = Views.extendZero( img );
		final IntervalView crop = Views.zeroMin( Views.interval( extendZero, cropInterval ) );
		final Img target = Util.getArrayOrCellImgFactory( crop, ntype ).create( size, ntype );

		final RandomAccess randomAccess = crop.randomAccess();
		final Cursor cursor = target.localizingCursor();
		while ( cursor.hasNext() )
		{
			cursor.fwd();
			randomAccess.setPosition( cursor );
			( ( Type ) cursor.get() ).set( ( Type ) randomAccess.get() );
		}

		return target;
	}
}
 
开发者ID:fiji,项目名称:MaMuT,代码行数:55,代码来源:MamutUtils.java


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