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

The following examples show how to use net.imglib2.util.Intervals#contains() . 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: CropRAI.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public RandomAccessibleInterval<T> calculate(final RandomAccessibleInterval<T> input, final Interval interval) {
	boolean oneSizedDims = false;

	if (dropSingleDimensions) {
		for (int d = 0; d < interval.numDimensions(); d++) {
			if (interval.dimension(d) == 1) {
				oneSizedDims = true;
				break;
			}
		}
	}

	if (Intervals.equals(input, interval) && !oneSizedDims)
		return input;
	if (!Intervals.contains(input, interval))
		throw new RuntimeException("Intervals don't match!");
	IntervalView<T> res = Views.offsetInterval(input, interval);
	return oneSizedDims ? Views.dropSingletonDimensions(res) : res;
}
 
Example 2
Source File: HistogramOfOrientedGradients2D.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public Void call() throws Exception {

	final FinalInterval interval = new FinalInterval(in.dimension(0), in.dimension(1));
	for (int j = 0; j < in.dimension(1); j++) {
		// sum up the magnitudes of all bins in a neighborhood
		raNeighbor.setPosition(new long[] { i, j });
		final Cursor<FloatType> cursorNeighborHood = raNeighbor.get().cursor();
		while (cursorNeighborHood.hasNext()) {
			cursorNeighborHood.next();
			if (Intervals.contains(interval, cursorNeighborHood)) {
				raAngles.setPosition(cursorNeighborHood);
				raMagnitudes.setPosition(cursorNeighborHood);
				raOut.setPosition(new long[] { i, j,
						(int) (raAngles.get().getRealFloat() / (360 / numOrientations) - 0.5) });
				raOut.get().add(raMagnitudes.get());
			}
		}
	}
	return null;
}
 
Example 3
Source File: Maps.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static <I1, I2, O> boolean compatible(
	final RandomAccessibleInterval<I1> a, final IterableInterval<I2> b,
	final IterableInterval<O> c)
{
	return b.iterationOrder().equals(c.iterationOrder()) && Intervals.contains(
		a, b);
}
 
Example 4
Source File: Maps.java    From imagej-ops with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public static <I, O> boolean compatible(final IterableInterval<I> a,
	final RandomAccessibleInterval<O> b)
{
	return Intervals.contains(b, a);
}
 
Example 5
Source File: Maps.java    From imagej-ops with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public static <I, O> boolean compatible(final RandomAccessibleInterval<I> a,
	final IterableInterval<O> b)
{
	return Intervals.contains(a, b);
}
 
Example 6
Source File: Maps.java    From imagej-ops with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public static <I1, I2, O> boolean compatible(final IterableInterval<I1> a,
	final IterableInterval<I2> b, final RandomAccessibleInterval<O> c)
{
	return a.iterationOrder().equals(b.iterationOrder()) && Intervals.contains(
		c, a);
}
 
Example 7
Source File: Maps.java    From imagej-ops with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public static <I1, I2, O> boolean compatible(final IterableInterval<I1> a,
	final RandomAccessibleInterval<I2> b, final IterableInterval<O> c)
{
	return a.iterationOrder().equals(c.iterationOrder()) && Intervals.contains(
		b, a);
}
 
Example 8
Source File: Maps.java    From imagej-ops with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public static <I1, I2, O> boolean compatible(final IterableInterval<I1> a,
	final RandomAccessibleInterval<I2> b, final RandomAccessibleInterval<O> c)
{
	return Intervals.contains(b, a) && Intervals.contains(c, a);
}
 
Example 9
Source File: Maps.java    From imagej-ops with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public static <I1, I2, O> boolean compatible(
	final RandomAccessibleInterval<I1> a, final IterableInterval<I2> b,
	final RandomAccessibleInterval<O> c)
{
	return Intervals.contains(a, b) && Intervals.contains(c, b);
}
 
Example 10
Source File: Maps.java    From imagej-ops with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public static <I1, I2, O> boolean compatible(
	final RandomAccessibleInterval<I1> a, final RandomAccessibleInterval<I2> b,
	final IterableInterval<O> c)
{
	return Intervals.contains(a, c) && Intervals.contains(b, c);
}