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


Java FloatArray类代码示例

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


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

示例1: createFloatInstance

import net.imglib2.img.basictypeaccess.array.FloatArray; //导入依赖的package包/类
@SuppressWarnings( "unchecked" )
public static BigWarpImageStackImageLoader< FloatType, FloatArray > createFloatInstance( final ImagePlus imp, int[] ids )
{
	return new BigWarpImageStackImageLoader< FloatType, FloatArray >( new FloatType(), imp, ids )
	{
		@Override
		protected FloatArray wrapPixels( final Object array )
		{
			return new FloatArray( ( float[] ) array );
		}

		@Override
		protected void linkType( final PlanarImg< FloatType, FloatArray > img )
		{
			img.setLinkedType( new FloatType( img ) );
		}
	};
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:19,代码来源:BigWarpImageStackImageLoader.java

示例2: main

import net.imglib2.img.basictypeaccess.array.FloatArray; //导入依赖的package包/类
final static public void main( final String[] args )
	{
		new ImageJ();
		final ImagePlus imp = new ImagePlus( "http://media.npr.org/images/picture-show-flickr-promo.jpg" );
		imp.show();

		final float[] pixels = ( float[] ) imp.getProcessor().convertToFloat().getPixels();
		final ArrayImg< FloatType, FloatArray > img = ArrayImgs.floats( pixels, imp.getWidth(), imp.getHeight() );

		final double[] lut = new double[ Math.max( imp.getWidth(), imp.getHeight() ) ];
		for ( int i = 0; i < lut.length; ++i )
			lut[ i ] = i + Math.pow( i, 1.5 );

		final SingleDimensionLUTRealTransform transform = new SingleDimensionLUTRealTransform( lut, 2, 2, 1 );
		final RealRandomAccessible< FloatType > source = Views.interpolate( Views.extendBorder( img ), new NLinearInterpolatorFactory< FloatType >() );
		final RandomAccessible< FloatType > target = new RealTransformRandomAccessible< FloatType, RealTransform >( source, transform );
		final RandomAccessible< FloatType > target2 = RealViews.transform( source, transform );

//		RealViews.transformReal(source, transform);

		ImageJFunctions.show( Views.interval( target, new FinalInterval( imp.getWidth(), imp.getHeight() ) ) );
		ImageJFunctions.show( Views.interval( target2, new FinalInterval( imp.getWidth(), imp.getHeight() ) ) );
	}
 
开发者ID:saalfeldlab,项目名称:z-spacing,代码行数:24,代码来源:SingleDimensionLUTRealTransform.java

示例3: createFloatInstance

import net.imglib2.img.basictypeaccess.array.FloatArray; //导入依赖的package包/类
public static ImageStackImageLoader< FloatType, FloatArray > createFloatInstance( final ImagePlus imp )
{
	return new ImageStackImageLoader< FloatType, FloatArray >( new FloatType(), imp )
	{
		@Override
		protected FloatArray wrapPixels( final Object array )
		{
			return new FloatArray( ( float[] ) array );
		}

		@Override
		protected void linkType( final PlanarImg< FloatType, FloatArray > img )
		{
			img.setLinkedType( new FloatType( img ) );
		}
	};
}
 
开发者ID:bigdataviewer,项目名称:bigdataviewer_fiji,代码行数:18,代码来源:ImageStackImageLoader.java

示例4: convolve1BlockCUDA

import net.imglib2.img.basictypeaccess.array.FloatArray; //导入依赖的package包/类
@SuppressWarnings("unchecked")
final protected static void convolve1BlockCUDA(
		final Block blockStruct, final int deviceId, final Img< FloatType > image,
		final Img< FloatType > result, final Img< FloatType > block, final Img< FloatType > kernel1, final int i )
{
	long time = System.currentTimeMillis();
	blockStruct.copyBlock( Views.extendMirrorSingle( image ), block );
	System.out.println( " block " + i + "(CPU  " + deviceId + "): copy " + (System.currentTimeMillis() - time) );

	// convolve block with kernel1 using CUDA
	time = System.currentTimeMillis();
	final float[] blockF = ((FloatArray)((ArrayImg< net.imglib2.type.numeric.real.FloatType, ? > )block).update( null ) ).getCurrentStorageArray();
	final float[] kernel1F = ((FloatArray)((ArrayImg< net.imglib2.type.numeric.real.FloatType, ? > )kernel1).update( null ) ).getCurrentStorageArray();
	
	MVDeconFFT.cuda.convolution3DfftCUDAInPlace(
			blockF, getCUDACoordinates( CUDAOutput.getImgSizeInt( block ) ),
			kernel1F, getCUDACoordinates( CUDAOutput.getImgSizeInt( kernel1 ) ),
			deviceId );
	System.out.println( " block " + i + "(CUDA " + deviceId + "): compute " + (System.currentTimeMillis() - time) );

	time = System.currentTimeMillis();
	blockStruct.pasteBlock( result, block );
	System.out.println( " block " + i + "(CPU  " + deviceId + "): paste " + (System.currentTimeMillis() - time) );
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:25,代码来源:MVDeconFFTThreads.java

示例5: convolve2BlockCUDA

import net.imglib2.img.basictypeaccess.array.FloatArray; //导入依赖的package包/类
@SuppressWarnings("unchecked")
final protected static void convolve2BlockCUDA(
		final Block blockStruct, final int deviceId, final Img< FloatType > image,
		final Img< FloatType > result, final Img< FloatType > block, final Img< FloatType > kernel2 )
{
	// ratio outside of the deconvolved space (psi) is 1
	blockStruct.copyBlock( Views.extendValue( image, new FloatType( 1.0f ) ), block );

	// convolve block with kernel2 using CUDA
	final float[] blockF = ((FloatArray)((ArrayImg< net.imglib2.type.numeric.real.FloatType, ? > )block).update( null ) ).getCurrentStorageArray();
	final float[] kernel2F = ((FloatArray)((ArrayImg< net.imglib2.type.numeric.real.FloatType, ? > )kernel2).update( null ) ).getCurrentStorageArray();

	MVDeconFFT.cuda.convolution3DfftCUDAInPlace(
			blockF, getCUDACoordinates( CUDAOutput.getImgSizeInt( block ) ),
			kernel2F, getCUDACoordinates( CUDAOutput.getImgSizeInt( kernel2 ) ),
			deviceId );

	blockStruct.pasteBlock( result, block );
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:20,代码来源:MVDeconFFTThreads.java

示例6: createFloatArray

import net.imglib2.img.basictypeaccess.array.FloatArray; //导入依赖的package包/类
private static float[] createFloatArray(
	final RandomAccessibleInterval<FloatType> image)
{
	final long[] dims = Intervals.dimensionsAsLongArray(image);
	final ArrayImg<FloatType, FloatArray> dest = ArrayImgs.floats(dims);
	copy(image, dest);
	return dest.update(null).getCurrentStorageArray();
}
 
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:9,代码来源:Tensors.java

示例7: extractFloatArray

import net.imglib2.img.basictypeaccess.array.FloatArray; //导入依赖的package包/类
private static float[] extractFloatArray(
	final RandomAccessibleInterval<FloatType> image)
{
	if (!(image instanceof ArrayImg)) return null;
	@SuppressWarnings("unchecked")
	final ArrayImg<FloatType, ?> arrayImg = (ArrayImg<FloatType, ?>) image;
	// GOOD NEWS: float[] rasterization order is dimension-wise!
	// BAD NEWS: it always goes d0,d1,d2,.... is that the order we need?
	// MORE BAD NEWS: As soon as you use Views.permute, image is not ArrayImg anymore.
	// SO: This only works if you give a RAI that happens to be laid out directly as TensorFlow desires.
	final Object dataAccess = arrayImg.update(null);
	return dataAccess instanceof FloatArray ? //
		((FloatArray) dataAccess).getCurrentStorageArray() : null;
}
 
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:15,代码来源:Tensors.java

示例8: main

import net.imglib2.img.basictypeaccess.array.FloatArray; //导入依赖的package包/类
final static public void main( final String[] args )
	{

		new ImageJ();
		final ImagePlus imp = new ImagePlus( "http://media.npr.org/images/picture-show-flickr-promo.jpg" );
		imp.show();

		final float[] pixels = ( float[] ) imp.getProcessor().convertToFloat().getPixels();
		final ArrayImg< FloatType, FloatArray > img = ArrayImgs.floats( pixels, imp.getWidth(), imp.getHeight() );

		final double[] lut = new double[ Math.max( imp.getWidth(), imp.getHeight() ) ];
		for ( int i = 0; i < lut.length; ++i )
			lut[ i ] = i + Math.pow( i, 1.5 );

		final LUTRealTransform transform = new LUTRealTransform( lut, 2, 2 );
		final RealRandomAccessible< FloatType > source = Views.interpolate( Views.extendBorder( img ), new NLinearInterpolatorFactory< FloatType >() );
		final RandomAccessible< FloatType > target = new RealTransformRandomAccessible< FloatType, RealTransform >( source, transform );
		final RandomAccessible< FloatType > target2 = RealViews.transform( source, transform );

//		RealViews.transformReal(source, transform);

		final ArrayImg< FloatType, FloatArray > targetImg = ArrayImgs.floats( imp.getWidth(), imp.getHeight() );
		render( source, targetImg, transform, 0.05 );

		ImageJFunctions.show( Views.interval( target, new FinalInterval( imp.getWidth(), imp.getHeight() ) ) );
		ImageJFunctions.show( Views.interval( target2, new FinalInterval( imp.getWidth(), imp.getHeight() ) ) );
		ImageJFunctions.show( targetImg );
	}
 
开发者ID:saalfeldlab,项目名称:z-spacing,代码行数:29,代码来源:LUTRealTransform.java

示例9: multiply

import net.imglib2.img.basictypeaccess.array.FloatArray; //导入依赖的package包/类
@OpMethod(ops = {
	net.imagej.ops.math.ConstantToArrayImageP.MultiplyFloat.class,
	net.imagej.ops.math.ConstantToArrayImage.MultiplyFloat.class })
public ArrayImg<FloatType, FloatArray> multiply(
	final ArrayImg<FloatType, FloatArray> image, final float value)
{
	@SuppressWarnings("unchecked")
	final ArrayImg<FloatType, FloatArray> result =
		(ArrayImg<FloatType, FloatArray>) ops().run(Ops.Math.Multiply.NAME, image,
			value);
	return result;
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:13,代码来源:MathNamespace.java

示例10: add

import net.imglib2.img.basictypeaccess.array.FloatArray; //导入依赖的package包/类
@OpMethod(op = net.imagej.ops.math.ConstantToPlanarImage.AddFloat.class)
public PlanarImg<FloatType, FloatArray> add(
	final PlanarImg<FloatType, FloatArray> image, final float value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<FloatType, FloatArray> result =
		(PlanarImg<FloatType, FloatArray>) ops().run(
			net.imagej.ops.Ops.Math.Add.class, image, value);
	return result;
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:11,代码来源:MathNamespace.java

示例11: divide

import net.imglib2.img.basictypeaccess.array.FloatArray; //导入依赖的package包/类
@OpMethod(ops = { net.imagej.ops.math.ConstantToArrayImageP.DivideFloat.class,
	net.imagej.ops.math.ConstantToArrayImage.DivideFloat.class })
public ArrayImg<FloatType, FloatArray> divide(
	final ArrayImg<FloatType, FloatArray> image, final float value)
{
	@SuppressWarnings("unchecked")
	final ArrayImg<FloatType, FloatArray> result =
		(ArrayImg<FloatType, FloatArray>) ops().run(Ops.Math.Divide.NAME, image,
			value);
	return result;
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:12,代码来源:MathNamespace.java

示例12: subtract

import net.imglib2.img.basictypeaccess.array.FloatArray; //导入依赖的package包/类
@OpMethod(ops = {
	net.imagej.ops.math.ConstantToArrayImageP.SubtractFloat.class,
	net.imagej.ops.math.ConstantToArrayImage.SubtractFloat.class })
public ArrayImg<FloatType, FloatArray> subtract(
	final ArrayImg<FloatType, FloatArray> image, final float value)
{
	@SuppressWarnings("unchecked")
	final ArrayImg<FloatType, FloatArray> result =
		(ArrayImg<FloatType, FloatArray>) ops().run(Ops.Math.Subtract.NAME, image,
			value);
	return result;
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:13,代码来源:MathNamespace.java

示例13: generateFloatArrayTestImg

import net.imglib2.img.basictypeaccess.array.FloatArray; //导入依赖的package包/类
public ArrayImg<FloatType, FloatArray> generateFloatArrayTestImg(
	final boolean fill, final long... dims)
{
	final float[] array = new float[(int) Intervals.numElements(
		new FinalInterval(dims))];

	if (fill) {
		seed = 17;
		for (int i = 0; i < array.length; i++) {
			array[i] = (float) pseudoRandom() / (float) Integer.MAX_VALUE;
		}
	}

	return ArrayImgs.floats(array, dims);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:16,代码来源:AbstractOpTest.java

示例14: copy3dArray

import net.imglib2.img.basictypeaccess.array.FloatArray; //导入依赖的package包/类
private static final void copy3dArray( final int threadIdx, final int numThreads, final RandomAccessible< FloatType > source, final ArrayImg< FloatType, ? > block, final long[] offset )
{
	final int w = (int)block.dimension( 0 );
	final int h = (int)block.dimension( 1 );
	final int d = (int)block.dimension( 2 );

	final long offsetX = offset[ 0 ];
	final long offsetY = offset[ 1 ];
	final long offsetZ = offset[ 2 ];
	final float[] blockArray = ((FloatArray)block.update( null ) ).getCurrentStorageArray();

	// define where we will query the RandomAccess on the source
	final FinalInterval interval = new FinalInterval( new long[] { offsetX, offsetY, offsetZ }, new long[] { offsetX + w - 1, offsetY + h - 1, offsetZ + d - 1 } );
	final RandomAccess< FloatType > randomAccess = source.randomAccess( interval );

	final long[] tmp = new long[]{ offsetX, offsetY, 0 };

	for ( int z = threadIdx; z < d; z += numThreads )
	{
		tmp[ 2 ] = z + offsetZ;
		randomAccess.setPosition( tmp );

		int i = z * h * w;

		for ( int y = 0; y < h; ++y )
		{
			randomAccess.setPosition( offsetX, 0 );

			for ( int x = 0; x < w; ++x )
			{
				blockArray[ i++ ] = randomAccess.get().get();
				randomAccess.fwd( 0 );
			}

			randomAccess.move( -w, 0 );
			randomAccess.fwd( 1 );
		}
	}
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:40,代码来源:Block.java

示例15: createInstance

import net.imglib2.img.basictypeaccess.array.FloatArray; //导入依赖的package包/类
@Override
public
	SCIFIOCellImg<T, FloatArray>
	createFloatInstance(final long[] dimensions, final Fraction entitiesPerPixel)
{
	return createInstance(new FloatArrayLoader(reader(), subregion),
		dimensions, entitiesPerPixel);
}
 
开发者ID:scifio,项目名称:scifio,代码行数:9,代码来源:SCIFIOCellImgFactory.java


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