本文整理汇总了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);
}
示例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;
}
示例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 );
}
示例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 ];
}
}
}
示例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 ];
}
}
}
示例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 ];
}
}
}