本文整理了Java中net.imglib2.util.Intervals.maxAsLongArray()
方法的一些代码示例,展示了Intervals.maxAsLongArray()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Intervals.maxAsLongArray()
方法的具体详情如下:
包路径:net.imglib2.util.Intervals
类名称:Intervals
方法名:maxAsLongArray
[英]Create a long[]
with the maximum of an Interval.
Keep in mind that creating arrays wildly is not good practice and consider using the interval directly. See Interval#max(long[]).
[中]创建一个long[]
的最大间隔。
请记住,疯狂地创建数组不是好的实践,而是直接考虑使用间隔。参见间隔#max(长[])。
代码示例来源:origin: net.imglib2/imglib2-algorithm
/**
* Convenience constructor for {@link Interval}. Delegates to
* {@link CreateAndCropBlockToFitInterval#CreateAndCropBlockToFitInterval(int[], long[])}
* using {@code max = Intervals.maxAsLongArray( interval )}.
*
* @param blockSize
* @param interval
*/
public CreateAndCropBlockToFitInterval( final int[] blockSize, final Interval interval )
{
this( blockSize, Intervals.maxAsLongArray( interval ) );
}
代码示例来源:origin: io.scif/scifio
/**
* @return The maximums of this plane relative to the origin image
*/
default long[] getMax() {
return Intervals.maxAsLongArray(getBounds());
}
代码示例来源:origin: net.imglib2/imglib2
static String intervalToString( Interval a )
{
return "{min=" + Arrays.toString( Intervals.minAsLongArray( a ) ) +
", max=" + Arrays.toString( Intervals.maxAsLongArray( a ) ) + "}";
}
代码示例来源:origin: imglib/imglib2
static String intervalToString( Interval a )
{
return "{min=" + Arrays.toString( Intervals.minAsLongArray( a ) ) +
", max=" + Arrays.toString( Intervals.maxAsLongArray( a ) ) + "}";
}
代码示例来源:origin: scifio/scifio
/**
* @return The maximums of this plane relative to the origin image
*/
default long[] getMax() {
return Intervals.maxAsLongArray(getBounds());
}
代码示例来源:origin: net.imglib2/imglib2-algorithm
/**
*
* Submit blocked tasks and wait for execution.
*
* @param func
* {@link Function} to be applied to each block as specified by
* first parameter {@link Interval}.
* @param interval
* @param blockSize
* @param es
* @param numTasks
* @return List of futures of the submitted tasks. Each future contains a
* list of results.
*/
public static < T > List< Future< List< T > > > parallelize(
final Function< Interval, T > func,
final Interval interval,
final int[] blockSize,
final ExecutorService es,
final int numTasks )
{
return parallelize( func, Intervals.minAsLongArray( interval ), Intervals.maxAsLongArray( interval ), blockSize, es, numTasks );
}
代码示例来源:origin: net.imglib2/imglib2-algorithm
/**
* A local extremum check.
*
* @param <P>
* A representation of the extremum. For example, this could be
* just a {@link Point} describing the location of the extremum.
* It could contain additional information such as the value at
* the extremum or an extremum type.
* @param <T>
* pixel type.
*/
public interface LocalNeighborhoodCheck< P, T >
{
/**
* Determine whether a pixel is a local extremum. If so, return a
* {@code P} that represents the maximum. Otherwise return
* {@code null}.
*
* @param center
* an access located on the pixel to test
* @param neighborhood
* iterable neighborhood of the pixel, not containing the
* pixel itself.
* @return null if the center not a local extremum, a P if it is.
*/
public < C extends Localizable & Sampler< T > > P check( C center, Neighborhood< T > neighborhood );
}
代码示例来源:origin: net.imglib2/imglib2-algorithm
/**
*
* Submit blocked tasks and wait for execution.
*
* @param func
* {@link Function} to be applied to each block as specified by
* first parameter {@link Interval}.
* @param interval
* @param blockSize
* @param es
* @param numTasks
* @return {@link List} of results of computation. Note that for
* computations that return void, this should be a list of
* {@link Void}.
* @throws InterruptedException
* @throws ExecutionException
*/
public static < T > List< T > parallelizeAndWait(
final Function< Interval, T > func,
final Interval interval,
final int[] blockSize,
final ExecutorService es,
final int numTasks ) throws InterruptedException, ExecutionException
{
return parallelizeAndWait( func, Intervals.minAsLongArray( interval ), Intervals.maxAsLongArray( interval ), blockSize, es, numTasks );
}
代码示例来源:origin: imagej/imagej-ops
private static <V> RandomAccessibleInterval<V> trim(
final RandomAccessibleInterval<V> image, final int[] blockSize)
{
final long[] min = Intervals.minAsLongArray(image);
final long[] max = Intervals.maxAsLongArray(image);
for (int d = 0; d < blockSize.length; d++) {
final long trimSize = image.dimension(d) % blockSize[d];
final long half = trimSize / 2;
min[d] += half;
max[d] -= trimSize - half;
}
return Views.interval(image, min, max);
}
}
代码示例来源:origin: net.imglib2/imglib2-algorithm
@Override
public Interval requiredSourceInterval( final Interval targetInterval )
{
final long[] min = Intervals.minAsLongArray( targetInterval );
final long[] max = Intervals.maxAsLongArray( targetInterval );
min[ direction ] -= factory.getBorderBefore();
max[ direction ] += factory.getBorderAfter();
return new FinalInterval( min, max );
}
代码示例来源:origin: io.scif/scifio
/**
* Converts the given plane information using the current metadata to a format
* usable by the wrapped reader, stored in the "lastPlane"... variables.
*/
private void updateLastPlaneInfo(final int imageIndex, final int lutLength,
final Interval bounds)
{
final long[] min = Intervals.minAsLongArray(bounds);
final long[] max = Intervals.maxAsLongArray(bounds);
final int cIndex = getMetadata().get(imageIndex).getAxisIndex(Axes.CHANNEL);
min[cIndex] = min[cIndex] / lutLength;
max[cIndex] = max[cIndex] / lutLength;
lastPlaneBounds = new FinalInterval(min, max);
}
代码示例来源:origin: scifio/scifio
/**
* Converts the given plane information using the current metadata to a format
* usable by the wrapped reader, stored in the "lastPlane"... variables.
*/
private void updateLastPlaneInfo(final int imageIndex, final int lutLength,
final Interval bounds)
{
final long[] min = Intervals.minAsLongArray(bounds);
final long[] max = Intervals.maxAsLongArray(bounds);
final int cIndex = getMetadata().get(imageIndex).getAxisIndex(Axes.CHANNEL);
min[cIndex] = min[cIndex] / lutLength;
max[cIndex] = max[cIndex] / lutLength;
lastPlaneBounds = new FinalInterval(min, max);
}
代码示例来源:origin: net.imglib2/imglib2-algorithm
final long[] max = Intervals.maxAsLongArray( target );
代码示例来源:origin: net.imglib2/imglib2-algorithm
final long[] max = Intervals.maxAsLongArray( target );
代码示例来源:origin: imagej/imagej-ops
/**
* 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);
}
代码示例来源:origin: imagej/imagej-ops
/**
* 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;
}
代码示例来源:origin: imagej/imagej-ops
private static < T extends ValueEquals< T > > void testEqual( final RandomAccessibleInterval< T > rai1, final RandomAccessibleInterval< T > rai2 )
{
Assert.assertArrayEquals( Intervals.minAsLongArray( rai1 ), Intervals.minAsLongArray( rai2 ) );
Assert.assertArrayEquals( Intervals.maxAsLongArray( rai1 ), Intervals.maxAsLongArray( rai2 ) );
for ( final Pair< T, T > p : Views.interval( Views.pair( rai1, rai2 ), rai1 ) )
Assert.assertTrue( p.getA().valueEquals( p.getB() ) );
}
代码示例来源:origin: imagej/imagej-ops
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 );
}
代码示例来源:origin: imglib/imglib2
private static List< RandomAccessibleInterval< ByteType > > splitImage(
RandomAccessibleInterval< ByteType > img,
int axis,
long divider )
{
final long[] min = Intervals.minAsLongArray( img );
final long[] max = Intervals.maxAsLongArray( img );
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< ByteType > interval1 = Views.interval( img, min1, max1 );
final IntervalView< ByteType > interval2 = Views.interval( img, min2, max2 );
return Arrays.asList( interval1, interval2 );
}
代码示例来源:origin: imagej/imagej-ops
@Test
public void testImageMinimum() {
final MersenneTwisterFast randomGenerator = new MersenneTwisterFast(SEED);
for (int i = 0; i < TEST_SIZE; i++) {
// between 2 and 5 dimensions
final long[] max = new long[randomGenerator.nextInt(4) + 2];
final long[] min = new long[max.length];
// between 2 and 10 pixels per dimensions
for (int j = 0; j < max.length; j++) {
max[j] = randomGenerator.nextInt(9) + 2;
min[j] = Math.max(0, max[j] - randomGenerator.nextInt(4));
}
// create img
final Img<?> img = (Img<?>) ops.run(CreateImgFromInterval.class,
new FinalInterval(min, max));
assertArrayEquals("Image Minimum:", min, Intervals.minAsLongArray(img));
assertArrayEquals("Image Maximum:", max, Intervals.maxAsLongArray(img));
}
}
内容来源于网络,如有侵权,请联系作者删除!