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


Java Intervals.minAsLongArray方法代码示例

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


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

示例1: addLeadingZeros

import net.imglib2.util.Intervals; //导入方法依赖的package包/类
/**
 * Add 0s before axis minimum.
 * 
 * @param input Input RAI
 * @return An extended and cropped version of input
 */
private <T extends RealType<T>> RandomAccessibleInterval<T> addLeadingZeros(
	RandomAccessibleInterval<T> input)
{
	final long[] min = Intervals.minAsLongArray(input);
	final long[] max = Intervals.maxAsLongArray(input);

	for (int i = 0; i < max.length; i++) {
		min[i]--;
	}

	final T realZero = Util.getTypeFromInterval(input).copy();
	realZero.setZero();

	final ExtendedRandomAccessibleInterval<T, RandomAccessibleInterval<T>> extendedImg = Views.extendValue(input,
		realZero);
	final IntervalView<T> offsetInterval = Views.interval(extendedImg,
		min, max);
	
	return Views.zeroMin(offsetInterval);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:27,代码来源:LocalThresholdIntegral.java

示例2: removeLeadingZeros

import net.imglib2.util.Intervals; //导入方法依赖的package包/类
/**
 * Removes leading 0s from integral image after composite creation.
 *
 * @param input Input RAI (can be a RAI of Composite)
 * @return An extended and cropped version of input
 */
private <T> RandomAccessibleInterval<T> removeLeadingZeros(
	final RandomAccessibleInterval<T> input)
{
	// Remove 0s from integralImg by shifting its interval by +1
	final long[] min = Intervals.minAsLongArray(input);
	final long[] max = Intervals.maxAsLongArray(input);

	for (int d = 0; d < input.numDimensions(); ++d) {
		int correctedSpan = getShape().getSpan() - 1;
		min[d] += (1 + correctedSpan);
		max[d] -= correctedSpan;
	}

	// Define the Interval on the infinite random accessibles
	final FinalInterval interval = new FinalInterval(min, max);

	final RandomAccessibleInterval<T> extendedImg = Views.offsetInterval(Views
		.extendBorder(input), interval);
	return extendedImg;
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:27,代码来源:LocalThresholdIntegral.java

示例3: createIntervals

import net.imglib2.util.Intervals; //导入方法依赖的package包/类
private < T > List< RandomAccessibleInterval< T > > createIntervals( final RandomAccessibleInterval< T > source, final long divider, final int axis )
{
	final long[] min = Intervals.minAsLongArray( source );
	final long[] max = Intervals.maxAsLongArray( source );
	final long[] min1 = min.clone();
	final long[] min2 = min.clone();
	final long[] max1 = max.clone();
	final long[] max2 = max.clone();
	max1[ axis ] = divider;
	min2[ axis ] = divider + 1;
	final IntervalView< T > interval1 = Views.interval( source, min1, max1 );
	final IntervalView< T > interval2 = Views.interval( source, min2, max2 );

	return Arrays.asList( interval1, interval2 );
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:16,代码来源:ConcatenateViewTest.java

示例4: saveUnsignedByte

import net.imglib2.util.Intervals; //导入方法依赖的package包/类
/**
 * Save a {@link RandomAccessibleInterval} of {@link UnsignedByteType} into an HDF5
 * uint8 dataset.
 *
 * @param source
 * @param writer
 * @param dataset
 * @param cellDimensions
 */
static public void saveUnsignedByte(
		final RandomAccessibleInterval< UnsignedByteType > source,
		final IHDF5Writer writer,
		final String dataset,
		final int[] cellDimensions )
{
	if ( !writer.exists( dataset ) )
		createUnsignedByte( writer, dataset, source, cellDimensions );

	final long[] dimensions = reorder( writer.object().getDimensions( dataset ) );
	final int n = source.numDimensions();

	final IHDF5ByteWriter uint8Writer = writer.uint8();

	/* min is >= 0, max is < dimensions */
	final long[] min = Intervals.minAsLongArray( source );
	final long[] max = Intervals.maxAsLongArray( source );
	for ( int d = 0; d < min.length; ++d )
	{
		min[ d ] = Math.max( 0, min[ d ] );
		max[ d ] = Math.min( dimensions[ d ] - 1, max[ d ] );
	}

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

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

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

示例5: saveUnsignedLong

import net.imglib2.util.Intervals; //导入方法依赖的package包/类
/**
 * Save a {@link RandomAccessibleInterval} of {@link LongType} into an HDF5
 * uint64 dataset.
 *
 * @param source source
 * @param writer
 * @param dataset
 * @param cellDimensions
 */
static public void saveUnsignedLong(
		final RandomAccessibleInterval< LongType > source,
		final IHDF5Writer writer,
		final String dataset,
		final int[] cellDimensions )
{
	if ( !writer.exists( dataset ) )
		createUnsignedLong( writer, dataset, source, cellDimensions );

	final long[] dimensions = reorder( writer.object().getDimensions( dataset ) );
	final int n = source.numDimensions();

	final IHDF5LongWriter uint64Writer = writer.uint64();

	/* min is >= 0, max is < dimensions */
	final long[] min = Intervals.minAsLongArray( source );
	final long[] max = Intervals.maxAsLongArray( source );
	for ( int d = 0; d < min.length; ++d )
	{
		min[ d ] = Math.max( 0, min[ d ] );
		max[ d ] = Math.min( dimensions[ d ] - 1, max[ d ] );
	}

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

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

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

示例6: saveLong

import net.imglib2.util.Intervals; //导入方法依赖的package包/类
/**
 * Save a {@link RandomAccessibleInterval} of {@link LongType} into an HDF5
 * int64 dataset.
 *
 * @param source source
 * @param writer
 * @param dataset
 * @param cellDimensions
 */
static public void saveLong(
		final RandomAccessibleInterval< LongType > source,
		final IHDF5Writer writer,
		final String dataset,
		final int[] cellDimensions )
{
	if ( !writer.exists( dataset ) )
		createLong( writer, dataset, source, cellDimensions );

	final long[] dimensions = reorder( writer.object().getDimensions( dataset ) );
	final int n = source.numDimensions();

	final IHDF5LongWriter int64Writer = writer.int64();

	/* min is >= 0, max is < dimensions */
	final long[] min = Intervals.minAsLongArray( source );
	final long[] max = Intervals.maxAsLongArray( source );
	for ( int d = 0; d < min.length; ++d )
	{
		min[ d ] = Math.max( 0, min[ d ] );
		max[ d ] = Math.min( dimensions[ d ] - 1, max[ d ] );
	}

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

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

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


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