use of net.imglib2.view.MixedTransformView in project imagej-ops by imagej.
the class HyperSliceViewTest method defaultHyperSliceTest.
@Test
public void defaultHyperSliceTest() {
final Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10, 10 }, new DoubleType());
final MixedTransformView<DoubleType> il2 = Views.hyperSlice((RandomAccessible<DoubleType>) img, 1, 8);
final MixedTransformView<DoubleType> opr = ops.transform().hyperSliceView(deinterval(img), 1, 8);
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);
}
}
}
use of net.imglib2.view.MixedTransformView in project imagej-ops by imagej.
the class InvertAxisViewTest method defaultInvertAxisTest.
@Test
public void defaultInvertAxisTest() {
final Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
final MixedTransformView<DoubleType> il2 = Views.invertAxis((RandomAccessible<DoubleType>) img, 1);
final MixedTransformView<DoubleType> opr = ops.transform().invertAxisView(deinterval(img), 1);
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);
}
}
}
use of net.imglib2.view.MixedTransformView in project imagej-ops by imagej.
the class PermuteViewTest method defaultPermuteTest.
@Test
public void defaultPermuteTest() {
Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
MixedTransformView<DoubleType> il2 = Views.permute((RandomAccessible<DoubleType>) img, 1, 0);
MixedTransformView<DoubleType> opr = ops.transform().permuteView(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);
}
}
}
use of net.imglib2.view.MixedTransformView in project imagej-ops by imagej.
the class RotateViewTest method testDefaultRotate.
@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);
}
}
}
use of net.imglib2.view.MixedTransformView in project imagej-ops by imagej.
the class AddDimensionViewTest method addDimensionTest.
@Test
public void addDimensionTest() {
Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
MixedTransformView<DoubleType> il2 = Views.addDimension((RandomAccessible<DoubleType>) img);
MixedTransformView<DoubleType> opr = ops.transform().addDimensionView((RandomAccessible<DoubleType>) img);
assertEquals(il2.numDimensions(), opr.numDimensions());
boolean[] il2Transform = new boolean[3];
boolean[] oprTransform = new boolean[3];
il2.getTransformToSource().getComponentZero(il2Transform);
opr.getTransformToSource().getComponentZero(oprTransform);
for (int i = 0; i < il2Transform.length; i++) {
assertEquals(il2Transform[i], oprTransform[i]);
}
}
Aggregations