Java Code Examples for net.imglib2.util.Intervals#minAsLongArray()

The following examples show how to use net.imglib2.util.Intervals#minAsLongArray() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MeshGeneratorJobManager.java    From paintera with GNU General Public License v2.0 6 votes vote down vote up
private ShapeKey<T> createShapeKey(
		final CellGrid grid,
		final long index,
		final int scaleLevel,
		final SceneUpdateParameters sceneUpdateParameters)
{
	final Interval blockInterval = Grids.getCellInterval(grid, index);
	return new ShapeKey<>(
			identifier,
			scaleLevel,
			sceneUpdateParameters.simplificationIterations,
			sceneUpdateParameters.smoothingLambda,
			sceneUpdateParameters.smoothingIterations,
			sceneUpdateParameters.minLabelRatio,
			Intervals.minAsLongArray(blockInterval),
			Intervals.maxAsLongArray(blockInterval)
		);
}
 
Example 2
Source File: LocalThresholdIntegral.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * 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);
}
 
Example 3
Source File: LocalThresholdIntegral.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * 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;
}
 
Example 4
Source File: DefaultPValue.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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);
}
 
Example 5
Source File: ConcatenateViewTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 );
}
 
Example 6
Source File: ChannelFiller.java    From scifio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * 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);
}
 
Example 7
Source File: Plane.java    From scifio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * @return The minimums of this plane relative to the origin image
 */
default long[] getMin() {
	return Intervals.minAsLongArray(getBounds());
}