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


Java FinalInterval.createMinSize方法代码示例

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


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

示例1: show

import net.imglib2.FinalInterval; //导入方法依赖的package包/类
public static void show( final String[] args ) throws ImgIOException
{
	ImageJ.main( args );
	final File file = new File( "/Users/tinevez/Desktop/iconas/Data/Uneven.tif" );
	final SCIFIOImgPlus img = new ImgOpener().openImgs( file.getAbsolutePath() ).get( 0 );

	final Shape strel = new HyperSphereShape( 5 );

	/*
	 * To new Img
	 */

	ImageJFunctions.show( img, "Source" );

	final Img topHat = TopHat.topHat( img, strel, 1 );
	ImageJFunctions.show( topHat, "WhiteTopHatToNewImg" );


	/*
	 * In place
	 */

	final Interval interval = FinalInterval.createMinSize( new long[] { 30, 50, 88, 32 } );
	final Img copy = img.copy();
	TopHat.topHatInPlace( copy, interval, strel, 1 );
	ImageJFunctions.show( copy, "WhiteTopHatInPlace" );

	/*
	 * To target
	 */

	final Img img2 = img.factory().create( interval, new UnsignedByteType() );
	final long[] translation = new long[ interval.numDimensions() ];
	interval.min( translation );
	final IntervalView translate = Views.translate( img2, translation );
	TopHat.topHat( img, translate, strel, 1 );
	ImageJFunctions.show( img2, "WhiteTopHatToTarget" );

}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:40,代码来源:TopHatTests.java

示例2: chain

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

示例3: show

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

示例4: main

import net.imglib2.FinalInterval; //导入方法依赖的package包/类
public static void main( final String[] args ) throws ImgIOException
{
	ImageJ.main( args );
	final File file = new File( "DrosophilaWing.tif" );
	final SCIFIOImgPlus img = new ImgOpener().openImgs( file.getAbsolutePath() ).get( 0 );
	final Img< UnsignedByteType > imgInv = img.copy();
	final Cursor< UnsignedByteType > cursor = img.cursor();
	final Cursor< UnsignedByteType > cursor2 = imgInv.cursor();
	while ( cursor.hasNext() )
	{
		cursor.fwd();
		cursor2.fwd();
		cursor2.get().set( 255 - cursor.get().get() );
	}

	final Shape strel = new HyperSphereShape( 5 );

	/*
	 * To new Img
	 */

	ImageJFunctions.show( imgInv, "Source" );

	final Img blackTopHat = BlackTopHat.blackTopHat( imgInv, strel, 1 );
	ImageJFunctions.show( blackTopHat, "BlackTopHatToNewImg" );

	/*
	 * In place
	 */

	final Interval interval = FinalInterval.createMinSize( new long[] { 7, 35, 88, 32 } );

	final Img copy2 = imgInv.copy();
	BlackTopHat.blackTopHatInPlace( copy2, interval, strel, 1 );
	ImageJFunctions.show( copy2, "BlackTopHatInPlace" );

	/*
	 * To target
	 */

	final Img img2 = img.factory().create( interval, new UnsignedByteType() );
	final long[] translation = new long[ interval.numDimensions() ];
	interval.min( translation );
	final IntervalView translate = Views.translate( img2, translation );
	BlackTopHat.blackTopHat( imgInv, translate, strel, 1 );
	ImageJFunctions.show( img2, "BlackTopHatToTarget" );

}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:49,代码来源:BlackTopHatTests.java

示例5: chain

import net.imglib2.FinalInterval; //导入方法依赖的package包/类
private static void chain( final String[] args )
{
	ImageJ.main( args );

	final ArrayImg< UnsignedByteType, ByteArray > img = ArrayImgs.unsignedBytes( 50l, 50l );
	for ( final UnsignedByteType pixel : img )
	{
		pixel.set( 255 );
	}
	final ArrayRandomAccess< UnsignedByteType > randomAccess = img.randomAccess();
	randomAccess.setPosition( new int[] { 0, 25 } );
	randomAccess.get().set( 0 );
	randomAccess.setPosition( new int[] { 35, 25 } );
	randomAccess.get().set( 0 );

	final DiamondShape diamondShape = new DiamondShape( 8 );
	ImageJFunctions.show( img, "Source" );

	// New Source
	ImageJFunctions.show( Erosion.erode( img, StructuringElements.diamond( 8, 2, true ), 1 ), "NewSourceDecomp" );
	ImageJFunctions.show( Erosion.erode( img, StructuringElements.diamond( 8, 2, false ), 1 ), "NewSourceStraight" );
	ImageJFunctions.show( Erosion.erode( img, diamondShape, 1 ), "NewSourceSingle" );

	// Full
	ImageJFunctions.show( Erosion.erodeFull( img, StructuringElements.diamond( 8, 2, true ), 1 ), "NewFullSourceDecomp" );
	ImageJFunctions.show( Erosion.erodeFull( img, StructuringElements.diamond( 8, 2, false ), 1 ), "NewFullSourceStraight" );
	ImageJFunctions.show( Erosion.erodeFull( img, diamondShape, 1 ), "NewFullSourceSingle" );

	// To target
	final Interval interval = FinalInterval.createMinSize( 10, 10, 20, 20 );
	final long[] min = new long[ interval.numDimensions() ];
	interval.min( min );

	final Img< UnsignedByteType > result1 = img.factory().create( interval, img.firstElement().copy() );
	final IntervalView< UnsignedByteType > target1 = Views.translate( result1, min );
	Erosion.erode( img, target1, StructuringElements.diamond( 8, 2, true ), 1 );
	ImageJFunctions.show( result1, "ToTargetDecomp" );

	final Img< UnsignedByteType > result2 = img.factory().create( interval, img.firstElement().copy() );
	final IntervalView< UnsignedByteType > target2 = Views.translate( result2, min );
	Erosion.erode( img, target2, StructuringElements.diamond( 8, 2, false ), 1 );
	ImageJFunctions.show( result2, "ToTargetStraight" );

	final Img< UnsignedByteType > result3 = img.factory().create( interval, img.firstElement().copy() );
	final IntervalView< UnsignedByteType > target3 = Views.translate( result3, min );
	Erosion.erode( img, target3, diamondShape, 1 );
	ImageJFunctions.show( result3, "ToTargetSingle" );

}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:50,代码来源:ErosionTests.java

示例6: show

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

		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 } );
//		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( 255f );
//		}

		ImageJFunctions.show( img, "Source" );

		// Dilate 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 );
		Dilation.dilate( img, translate, strel, 1 );
		ImageJFunctions.show( img2, "DilatedToTarget" );

		// Dilate to new image
		final Img< FloatType > img3 = Dilation.dilate( img, strel, 1 );
		ImageJFunctions.show( img3, "DilatedToNewImg" );

		// Dilate to new image FULL version.
		final Img< FloatType > img4 = Dilation.dilateFull( img, strel, 1 );
		ImageJFunctions.show( img4, "DilatedToNewImgFULL" );

		// Dilate in place
		final Interval interval = FinalInterval.createMinSize( new long[] { 100, -10, 200, 200 } );
		Dilation.dilateInPlace( img, interval, strel, 1 );
		ImageJFunctions.show( img, "DilatedInPlace" );

		/*
		 * Binary type
		 */

		final ArrayImg< BitType, LongArray > bitsImg = ArrayImgs.bits( new long[] { 800, 600 } );

		final ArrayRandomAccess< BitType > raBits = bitsImg.randomAccess(); // LOL
		final Random ran2 = new Random( 1l );
		for ( int i = 0; i < 100; i++ )
		{
			final int x = ran2.nextInt( ( int ) bitsImg.dimension( 0 ) );
			final int y = ran2.nextInt( ( int ) bitsImg.dimension( 1 ) );
			raBits.setPosition( new int[] { x, y } );
			raBits.get().set( true );
		}
		ImageJFunctions.show( bitsImg, "BitsSource" );

		// Dilate to new image
		final Img< BitType > imgBits3 = Dilation.dilate( bitsImg, strel, 1 );
		ImageJFunctions.show( imgBits3, "BitsDilatedToNewImg" );

	}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:69,代码来源:DilationTests.java

示例7: chain

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

示例8: show

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


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