Java Code Examples for net.imglib2.view.Views#offset()

The following examples show how to use net.imglib2.view.Views#offset() . 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: OffsetViewTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void defaultOffsetTest() {

	Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());

	MixedTransformView<DoubleType> il2 = Views.offset((RandomAccessible<DoubleType>) img, new long[] { 2, 2 });
	MixedTransformView<DoubleType> opr = ops.transform().offsetView((RandomAccessible<DoubleType>) img, new long[] { 2, 2 });

	for (int i = 0; i < il2.getTransformToSource().getMatrix().length; i++) {
		for (int j = 0; j < il2.getTransformToSource().getMatrix()[i].length; j++) {
			assertEquals(il2.getTransformToSource().getMatrix()[i][j], opr.getTransformToSource().getMatrix()[i][j],
					1e-10);
		}
	}
}
 
Example 2
Source File: DefaultOffsetView.java    From imagej-ops with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public MixedTransformView<T> calculate(RandomAccessible<T> input) {
	return Views.offset(input, offset);
}