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

The following examples show how to use net.imglib2.view.Views#rotate() . 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: RotateViewTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Test
public void testIntervalRotate() {
	final Img<DoubleType> img = ArrayImgs.doubles(20,10);

	final IntervalView<DoubleType> il2 = Views.rotate((RandomAccessibleInterval<DoubleType>) img, 1, 0);
	final IntervalView<DoubleType> opr = (IntervalView<DoubleType>) ops.transform().rotateView((RandomAccessibleInterval<DoubleType>) img, 1, 0);

	for (int i = 0; i < ((MixedTransformView<DoubleType>) il2.getSource()).getTransformToSource()
			.getMatrix().length; i++) {
		for (int j = 0; j < ((MixedTransformView<DoubleType>) il2.getSource()).getTransformToSource()
				.getMatrix()[i].length; j++) {
			assertEquals(
					((MixedTransformView<DoubleType>) il2.getSource()).getTransformToSource().getMatrix()[i][j],
					((MixedTransformView<DoubleType>) opr.getSource()).getTransformToSource().getMatrix()[i][j],
					1e-10);
		}
	}
}
 
Example 2
Source File: RotateViewTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Test
public void testIntervalRotateInterval() {
	final Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 20, 10 }, new DoubleType());

	final IntervalView<DoubleType> il2 = Views.rotate((RandomAccessibleInterval<DoubleType>) img, 1, 0);
	final IntervalView<DoubleType> opr = ops.transform().rotateView((RandomAccessibleInterval<DoubleType>) img, 1, 0);

	assertEquals(img.min(1), il2.min(0));
	assertEquals(img.max(1), il2.max(0));
	assertEquals(img.min(0), -il2.max(1));
	assertEquals(img.max(0), -il2.min(1));

	for (int i = 0; i < il2.numDimensions(); i++) {
		assertEquals(il2.max(i), opr.max(i));
		assertEquals(il2.min(i), opr.min(i));
	}

}
 
Example 3
Source File: RotateViewTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void testDefaultRotate() {
	final Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 20, 10 }, new DoubleType());

	final MixedTransformView<DoubleType> il2 = Views.rotate((RandomAccessible<DoubleType>) img, 1, 0);
	final MixedTransformView<DoubleType> opr = ops.transform().rotateView(deinterval(img), 1, 0);

	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 4
Source File: IntervalRotateView.java    From imagej-ops with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public IntervalView<T> calculate(RandomAccessibleInterval<T> input) {
	return Views.rotate(input, fromAxis, toAxis);
}
 
Example 5
Source File: DefaultRotateView.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.rotate(input, fromAxis, toAxis);
}