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


Java Views.extendZero方法代码示例

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


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

示例1: chain

import net.imglib2.view.Views; //导入方法依赖的package包/类
public static void chain( final String[] args ) throws ImgIOException
	{
		final List< Shape > strel = StructuringElements.disk( 6, 2, 4 );
		for ( final Shape shape : strel )
		{
			System.out.println( shape );
			System.out.println( MorphologyUtils.printNeighborhood( shape, 2 ) );
		}

		ImageJ.main( args );

		final String fn = "DrosophilaWing.tif";
		final List< SCIFIOImgPlus< FloatType >> imgs = new
				ImgOpener().openImgs( fn, new ArrayImgFactory< FloatType >(), new
						FloatType() );
		final Img< FloatType > img = imgs.get( 0 ).getImg();

//		final ArrayImg< FloatType, FloatArray > img = ArrayImgs.floats( new long[] { 800, 600 } );
//		for ( final FloatType pixel : img )
//		{
//			pixel.set( 255f );
//		}
//		final ArrayRandomAccess< FloatType > ra = img.randomAccess();
//		final Random ran = new Random( 1l );
//		for ( int i = 0; i < 100; i++ )
//		{
//			final int x = ran.nextInt( ( int ) img.dimension( 0 ) );
//			final int y = ran.nextInt( ( int ) img.dimension( 1 ) );
//			ra.setPosition( new int[] { x, y } );
//			ra.get().set( 0f );
//		}

		ImageJFunctions.show( img, "Source" );

		final ExtendedRandomAccessibleInterval< FloatType, Img< FloatType >> extendZero = Views.extendZero( img );

		// Open to provided target
		final Interval interval2 = FinalInterval.createMinSize( new long[] { 280, 200, 185, 100 } );
		final Img< FloatType > img2 = img.factory().create( interval2, new FloatType() );
		final long[] translation = new long[ interval2.numDimensions() ];
		interval2.min( translation );
		final IntervalView< FloatType > translate = Views.translate( img2, translation );
		Opening.open( extendZero, translate, strel, 1 );
		ImageJFunctions.show( img2, "OpenedToTarget" );

		// Open to new image
		final Img< FloatType > img3 = Opening.open( img, strel, 1 );
		ImageJFunctions.show( img3, "OpenedToNewImg" );

		// Open in place
		final Interval interval = FinalInterval.createMinSize( new long[] { 100, -10, 200, 200 } );
		Opening.openInPlace( img, interval, strel, 1 );
		ImageJFunctions.show( img, "OpenedInPlace" );

		// BitType
		final Img< BitType > bitImg = Thresholder.threshold( img, new FloatType( 200f ), true, 1 );
		ImageJFunctions.show( bitImg, "BitSource" );

		final ExtendedRandomAccessibleInterval< BitType, Img< BitType >> bitExtendZero = Views.extendZero( bitImg );

		// Open to provided target
		final Img< BitType > bitImg2 = bitImg.factory().create( interval2, new BitType() );
		interval2.min( translation );
		final IntervalView< BitType > bitTranslate = Views.translate( bitImg2, translation );
		Opening.open( bitExtendZero, bitTranslate, strel, 1 );
		ImageJFunctions.show( bitImg2, "BitOpenedToTarget" );

		// Open to new image
		final Img< BitType > bitImg3 = Opening.open( bitImg, strel, 1 );
		ImageJFunctions.show( bitImg3, "bitOpenedToNewImg" );

		// Open in place
		Opening.openInPlace( bitImg, interval, strel, 1 );
		ImageJFunctions.show( bitImg, "OpenedInPlace" );
	}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:76,代码来源:OpeningTests.java

示例2: show

import net.imglib2.view.Views; //导入方法依赖的package包/类
public static void show( final String[] args ) throws ImgIOException
	{
		ImageJ.main( args );
//		final Shape strel = new DiamondShape( 3 );
		final Shape strel = new HyperSphereShape( 6 );

		final String fn = "DrosophilaWing.tif";
		final List< SCIFIOImgPlus< FloatType >> imgs = new
				ImgOpener().openImgs( fn, new ArrayImgFactory< FloatType >(), new
						FloatType() );
		final Img< FloatType > img = imgs.get( 0 ).getImg();

//		final ArrayImg< FloatType, FloatArray > img = ArrayImgs.floats( new long[] { 800, 600 } );
//		for ( final FloatType pixel : img )
//		{
//			pixel.set( 255f );
//		}
//		final ArrayRandomAccess< FloatType > ra = img.randomAccess();
//		final Random ran = new Random( 1l );
//		for ( int i = 0; i < 100; i++ )
//		{
//			final int x = ran.nextInt( ( int ) img.dimension( 0 ) );
//			final int y = ran.nextInt( ( int ) img.dimension( 1 ) );
//			ra.setPosition( new int[] { x, y } );
//			ra.get().set( 0f );
//		}

		ImageJFunctions.show( img, "Source" );

		final ExtendedRandomAccessibleInterval< FloatType, Img< FloatType >> extendZero = Views.extendZero( img );

		// Open to provided target
		final Interval interval2 = FinalInterval.createMinSize( new long[] { 280, 200, 185, 100 } );
		final Img< FloatType > img2 = img.factory().create( interval2, new FloatType() );
		final long[] translation = new long[ interval2.numDimensions() ];
		interval2.min( translation );
		final IntervalView< FloatType > translate = Views.translate( img2, translation );
		Opening.open( extendZero, translate, strel, 1 );
		ImageJFunctions.show( img2, "OpenedToTarget" );

		// Open to new image
		final Img< FloatType > img3 = Opening.open( img, strel, 1 );
		ImageJFunctions.show( img3, "OpenedToNewImg" );

		// Open in place
		final Interval interval = FinalInterval.createMinSize( new long[] { 100, -10, 200, 200 } );
		Opening.openInPlace( img, interval, strel, 1 );
		ImageJFunctions.show( img, "OpenedInPlace" );

		// BitType
		final Img< BitType > bitImg = Thresholder.threshold( img, new FloatType( 200f ), true, 1 );
		ImageJFunctions.show( bitImg, "BitSource" );

		final ExtendedRandomAccessibleInterval< BitType, Img< BitType >> bitExtendZero = Views.extendZero( bitImg );

		// Open to provided target
		final Img< BitType > bitImg2 = bitImg.factory().create( interval2, new BitType() );
		interval2.min( translation );
		final IntervalView< BitType > bitTranslate = Views.translate( bitImg2, translation );
		Opening.open( bitExtendZero, bitTranslate, strel, 1 );
		ImageJFunctions.show( bitImg2, "BitOpenedToTarget" );

		// Open to new image
		final Img< BitType > bitImg3 = Opening.open( bitImg, strel, 1 );
		ImageJFunctions.show( bitImg3, "bitOpenedToNewImg" );

		// Open in place
		Opening.openInPlace( bitImg, interval, strel, 1 );
		ImageJFunctions.show( bitImg, "OpenedInPlace" );
	}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:71,代码来源:OpeningTests.java

示例3: chain

import net.imglib2.view.Views; //导入方法依赖的package包/类
public static void chain( final String[] args ) throws ImgIOException
	{
		final List< Shape > strel = StructuringElements.disk( 6, 2, 4 );
		for ( final Shape shape : strel )
		{
			System.out.println( shape );
			System.out.println( MorphologyUtils.printNeighborhood( shape, 2 ) );
		}

		ImageJ.main( args );

		final String fn = "DrosophilaWing.tif";
		final List< SCIFIOImgPlus< UnsignedByteType >> imgs = new
				ImgOpener().openImgs( fn, new ArrayImgFactory< UnsignedByteType >(), new
						UnsignedByteType() );
		final Img< UnsignedByteType > img = imgs.get( 0 ).getImg();

//		final ArrayImg< UnsignedByteType, FloatArray > img = ArrayImgs.floats( new long[] { 800, 600 } );
//		for ( final UnsignedByteType pixel : img )
//		{
//			pixel.set( 255f );
//		}
//		final ArrayRandomAccess< UnsignedByteType > ra = img.randomAccess();
//		final Random ran = new Random( 1l );
//		for ( int i = 0; i < 100; i++ )
//		{
//			final int x = ran.nextInt( ( int ) img.dimension( 0 ) );
//			final int y = ran.nextInt( ( int ) img.dimension( 1 ) );
//			ra.setPosition( new int[] { x, y } );
//			ra.get().set( 0f );
//		}

		ImageJFunctions.show( img, "Source" );

		final ExtendedRandomAccessibleInterval< UnsignedByteType, Img< UnsignedByteType >> extendZero = Views.extendZero( img );

		// Close to provided target
		final Interval interval2 = FinalInterval.createMinSize( new long[] { 280, 200, 185, 100 } );
		final Img< UnsignedByteType > img2 = img.factory().create( interval2, new UnsignedByteType() );
		final long[] translation = new long[ interval2.numDimensions() ];
		interval2.min( translation );
		final IntervalView< UnsignedByteType > translate = Views.translate( img2, translation );
		Closing.close( extendZero, translate, strel, 1 );
		ImageJFunctions.show( img2, "ClosedToTarget" );

		// Close to new image
		final Img< UnsignedByteType > img3 = Closing.close( img, strel, 1 );
		ImageJFunctions.show( img3, "ClosedToNewImg" );

		// Close in place
		final Interval interval = FinalInterval.createMinSize( new long[] { 100, -10, 200, 200 } );
		Closing.closeInPlace( img, interval, strel, 1 );
		ImageJFunctions.show( img, "ClosedInPlace" );

		// BitType
		final Img< BitType > bitImg = Thresholder.threshold( img, new UnsignedByteType( 100 ), true, 1 );
		ImageJFunctions.show( bitImg, "BitSource" );

		final ExtendedRandomAccessibleInterval< BitType, Img< BitType >> bitExtendZero = Views.extendZero( bitImg );

		// Close to provided target
		final Img< BitType > bitImg2 = bitImg.factory().create( interval2, new BitType() );
		interval2.min( translation );
		final IntervalView< BitType > bitTranslate = Views.translate( bitImg2, translation );
		Closing.close( bitExtendZero, bitTranslate, strel, 1 );
		ImageJFunctions.show( bitImg2, "BitClosedToTarget" );

		// Close to new image
		final Img< BitType > bitImg3 = Closing.close( bitImg, strel, 1 );
		ImageJFunctions.show( bitImg3, "bitClosedToNewImg" );

		// Close in place
		Closing.closeInPlace( bitImg, interval, strel, 1 );
		ImageJFunctions.show( bitImg, "ClosedInPlace" );
	}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:76,代码来源:ClosingTests.java

示例4: show

import net.imglib2.view.Views; //导入方法依赖的package包/类
public static void show( final String[] args ) throws ImgIOException
	{
		ImageJ.main( args );
		final Shape strel = new DiamondShape( 3 );
//		final Shape strel = new HyperSphereShape( 6 );

		final String fn = "DrosophilaWing.tif";
		final List< SCIFIOImgPlus< UnsignedByteType >> imgs = new
				ImgOpener().openImgs( fn, new ArrayImgFactory< UnsignedByteType >(), new
						UnsignedByteType() );
		final Img< UnsignedByteType > img = imgs.get( 0 ).getImg();

//		final ArrayImg< UnsignedByteType, FloatArray > img = ArrayImgs.floats( new long[] { 800, 600 } );
//		for ( final UnsignedByteType pixel : img )
//		{
//			pixel.set( 255f );
//		}
//		final ArrayRandomAccess< UnsignedByteType > ra = img.randomAccess();
//		final Random ran = new Random( 1l );
//		for ( int i = 0; i < 100; i++ )
//		{
//			final int x = ran.nextInt( ( int ) img.dimension( 0 ) );
//			final int y = ran.nextInt( ( int ) img.dimension( 1 ) );
//			ra.setPosition( new int[] { x, y } );
//			ra.get().set( 0f );
//		}

		ImageJFunctions.show( img, "Source" );

		final ExtendedRandomAccessibleInterval< UnsignedByteType, Img< UnsignedByteType >> extendZero = Views.extendZero( img );

		// Close to provided target
		final Interval interval2 = FinalInterval.createMinSize( new long[] { 280, 200, 185, 100 } );
		final Img< UnsignedByteType > img2 = img.factory().create( interval2, new UnsignedByteType() );
		final long[] translation = new long[ interval2.numDimensions() ];
		interval2.min( translation );
		final IntervalView< UnsignedByteType > translate = Views.translate( img2, translation );
		Closing.close( extendZero, translate, strel, 1 );
		ImageJFunctions.show( img2, "ClosedToTarget" );

		// Close to new image
		final Img< UnsignedByteType > img3 = Closing.close( img, strel, 1 );
		ImageJFunctions.show( img3, "ClosedToNewImg" );

		// Close in place
		final Interval interval = FinalInterval.createMinSize( new long[] { 100, -10, 200, 200 } );
		Closing.closeInPlace( img, interval, strel, 1 );
		ImageJFunctions.show( img, "ClosedInPlace" );

		// BitType
		final Img< BitType > bitImg = Thresholder.threshold( img, new UnsignedByteType( 100 ), true, 1 );
		ImageJFunctions.show( bitImg, "BitSource" );

		final ExtendedRandomAccessibleInterval< BitType, Img< BitType >> bitExtendZero = Views.extendZero( bitImg );

		// Close to provided target
		final Img< BitType > bitImg2 = bitImg.factory().create( interval2, new BitType() );
		interval2.min( translation );
		final IntervalView< BitType > bitTranslate = Views.translate( bitImg2, translation );
		Closing.close( bitExtendZero, bitTranslate, strel, 1 );
		ImageJFunctions.show( bitImg2, "BitClosedToTarget" );

		// Close to new image
		final Img< BitType > bitImg3 = Closing.close( bitImg, strel, 1 );
		ImageJFunctions.show( bitImg3, "bitClosedToNewImg" );

		// Close in place
		Closing.closeInPlace( bitImg, interval, strel, 1 );
		ImageJFunctions.show( bitImg, "ClosedInPlace" );
	}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:71,代码来源:ClosingTests.java

示例5: calculate

import net.imglib2.view.Views; //导入方法依赖的package包/类
@Override
public ExtendedRandomAccessibleInterval<T, F> calculate(F input) {
	return Views.extendZero(input);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:5,代码来源:DefaultExtendZeroView.java

示例6: getImgPatch

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


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