本文整理了Java中net.imglib2.view.Views.invertAxis()
方法的一些代码示例,展示了Views.invertAxis()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Views.invertAxis()
方法的具体详情如下:
包路径:net.imglib2.view.Views
类名称:Views
方法名:invertAxis
[英]Invert the d-axis.
[中]反转d轴。
代码示例来源:origin: imagej/imagej-ops
@Override
public IntervalView<T> calculate(final RandomAccessibleInterval<T> input) {
return Views.invertAxis(input, d);
}
代码示例来源:origin: imagej/imagej-ops
@Override
public MixedTransformView<T> calculate(RandomAccessible<T> input) {
return Views.invertAxis(input, d);
}
代码示例来源:origin: net.imglib2/imglib2-script
/** Flip one axis of an image; for example, flip the orientation of the x axis.
* @param img
* @param dimension The index of the dimension to flip; x=0, y=1, z=2, ...
*/
public InvertAxis(final RandomAccessibleInterval<R> img, final int dimension) {
super(Views.zeroMin(Views.invertAxis(img, dimension)));
}
}
代码示例来源:origin: imglib/imglib2
/**
* Invert the d-axis.
*
* @param interval
* the source
* @param d
* the axis to invert
*/
public static < T > IntervalView< T > invertAxis( final RandomAccessibleInterval< T > interval, final int d )
{
final int n = interval.numDimensions();
final long[] min = new long[ n ];
final long[] max = new long[ n ];
interval.min( min );
interval.max( max );
final long tmp = min[ d ];
min[ d ] = -max[ d ];
max[ d ] = -tmp;
return Views.interval( Views.invertAxis( ( RandomAccessible< T > ) interval, d ), min, max );
}
代码示例来源:origin: net.imglib2/imglib2
/**
* Invert the d-axis.
*
* @param interval
* the source
* @param d
* the axis to invert
*/
public static < T > IntervalView< T > invertAxis( final RandomAccessibleInterval< T > interval, final int d )
{
final int n = interval.numDimensions();
final long[] min = new long[ n ];
final long[] max = new long[ n ];
interval.min( min );
interval.max( max );
final long tmp = min[ d ];
min[ d ] = -max[ d ];
max[ d ] = -tmp;
return Views.interval( Views.invertAxis( ( RandomAccessible< T > ) interval, d ), min, max );
}
代码示例来源:origin: imglib/imglib2
@Test
public void testFullSourceMapMixedAccess()
{
final long[] offset = new long[] { 1, 10, 0, -5 };
final long[] dim = new long[] { 10, 10, 10, 10 };
final RandomAccess< UnsignedByteType > a = Views.offsetInterval( Views.invertAxis( Views.hyperSlice( img, 2, 2 ), 3 ), offset, dim ).randomAccess();
assertTrue( FullSourceMapMixedRandomAccess.class.isInstance( a ) );
final long[] pos = new long[] { 28, 30, 2, 15 };
final long[] dist = new long[] { 2, 3, 4, 1 };
testlocalize( a, pos );
testfwd( a, pos );
testbck( a, pos );
testmove( a, pos, 3 );
testmove( a, pos, -2 );
testmove( a, pos, dist );
}
代码示例来源:origin: imagej/imagej-ops
@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);
}
}
}
代码示例来源:origin: imagej/imagej-ops
@Test
public void intervalInvertAxisTest() {
final Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
final IntervalView<DoubleType> il2 = Views.invertAxis(img, 1);
final IntervalView<DoubleType> opr = ops.transform().invertAxisView(img, 1);
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);
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!