本文整理汇总了Java中net.imglib2.Cursor.getDoublePosition方法的典型用法代码示例。如果您正苦于以下问题:Java Cursor.getDoublePosition方法的具体用法?Java Cursor.getDoublePosition怎么用?Java Cursor.getDoublePosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.imglib2.Cursor
的用法示例。
在下文中一共展示了Cursor.getDoublePosition方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyInterpolatedGeneric
import net.imglib2.Cursor; //导入方法依赖的package包/类
public static <T extends NumericType< T > > void copyInterpolatedGeneric( RandomAccessible< T > from, IterableInterval< T > to, double[] offset, double scale, InterpolatorFactory< T, RandomAccessible< T > > interpolatorFactory )
{
final int n = to.numDimensions();
final double[] fromPosition = new double[ n ];
Cursor< T > cursor = to.localizingCursor();
RealRandomAccess< T > interpolator = interpolatorFactory.create( from );
while ( cursor.hasNext() )
{
final T t = cursor.next();
for ( int d = 0; d < n; ++d )
{
fromPosition[ d ] = scale * cursor.getDoublePosition( d ) + offset[ d ];
}
interpolator.setPosition( fromPosition );
t.set( interpolator.get() );
}
}
示例2: compute
import net.imglib2.Cursor; //导入方法依赖的package包/类
@Override
public void compute(final IterableInterval<I> input, final O output) {
double moment11 = 0;
final Cursor<I> cur = input.localizingCursor();
while (cur.hasNext()) {
cur.fwd();
double x = cur.getDoublePosition(0);
double y = cur.getDoublePosition(1);
double val = cur.get().getRealDouble();
moment11 += x * y * val;
}
output.setReal(moment11);
}
示例3: compute
import net.imglib2.Cursor; //导入方法依赖的package包/类
@Override
public void compute(final IterableInterval<I> input, final O output) {
final double moment00 = moment00Func.calculate(input).getRealDouble();
final double moment10 = moment10Func.calculate(input).getRealDouble();
final double centerX = moment10 / moment00;
double centralmoment30 = 0;
final Cursor<I> it = input.localizingCursor();
while (it.hasNext()) {
it.fwd();
final double x = it.getDoublePosition(0) - centerX;
final double val = it.get().getRealDouble();
centralmoment30 += val * x * x * x;
}
output.setReal(centralmoment30);
}
示例4: compute
import net.imglib2.Cursor; //导入方法依赖的package包/类
@Override
public void compute(final IterableInterval<I> input, final O output) {
final double moment00 = moment00Func.calculate(input).getRealDouble();
final double moment01 = moment01Func.calculate(input).getRealDouble();
final double moment10 = moment10Func.calculate(input).getRealDouble();
final double centerX = moment10 / moment00;
final double centerY = moment01 / moment00;
double centralmoment21 = 0;
final Cursor<I> it = input.localizingCursor();
while (it.hasNext()) {
it.fwd();
final double x = it.getDoublePosition(0) - centerX;
final double y = it.getDoublePosition(1) - centerY;
final double val = it.get().getRealDouble();
centralmoment21 += val * x * x * y;
}
output.setReal(centralmoment21);
}
示例5: compute
import net.imglib2.Cursor; //导入方法依赖的package包/类
@Override
public void compute(final IterableInterval<I> input, final O output) {
final double moment00 = moment00Func.calculate(input).getRealDouble();
final double moment01 = moment01Func.calculate(input).getRealDouble();
final double centerY = moment01 / moment00;
double centralmoment02 = 0;
final Cursor<I> it = input.localizingCursor();
while (it.hasNext()) {
it.fwd();
final double y = it.getDoublePosition(1) - centerY;
final double val = it.get().getRealDouble();
centralmoment02 += val * y * y;
}
output.setReal(centralmoment02);
}
示例6: compute
import net.imglib2.Cursor; //导入方法依赖的package包/类
@Override
public void compute(final IterableInterval<I> input, final O output) {
final double moment00 = moment00Func.calculate(input).getRealDouble();
final double moment01 = moment01Func.calculate(input).getRealDouble();
final double centerY = moment01 / moment00;
double centralmoment03 = 0;
final Cursor<I> it = input.localizingCursor();
while (it.hasNext()) {
it.fwd();
final double y = it.getDoublePosition(1) - centerY;
final double val = it.get().getRealDouble();
centralmoment03 += val * y * y * y;
}
output.setReal(centralmoment03);
}
示例7: compute
import net.imglib2.Cursor; //导入方法依赖的package包/类
@Override
public void compute(final IterableInterval<I> input, final O output) {
final double moment00 = moment00Func.calculate(input).getRealDouble();
final double moment10 = moment10Func.calculate(input).getRealDouble();
final double centerX = moment10 / moment00;
double centralmoment20 = 0;
final Cursor<I> it = input.localizingCursor();
while (it.hasNext()) {
it.fwd();
final double x = it.getDoublePosition(0) - centerX;
final double val = it.get().getRealDouble();
centralmoment20 += val * x * x;
}
output.setReal(centralmoment20);
}
示例8: compute
import net.imglib2.Cursor; //导入方法依赖的package包/类
@Override
public void compute(final IterableInterval<I> input, final O output) {
double moment00 = 0d;
double moment01 = 0d;
double moment10 = 0d;
double moment11 = 0d;
final Cursor<I> cursor = input.localizingCursor();
while (cursor.hasNext()) {
cursor.fwd();
final double x = cursor.getDoublePosition(0);
final double y = cursor.getDoublePosition(1);
final double val = cursor.get().getRealDouble();
moment00 += val;
moment01 += y * val;
moment10 += x * val;
moment11 += x * y * val;
}
double centerx = moment10 / moment00;
output.setReal(moment11 - (centerx * moment01));
}
示例9: compute
import net.imglib2.Cursor; //导入方法依赖的package包/类
@Override
public void compute(final IterableInterval<I> input, final O output) {
final double moment00 = moment00Func.calculate(input).getRealDouble();
final double moment01 = moment01Func.calculate(input).getRealDouble();
final double moment10 = moment10Func.calculate(input).getRealDouble();
final double centerX = moment10 / moment00;
final double centerY = moment01 / moment00;
double centralmoment12 = 0;
final Cursor<I> it = input.localizingCursor();
while (it.hasNext()) {
it.fwd();
final double x = it.getDoublePosition(0) - centerX;
final double y = it.getDoublePosition(1) - centerY;
final double val = it.get().getRealDouble();
centralmoment12 += val * x * y * y;
}
output.setReal(centralmoment12);
}
示例10: calculate
import net.imglib2.Cursor; //导入方法依赖的package包/类
@Override
public RealLocalizable calculate(final IterableInterval<T> input) {
final int numDimensions = input.numDimensions();
final double[] output = new double[numDimensions];
final double[] intensityValues = new double[numDimensions];
final Cursor<T> c = input.localizingCursor();
while (c.hasNext()) {
c.fwd();
for (int i = 0; i < output.length; i++) {
output[i] += c.getDoublePosition(i) * c.get().getRealDouble();
intensityValues[i] += c.get().getRealDouble();
}
}
for (int i = 0; i < output.length; i++) {
output[i] = output[i] / intensityValues[i];
}
return new RealPoint(output);
}
示例11: compute
import net.imglib2.Cursor; //导入方法依赖的package包/类
@Override
public void compute(final IterableInterval<I> input, final O output) {
double moment10 = 0;
final Cursor<I> cur = input.localizingCursor();
while (cur.hasNext()) {
cur.fwd();
double x = cur.getDoublePosition(0);
double val = cur.get().getRealDouble();
moment10 += x * val;
}
output.setReal(moment10);
}
示例12: compute
import net.imglib2.Cursor; //导入方法依赖的package包/类
@Override
public void compute(final IterableInterval<I> input, final O output) {
double moment01 = 0;
final Cursor<I> cur = input.localizingCursor();
while (cur.hasNext()) {
cur.fwd();
double y = cur.getDoublePosition(1);
double val = cur.get().getRealDouble();
moment01 += y * val;
}
output.setReal(moment01);
}
示例13: producePerlinNoiseImage
import net.imglib2.Cursor; //导入方法依赖的package包/类
/**
* Generates a Perlin noise image. It is based on Ken Perlin's
* reference implementation (ImprovedNoise class) and a small
* bit of Kas Thomas' sample code (http://asserttrue.blogspot.com/).
*/
public static <T extends RealType<T> & NativeType<T>> RandomAccessibleInterval<T> producePerlinNoiseImage(T type, int width,
int height, double z, double scale) {
// create the new image
ImgFactory<T> imgFactory = new ArrayImgFactory<T>();
RandomAccessibleInterval<T> noiseImage = imgFactory.create( new int[] {width, height}, type);
Cursor<T> noiseCursor = Views.iterable(noiseImage).localizingCursor();
double xOffset = Math.random() * (width*width);
double yOffset = Math.random() * (height*height);
while (noiseCursor.hasNext()) {
noiseCursor.fwd();
double x = (noiseCursor.getDoublePosition(0) + xOffset) * scale;
double y = (noiseCursor.getDoublePosition(1) + yOffset) * scale;
float t = (float)ImprovedNoise.noise( x, y, z);
// ImprovedNoise.noise returns a float in the range [-1..1],
// whereas we want a float in the range [0..1], so:
t = (1 + t) * 0.5f;
noiseCursor.get().setReal(t);
}
//return gaussianSmooth(noiseImage, imgFactory, smoothingSigma);
return noiseImage;
}