本文整理汇总了Java中net.imglib2.RealRandomAccessible.numDimensions方法的典型用法代码示例。如果您正苦于以下问题:Java RealRandomAccessible.numDimensions方法的具体用法?Java RealRandomAccessible.numDimensions怎么用?Java RealRandomAccessible.numDimensions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.imglib2.RealRandomAccessible
的用法示例。
在下文中一共展示了RealRandomAccessible.numDimensions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TransformedInterpolatedRealRandomAccess
import net.imglib2.RealRandomAccessible; //导入方法依赖的package包/类
public TransformedInterpolatedRealRandomAccess(
final RealRandomAccessible< T > realRandomAccessible,
final T zero,
final Interval transformedInterval,
final AffineTransform3D transform,
final int[] offset )
{
super( realRandomAccessible.numDimensions() );
this.transformedInterval = transformedInterval;
this.zero = zero;
this.realRandomAccessible = realRandomAccessible;
this.transform = transform;
this.offset = new int[ offset.length ];
for ( int d = 0; d < n; ++d )
this.offset[ d ] = offset[ d ];
this.realRandomAccess = realRandomAccessible.realRandomAccess();
final double[] imatrix = transform.inverse().getRowPackedCopy();
this.i00 = imatrix[ 0 ];
this.i01 = imatrix[ 1 ];
this.i02 = imatrix[ 2 ];
this.i03 = imatrix[ 3 ];
this.i10 = imatrix[ 4 ];
this.i11 = imatrix[ 5 ];
this.i12 = imatrix[ 6 ];
this.i13 = imatrix[ 7 ];
this.i20 = imatrix[ 8 ];
this.i21 = imatrix[ 9 ];
this.i22 = imatrix[ 10 ];
this.i23 = imatrix[ 11 ];
this.tmp = new float[ n ];
}
示例2: calculateCrossCorr
import net.imglib2.RealRandomAccessible; //导入方法依赖的package包/类
public <T extends RealType<T>, S extends RealType<S>> void calculateCrossCorr(RandomAccessibleInterval<T> img1, RandomAccessibleInterval<S> img2,
long minOverlapPx, boolean interpolateSubpixel)
{
Pair<Interval, Interval> intervals = PhaseCorrelation2Util.getOverlapIntervals(img1, img2, shift);
// no overlap found
if (intervals == null) {
crossCorr = Double.NEGATIVE_INFINITY;
nPixel = 0;
return;
}
nPixel = 1;
for (int i = 0; i< intervals.getA().numDimensions(); i++){
nPixel *= intervals.getA().dimension(i);
}
if (nPixel < minOverlapPx){
crossCorr = Double.NEGATIVE_INFINITY;
nPixel = 0;
return;
}
// for subpixel move the underlying Img2 by the subpixel offset
if ( subpixelShift != null && interpolateSubpixel )
{
RealRandomAccessible< S > rra = Views.interpolate( Views.extendMirrorSingle( img2 ), new NLinearInterpolatorFactory< S >() );
InvertibleRealTransform transform = null;
// e.g. subpixel = (-0.4, 0.1, -0.145)
final double tx = subpixelShift.getDoublePosition( 0 ) - shift.getDoublePosition( 0 );
final double ty = subpixelShift.getDoublePosition( 1 ) - shift.getDoublePosition( 1 );
if ( rra.numDimensions() == 2 )
transform = new Translation2D( -tx, -ty ); // -relative subpixel shift only
else if ( rra.numDimensions() == 3 )
transform = new Translation3D( -tx, -ty, shift.getDoublePosition( 2 ) - subpixelShift.getDoublePosition( 2 ) ); // -relative subpixel shift only
img2 = Views.interval( Views.raster( RealViews.transform( rra, transform ) ), img2 );
}
crossCorr = PhaseCorrelation2Util.getCorrelation(Views.zeroMin(Views.interval(img1, intervals.getA())), Views.zeroMin(Views.interval(img2, intervals.getB())));
}