• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ImagePlusImgFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.imglib2.img.imageplus.ImagePlusImgFactory的典型用法代码示例。如果您正苦于以下问题:Java ImagePlusImgFactory类的具体用法?Java ImagePlusImgFactory怎么用?Java ImagePlusImgFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ImagePlusImgFactory类属于net.imglib2.img.imageplus包,在下文中一共展示了ImagePlusImgFactory类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: copyToFloatImagePlus

import net.imglib2.img.imageplus.ImagePlusImgFactory; //导入依赖的package包/类
/** Copy the contents from img to an ImagePlus; assumes containers are compatible. */
static public ImagePlus copyToFloatImagePlus(final Img<? extends RealType<?>> img, final String title) {
	ImagePlusImgFactory<FloatType> factory = new ImagePlusImgFactory<FloatType>();
	ImagePlusImg<FloatType, ?> iml = factory.create(img, new FloatType());
	Cursor<FloatType> c1 = iml.cursor();
	Cursor<? extends RealType<?>> c2 = img.cursor();
	while (c1.hasNext()) {
		c1.fwd();
		c2.fwd();
		c1.get().set(c2.get().getRealFloat());
	}
	try {
		ImagePlus imp = iml.getImagePlus();
		imp.setTitle(title);
		return imp;
	} catch (ImgLibException e) {
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:imglib,项目名称:imglib2-script,代码行数:21,代码来源:Benchmark.java


示例2: copyToImagePlus

import net.imglib2.img.imageplus.ImagePlusImgFactory; //导入依赖的package包/类
public static < T extends NativeType< T >> ImagePlusImg<T, ?> copyToImagePlus(
 		RandomAccessible<T> img,
 		IterableInterval<?> interval
 ) throws Exception {


   ImagePlusImgFactory<T> factory = new ImagePlusImgFactory<T>();
   T t = img.randomAccess().get();
   ImagePlusImg<T, ?> ipImg = factory.create(interval,t);

   logger.debug("create image plus of type: " + t.getClass());
   logger.debug("result is of type: " + ipImg.firstElement().getClass());

   Cursor<T> c_in  = ipImg.cursor();
   RandomAccess<T> ra = img.randomAccess();

   while(c_in.hasNext()){
      c_in.fwd();
      ra.setPosition(c_in);
      ra.get().set(c_in.get());
   }

   return ipImg;

}
 
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:26,代码来源:ImgOps.java


示例3: copyToImageStack

import net.imglib2.img.imageplus.ImagePlusImgFactory; //导入依赖的package包/类
public static < T extends NumericType< T > & NativeType< T > > ImagePlus copyToImageStack( final RealRandomAccessible< T > rai, final Interval itvl )
{
	final long[] dimensions = new long[ itvl.numDimensions() ];
	itvl.dimensions( dimensions );

	// create the image plus image
	final T t = rai.realRandomAccess().get();
	final ImagePlusImgFactory< T > factory = new ImagePlusImgFactory< T >();
	final ImagePlusImg< T, ? > target = factory.create( itvl, t );

	double k = 0;
	final long N = dimensions[ 0 ] * dimensions[ 1 ] * dimensions[ 2 ];

	final net.imglib2.Cursor< T > c = target.cursor();
	final RealRandomAccess< T > ra = rai.realRandomAccess();
	while ( c.hasNext() )
	{
		c.fwd();
		ra.setPosition( c );
		c.get().set( ra.get() );

		if ( k % 10000 == 0 )
		{
			IJ.showProgress( k / N );
		}
		k++;
	}

	IJ.showProgress( 1.1 );
	try
	{
		return target.getImagePlus();
	}
	catch ( final ImgLibException e )
	{
		e.printStackTrace();
	}

	return null;
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:41,代码来源:BigWarpRealExporter.java


示例4: createImagePlusImage

import net.imglib2.img.imageplus.ImagePlusImgFactory; //导入依赖的package包/类
private ByteImagePlus<UnsignedByteType> createImagePlusImage(final ImageProcessor ip) {
	if ( dimensions.length == 1 )
		return null;
	if ( ip != null )
	{
		final ImagePlus imp = new ImagePlus("image", ip);
		return ImagePlusAdapter.wrapByte(imp);
	}
	if ( dimensions[ 0 ] * dimensions[ 1 ] > Integer.MAX_VALUE )
		return null;
	if ( numDimensions > 5 )
		return null;
	final ByteImagePlus<UnsignedByteType> imagePlusContainer = ( ByteImagePlus<UnsignedByteType> ) createImage( dimensions, new ImagePlusImgFactory< UnsignedByteType >() );
	return imagePlusContainer;
}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:16,代码来源:ImglibBenchmark.java


示例5: debugVisEdgelView

import net.imglib2.img.imageplus.ImagePlusImgFactory; //导入依赖的package包/类
public void debugVisEdgelView(int i, Edgel e, Edgel f){
		RandomAccessible<T> ev = 
				EdgelTools.edgelToView(e, img, patchSize);
		
		RandomAccessible<T> fv = 
				EdgelTools.edgelToView(f, img, patchSize);
		
//		ArrayImgFactory<T> ubfactory = new ArrayImgFactory<T>();
		ImagePlusImgFactory<T> ipfactory = new ImagePlusImgFactory<T>(); 
		
		Img<T> ePatchImg = ipfactory.create(patchSize, mask.firstElement());
		Img<T> fPatchImg = ipfactory.create(patchSize, mask.firstElement());
		
		logger.debug( " copying " );
		ImgOps.copyInto(ev, ePatchImg);
		ImgOps.copyInto(fv, fPatchImg);
		logger.debug( " done copying " );
		
		logger.debug( " writing patches " );
		
		ImgOps.writeFloat( ePatchImg, 
				String.format("%s/patch_%03d_%s_.tif", debugDir, debugSuffix, i));
		
		ImgOps.writeFloat( fPatchImg, 
				String.format("%s/patch_%03d_match_%s_.tif",debugDir, debugSuffix, i));
		
		logger.debug( " done writing patches " );
	}
 
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:29,代码来源:EdgelMatching.java


示例6: testPca

import net.imglib2.img.imageplus.ImagePlusImgFactory; //导入依赖的package包/类
@Test
	public void testPca(){
	System.out.println("testPcaReg");
		
		int[] sz = new int[]{ 27,27,27 };
		double[] ctr = ArrayUtil.toDouble( PatchTools.patchSizeToMidpt( sz ));
		double[] sigs = new double[]{1, 10, 0.1};
//		double mint = -1;
//		double maxt = 1.5;
		double mint = -1;
		double maxt = 9e20;
		
		ImagePlusImgFactory<FloatType> factory = new ImagePlusImgFactory<FloatType>();
		
		Img<FloatType> img = ImgOps.createGaussianEllipseImg(factory, sz, ctr, sigs, mint, maxt, new FloatType());
		ImgOps.writeFloat(img, "/groups/jain/home/bogovicj/projects/crackPatching/toyData/ellipseImg.tif");

		AffineTransform3D xfm = TransformTools.rotationCentered(2, Math.PI/8, ctr);
		RealTransformRandomAccessible<FloatType, InverseRealTransform> imgXfm = 
				TransformTools.xfmToView(xfm, 
						Views.extendZero(img), new NLinearInterpolatorFactory<FloatType>());

		ImagePlusImg<FloatType, ?> imgXfmOut = factory.create(img, img.firstElement());
		ImgOps.copyInto( imgXfm, imgXfmOut);

		ImgMoment tgtMom = new ImgMoment();
		double[] tgtOr = tgtMom.orientation(imgXfmOut);
		tgtMom.orientationEvalsEvecs(tgtOr);
		
		System.out.println("tgt or: " + ArrayUtil.printArray(tgtOr));
		System.out.println("tgt cent: " + ArrayUtil.printArray(tgtMom.centroid()));
		
		
		DenseMatrix64F srcR = new DenseMatrix64F( 3, 3 );
		srcR.setData( tgtMom.getEvecs() );
		DenseMatrix64F srcMtx = TransformTools.rotationCenteredMtx(srcR, tgtMom.centroid());
	
	}
 
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:39,代码来源:TestPcaRotReg.java


示例7: display

import net.imglib2.img.imageplus.ImagePlusImgFactory; //导入依赖的package包/类
public static void display( final AbstractSpimData< ? > spimData, final ViewId viewId, final int pixelType, final String name, final boolean virtual )
{
	final ImgLoader imgLoader = (ImgLoader)spimData.getSequenceDescription().getImgLoader();
	final ImgFactory< ? extends NativeType< ? > > factory;
	final AbstractImgFactoryImgLoader il;

	// load as ImagePlus directly if possible
	if ( AbstractImgFactoryImgLoader.class.isInstance( imgLoader ) )
	{
		il = (AbstractImgFactoryImgLoader)imgLoader;
		factory = il.getImgFactory();
		il.setImgFactory( new ImagePlusImgFactory< FloatType >());
	}
	else
	{
		il = null;
		factory = null;
	}

	// display it
	DisplayImage export = new DisplayImage( virtual );
	
	if ( pixelType == 0 )
		export.exportImage( ((ImgLoader)spimData.getSequenceDescription().getImgLoader()).getSetupImgLoader( viewId.getViewSetupId() ).getFloatImage( viewId.getTimePointId(), false ), name );
	else
	{
		@SuppressWarnings( "unchecked" )
		RandomAccessibleInterval< UnsignedShortType > img =
			( RandomAccessibleInterval< UnsignedShortType > ) ((ImgLoader)spimData.getSequenceDescription().getImgLoader()).getSetupImgLoader( viewId.getViewSetupId() ).getImage( viewId.getTimePointId() );
		export.exportImage( img, name );
	}

	if ( factory != null && il != null )
		il.setImgFactory( factory );
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:36,代码来源:Display_View.java


示例8: getImgFactory

import net.imglib2.img.imageplus.ImagePlusImgFactory; //导入依赖的package包/类
public < T extends ComplexType< T > & NativeType < T > > ImgFactory< T > getImgFactory( final T type )
{
	final ImgFactory< T > imgFactory;
	
	if ( this.getImgType() == 0 )
		imgFactory = new ArrayImgFactory< T >();
	else if ( this.getImgType() == 1 )
		imgFactory = new ImagePlusImgFactory< T >();
	else
		imgFactory = new CellImgFactory<T>( 256 );

	return imgFactory;
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:14,代码来源:BoundingBoxGUI.java


示例9: createReRegisteredSeries

import net.imglib2.img.imageplus.ImagePlusImgFactory; //导入依赖的package包/类
public static < T extends RealType< T > & NativeType< T > > ImagePlus createReRegisteredSeries( final T targetType, final ImagePlus imp, final ArrayList<InvertibleBoundable> models, final int dimensionality )
{
	final int numImages = imp.getNFrames();

	// the size of the new image
	final int[] size = new int[ dimensionality ];
	// the offset relative to the output image which starts with its local coordinates (0,0,0)
	final double[] offset = new double[ dimensionality ];

	final int[][] imgSizes = new int[ numImages ][ dimensionality ];
	
	for ( int i = 0; i < numImages; ++i )
	{
		imgSizes[ i ][ 0 ] = imp.getWidth();
		imgSizes[ i ][ 1 ] = imp.getHeight();
		if ( dimensionality == 3 )
			imgSizes[ i ][ 2 ] = imp.getNSlices();
	}
	
	// estimate the boundaries of the output image and the offset for fusion (negative coordinates after transform have to be shifted to 0,0,0)
	Fusion.estimateBounds( offset, size, imgSizes, models, dimensionality );
			
	// for output
	final ImgFactory< T > f = new ImagePlusImgFactory< T >();
	// the composite
	final ImageStack stack = new ImageStack( size[ 0 ], size[ 1 ] );

	for ( int t = 1; t <= numImages; ++t )
	{
		for ( int c = 1; c <= imp.getNChannels(); ++c )
		{
			final Img<T> out = f.create( size, targetType );
			final Img< FloatType > in = ImageJFunctions.convertFloat( Hyperstack_rearranger.getImageChunk( imp, c, t ) );

			fuseChannel( out, Views.interpolate( Views.extendZero( in ), new NLinearInterpolatorFactory< FloatType >() ), offset, models.get( t - 1 ) );

			try
			{
				final ImagePlus outImp = ((ImagePlusImg<?,?>)out).getImagePlus();
				for ( int z = 1; z <= out.dimension( 2 ); ++z )
					stack.addSlice( imp.getTitle(), outImp.getStack().getProcessor( z ) );
			} 
			catch (ImgLibException e) 
			{
				Log.error( "Output image has no ImageJ type: " + e );
			}				
		}
	}
	
	//convertXYZCT ...
	ImagePlus result = new ImagePlus( "registered " + imp.getTitle(), stack );
	
	// numchannels, z-slices, timepoints (but right now the order is still XYZCT)
	if ( dimensionality == 3 )
	{
		result.setDimensions( size[ 2 ], imp.getNChannels(), imp.getNFrames() );
		result = OverlayFusion.switchZCinXYCZT( result );
		return CompositeImageFixer.makeComposite( result, CompositeImage.COMPOSITE );
	}
	//Log.info( "ch: " + imp.getNChannels() );
	//Log.info( "slices: " + imp.getNSlices() );
	//Log.info( "frames: " + imp.getNFrames() );
	result.setDimensions( imp.getNChannels(), 1, imp.getNFrames() );
	
	if ( imp.getNChannels() > 1 )
		return CompositeImageFixer.makeComposite( result, CompositeImage.COMPOSITE );
	return result;
}
 
开发者ID:fiji,项目名称:Stitching,代码行数:69,代码来源:OverlayFusion.java


示例10: main

import net.imglib2.img.imageplus.ImagePlusImgFactory; //导入依赖的package包/类
final static public void main( final String[] args )
	{
		long t;

//		final int[] samples = new int[ m ];
//		final double[][] coordinates = new double[ m ][ 2 ];
		
//		createPhyllotaxis1( samples, coordinates, size[ 0 ] / 2.0, size[ 1 ] / 2.0, 0.1 );
//		createPattern2( samples, coordinates, size[ 0 ] / 2.0, size[ 1 ] / 2.0, 20 );
		
//		final RealPointSampleList< UnsignedShortType > list = new RealPointSampleList< UnsignedShortType >( 2 );
//		for ( int i = 0; i < samples.length; ++i )
//			list.add( new RealPoint( coordinates[ i ] ), new UnsignedShortType( samples[ i ] ) );

		final RealPointSampleList< UnsignedShortType > list = new RealPointSampleList< UnsignedShortType >( 3 );

		createPhyllotaxis2( list, m, size[ 0 ] / 2.0, size[ 1 ] / 2.0, 20 );

		final ImagePlusImgFactory< UnsignedShortType > factory = new ImagePlusImgFactory< UnsignedShortType >();

		final KDTree< UnsignedShortType > kdtree = new KDTree< UnsignedShortType >( list );

		new ImageJ();

		
		IJ.log( "KDTree Search" );
		IJ.log( "=============" );
		
		/* nearest neighbor */
		IJ.log( "Nearest neighbor ..." );
		final ImagePlusImg< UnsignedShortType, ? > img4 = factory.create( new long[]{ size[ 0 ], size[ 1 ], 2 }, new UnsignedShortType() );
		t = drawNearestNeighbor(
				img4,
				new NearestNeighborSearchOnKDTree< UnsignedShortType >( kdtree ) );
		
		IJ.log( t + "ms " );
		
		try
		{
			final ImagePlus imp4 = img4.getImagePlus();
			imp4.setOpenAsHyperStack( true );
			final CompositeImage impComposite = new CompositeImage( imp4, CompositeImage.COMPOSITE );
			impComposite.show();
			impComposite.setSlice( 1 );
			IJ.run( impComposite, "Grays", "" );
			impComposite.setDisplayRange( 0, m - 1 );
			impComposite.setSlice( 2 );
			impComposite.setDisplayRange( 0, 2 );
			impComposite.updateAndDraw();
			IJ.log( "Done." );
		}
		catch ( final ImgLibException e )
		{
			IJ.log( "Didn't work out." );
			e.printStackTrace();
		}
	}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:58,代码来源:KNearestNeighborSearchPhyllotaxisBehavior.java


示例11: testPcaReg

import net.imglib2.img.imageplus.ImagePlusImgFactory; //导入依赖的package包/类
@Test
	public void testPcaReg(){
		
		System.out.println("testPcaReg");
		
		int[] sz = new int[]{ 27,27,27 };
		double[] ctr = ArrayUtil.toDouble( PatchTools.patchSizeToMidpt( sz ));
		double[] sigs = new double[]{1, 10, 0.1};
//		double mint = -1;
//		double maxt = 1.5;
		double mint = -1;
		double maxt = 9e20;
		
		ImagePlusImgFactory<FloatType> factory = new ImagePlusImgFactory<FloatType>();
		
		Img<FloatType> img = ImgOps.createGaussianEllipseImg(factory, sz, ctr, sigs, mint, maxt, new FloatType());
		ImgOps.writeFloat(img, "/groups/jain/home/bogovicj/projects/crackPatching/toyData/ellipseImg.tif");

		AffineTransform3D xfm = TransformTools.rotationCentered(2, Math.PI/8, ctr);
		RealTransformRandomAccessible<FloatType, InverseRealTransform> imgXfm = 
				TransformTools.xfmToView(xfm, 
						Views.extendZero(img), new NLinearInterpolatorFactory<FloatType>());

		ImagePlusImg<FloatType, ?> imgXfmOut = factory.create(img, img.firstElement());
		ImgOps.copyInto( imgXfm, imgXfmOut);
		ImgOps.writeFloat(imgXfmOut, "/groups/jain/home/bogovicj/projects/crackPatching/toyData/ellipseImgXfm.tif");
		
		
		AffineTransform xfmEst = TransformTools.rotationPca( imgXfmOut, img);
		System.out.println("xfmEst:\n" + TransformTools.printAffineTransform(xfmEst));
		
//		AffineTransform xfmCat = xfmEst.preConcatenate(xfm);
//		System.out.println("xfmCat:\n" + TransformTools.printAffineTransform(xfmCat));
		
		
		RealTransformRandomAccessible<FloatType, InverseRealTransform> img2XfmXfm = 
				TransformTools.xfmToView( xfmEst, 
						Views.extendZero(imgXfmOut), new NLinearInterpolatorFactory<FloatType>());
		
		ImagePlusImg<FloatType, ?> img2xfmxfmout = factory.create(img, img.firstElement());
		ImgOps.copyInto( img2XfmXfm, img2xfmxfmout);
		ImgOps.writeFloat(img2xfmxfmout, "/groups/jain/home/bogovicj/projects/crackPatching/toyData/ellipseImg2XfmInv.tif");
		
		
		System.out.println("done");
		assertTrue(true);
		
	}
 
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:49,代码来源:TestPcaRotReg.java


示例12: parseAdditionalParameters

import net.imglib2.img.imageplus.ImagePlusImgFactory; //导入依赖的package包/类
@Override
public boolean parseAdditionalParameters( final GenericDialog gd )
{
	defaultFFTImgType = gd.getNextChoiceIndex();

	if ( defaultFFTImgType == 0 )
		computeFactory = new ArrayImgFactory< FloatType >();
	else if ( defaultFFTImgType == 1 )
		computeFactory = new ImagePlusImgFactory< FloatType >();
	else
		computeFactory = new CellImgFactory< FloatType >( 256 );

	saveMemory = defaultSaveMemory = gd.getNextBoolean();
	defaultIterationType = gd.getNextChoiceIndex();

	if ( defaultIterationType == 0 )
		iterationType = PSFTYPE.OPTIMIZATION_II;
	else if ( defaultIterationType == 1 )
		iterationType = PSFTYPE.OPTIMIZATION_I;
	else if ( defaultIterationType == 2 )
		iterationType = PSFTYPE.EFFICIENT_BAYESIAN;
	else //if ( defaultIterationType == 3 )
		iterationType = PSFTYPE.INDEPENDENT;

	defaultWeightType = gd.getNextChoiceIndex();

	if ( defaultWeightType == 0 )
		weightType = WeightType.PRECOMPUTED_WEIGHTS;
	else if ( defaultWeightType == 1 )
		weightType = WeightType.VIRTUAL_WEIGHTS;
	else if ( defaultWeightType == 2 )
		weightType = WeightType.NO_WEIGHTS;
	else
		weightType = WeightType.WEIGHTS_ONLY;

	osemspeedupIndex = defaultOSEMspeedupIndex = gd.getNextChoiceIndex();
	numIterations = defaultNumIterations = (int)Math.round( gd.getNextNumber() );
	debugMode = defaultDebugMode = gd.getNextBoolean();
	adjustBlending = defaultAdjustBlending = gd.getNextBoolean();
	useTikhonovRegularization = defaultUseTikhonovRegularization = gd.getNextBoolean();
	lambda = defaultLambda = gd.getNextNumber();
	blockSizeIndex = defaultBlockSizeIndex = gd.getNextChoiceIndex();
	computationTypeIndex = defaultComputationTypeIndex = gd.getNextChoiceIndex();
	extractPSFIndex = defaultExtractPSF = gd.getNextChoiceIndex();
	displayPSF = defaultDisplayPSF = gd.getNextChoiceIndex();

	return true;
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:49,代码来源:EfficientBayesianBased.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java XLogPack类代码示例发布时间:2022-05-22
下一篇:
Java BrowserView类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap