当前位置: 首页>>代码示例>>Java>>正文


Java Cursor.getDoublePosition方法代码示例

本文整理汇总了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() );
	}
}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:18,代码来源:OpenAndDisplayInterpolated.java

示例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);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:17,代码来源:DefaultMoment11.java

示例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);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:21,代码来源:DefaultCentralMoment30.java

示例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);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:24,代码来源:DefaultCentralMoment21.java

示例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);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:22,代码来源:DefaultCentralMoment02.java

示例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);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:21,代码来源:DefaultCentralMoment03.java

示例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);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:21,代码来源:DefaultCentralMoment20.java

示例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));
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:24,代码来源:IterableCentralMoment11.java

示例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);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:23,代码来源:DefaultCentralMoment12.java

示例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);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:23,代码来源:DefaultCenterOfGravity.java

示例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);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:16,代码来源:DefaultMoment10.java

示例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);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:16,代码来源:DefaultMoment01.java

示例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;
}
 
开发者ID:fiji,项目名称:Colocalisation_Analysis,代码行数:33,代码来源:TestImageAccessor.java


注:本文中的net.imglib2.Cursor.getDoublePosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。