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


Java Intervals.dimensionsAsLongArray方法代码示例

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


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

示例1: createByteArray

import net.imglib2.util.Intervals; //导入方法依赖的package包/类
private static byte[] createByteArray(
	final RandomAccessibleInterval<ByteType> image)
{
	final long[] dims = Intervals.dimensionsAsLongArray(image);
	final ArrayImg<ByteType, ByteArray> dest = ArrayImgs.bytes(dims);
	copy(image, dest);
	return dest.update(null).getCurrentStorageArray();
}
 
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:9,代码来源:Tensors.java

示例2: createDoubleArray

import net.imglib2.util.Intervals; //导入方法依赖的package包/类
private static double[] createDoubleArray(
	final RandomAccessibleInterval<DoubleType> image)
{
	final long[] dims = Intervals.dimensionsAsLongArray(image);
	final ArrayImg<DoubleType, DoubleArray> dest = ArrayImgs.doubles(dims);
	copy(image, dest);
	return dest.update(null).getCurrentStorageArray();
}
 
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:9,代码来源:Tensors.java

示例3: createFloatArray

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

示例4: createIntArray

import net.imglib2.util.Intervals; //导入方法依赖的package包/类
private static int[] createIntArray(
	final RandomAccessibleInterval<IntType> image)
{
	final long[] dims = Intervals.dimensionsAsLongArray(image);
	final ArrayImg<IntType, IntArray> dest = ArrayImgs.ints(dims);
	copy(image, dest);
	return dest.update(null).getCurrentStorageArray();
}
 
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:9,代码来源:Tensors.java

示例5: createLongArray

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

示例6: saveFloat

import net.imglib2.util.Intervals; //导入方法依赖的package包/类
/**
 * Save a {@link RandomAccessibleInterval} of {@link FloatType} into an HDF5
 * float32 dataset.
 *
 * @param source
 * @param writer
 * @param dataset
 * @param cellDimensions
 */
static public void saveFloat(
		final RandomAccessibleInterval< FloatType > source,
		final IHDF5Writer writer,
		final String dataset,
		final int[] cellDimensions )
{
	final int n = source.numDimensions();
	final long[] dimensions = Intervals.dimensionsAsLongArray( source );
	final IHDF5FloatWriter float32Writer = writer.float32();
	if ( !writer.exists( dataset ) )
		float32Writer.createMDArray(
				dataset,
				reorder( dimensions ),
				reorder( cellDimensions ) );

	final long[] offset = new long[ n ];
	final long[] sourceCellDimensions = new long[ n ];
	for ( int d = 0; d < n; )
	{
		cropCellDimensions( source, offset, cellDimensions, sourceCellDimensions );
		final RandomAccessibleInterval< FloatType > sourceBlock = Views.offsetInterval( source, offset, sourceCellDimensions );
		final MDFloatArray targetCell = new MDFloatArray( reorder( sourceCellDimensions ) );
		int i = 0;
		for ( final FloatType t : Views.flatIterable( sourceBlock ) )
			targetCell.set( t.get(), i++ );

		float32Writer.writeMDArrayBlockWithOffset( dataset, targetCell, reorder( offset ) );

		for ( d = 0; d < n; ++d )
		{
			offset[ d ] += cellDimensions[ d ];
			if ( offset[ d ] < source.dimension( d ) )
				break;
			else
				offset[ d ] = 0;
		}
	}
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:48,代码来源:H5Utils.java

示例7: saveDouble

import net.imglib2.util.Intervals; //导入方法依赖的package包/类
/**
 * Save a {@link RandomAccessibleInterval} of {@link DoubleType} into an HDF5
 * float64 dataset.
 *
 * @param source
 * @param writer
 * @param dataset
 * @param cellDimensions
 */
static public void saveDouble(
		final RandomAccessibleInterval< DoubleType > source,
		final IHDF5Writer writer,
		final String dataset,
		final int[] cellDimensions )
{
	final int n = source.numDimensions();
	final long[] dimensions = Intervals.dimensionsAsLongArray( source );
	final IHDF5DoubleWriter float64Writer = writer.float64();
	if ( !writer.exists( dataset ) )
		float64Writer.createMDArray(
				dataset,
				reorder( dimensions ),
				reorder( cellDimensions ) );

	final long[] offset = new long[ n ];
	final long[] sourceCellDimensions = new long[ n ];
	for ( int d = 0; d < n; )
	{
		cropCellDimensions( source, offset, cellDimensions, sourceCellDimensions );
		final RandomAccessibleInterval< DoubleType > sourceBlock = Views.offsetInterval( source, offset, sourceCellDimensions );
		final MDDoubleArray targetCell = new MDDoubleArray( reorder( sourceCellDimensions ) );
		int i = 0;
		for ( final DoubleType t : Views.flatIterable( sourceBlock ) )
			targetCell.set( t.get(), i++ );

		float64Writer.writeMDArrayBlockWithOffset( dataset, targetCell, reorder( offset ) );

		for ( d = 0; d < n; ++d )
		{
			offset[ d ] += cellDimensions[ d ];
			if ( offset[ d ] < source.dimension( d ) )
				break;
			else
				offset[ d ] = 0;
		}
	}
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:48,代码来源:H5Utils.java

示例8: saveUnsignedShort

import net.imglib2.util.Intervals; //导入方法依赖的package包/类
/**
 * Save a {@link RandomAccessibleInterval} of {@link ShortType} into an HDF5
 * uint16 dataset.
 *
 * @param source
 * @param writer
 * @param dataset
 * @param cellDimensions
 */
static public void saveUnsignedShort(
		final RandomAccessibleInterval< ShortType > source,
		final IHDF5Writer writer,
		final String dataset,
		final int[] cellDimensions )
{
	final int n = source.numDimensions();
	final long[] dimensions = Intervals.dimensionsAsLongArray( source );
	final IHDF5ShortWriter uint16Writer = writer.uint16();
	if ( !writer.exists( dataset ) )
		uint16Writer.createMDArray(
				dataset,
				reorder( dimensions ),
				reorder( cellDimensions ),
				HDF5IntStorageFeatures.INT_AUTO_SCALING_DEFLATE );

	final long[] offset = new long[ n ];
	final long[] sourceCellDimensions = new long[ n ];
	for ( int d = 0; d < n; )
	{
		cropCellDimensions( source, offset, cellDimensions, sourceCellDimensions );
		final RandomAccessibleInterval< ShortType > sourceBlock = Views.offsetInterval( source, offset, sourceCellDimensions );
		final MDShortArray targetCell = new MDShortArray( reorder( sourceCellDimensions ) );
		int i = 0;
		for ( final ShortType t : Views.flatIterable( sourceBlock ) )
			targetCell.set( t.get(), i++ );

		uint16Writer.writeMDArrayBlockWithOffset( dataset, targetCell, reorder( offset ) );

		for ( d = 0; d < n; ++d )
		{
			offset[ d ] += cellDimensions[ d ];
			if ( offset[ d ] < source.dimension( d ) )
				break;
			else
				offset[ d ] = 0;
		}
	}
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:49,代码来源:H5Utils.java

示例9: calculate

import net.imglib2.util.Intervals; //导入方法依赖的package包/类
@Override
public RandomAccessibleInterval<T> calculate(RandomAccessibleInterval<T> input) {
	final long[] newDims = Intervals.dimensionsAsLongArray(in());
	for (int i = 0; i < Math.min(scaleFactors.length, in().numDimensions()); i++) {
		newDims[i] = Math.round(in().dimension(i) * scaleFactors[i]);
	}

	IntervalView<T> interval = Views.interval(Views.raster(RealViews.affineReal(
		Views.interpolate(Views.extendMirrorSingle(input), interpolator),
		new Scale(scaleFactors))), new FinalInterval(newDims));

	return interval;
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:14,代码来源:DefaultScaleView.java


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