當前位置: 首頁>>代碼示例>>Java>>正文


Java OutOfBoundsConstantValueFactory類代碼示例

本文整理匯總了Java中net.imglib2.outofbounds.OutOfBoundsConstantValueFactory的典型用法代碼示例。如果您正苦於以下問題:Java OutOfBoundsConstantValueFactory類的具體用法?Java OutOfBoundsConstantValueFactory怎麽用?Java OutOfBoundsConstantValueFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


OutOfBoundsConstantValueFactory類屬於net.imglib2.outofbounds包,在下文中一共展示了OutOfBoundsConstantValueFactory類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initialize

import net.imglib2.outofbounds.OutOfBoundsConstantValueFactory; //導入依賴的package包/類
@Override
public void initialize() {

	// the out of bounds factory will be different depending on wether we are
	// using circulant or non-circulant
	if (this.getOBFInput() == null) {

		if (!nonCirculant) {
			setOBFInput(new OutOfBoundsMirrorFactory<>(Boundary.SINGLE));
		}
		else if (nonCirculant) {
			setOBFInput(new OutOfBoundsConstantValueFactory<>(Util
				.getTypeFromInterval(in()).createVariable()));
		}
	}

	computeEstimateOp = getComputeEstimateOp();

	super.initialize();

}
 
開發者ID:imagej,項目名稱:imagej-ops,代碼行數:22,代碼來源:RichardsonLucyF.java

示例2: initialize

import net.imglib2.outofbounds.OutOfBoundsConstantValueFactory; //導入依賴的package包/類
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void initialize() {
	maxVal = Util.getTypeFromInterval(in()).createVariable();
	maxVal.setReal(maxVal.getMaxValue());

	if (f == null) {
		f = new OutOfBoundsConstantValueFactory<>(
			maxVal);
	}

	final UnaryComputerOp neighborComputer = maxVal instanceof BitType
		? new ErodeBitType() : Computers.unary(ops(), Ops.Stats.Min.class, maxVal
			.createVariable(), Iterable.class);

	imgCreator = (UnaryFunctionOp) Functions.unary(ops(), Ops.Create.Img.class,
		Img.class, in(), maxVal.createVariable());

	if (out() == null) setOutput(createOutput(in()));

	mapper = ops().op(MapNeighborhood.class, out(), in1(), in2(),
		neighborComputer);
}
 
開發者ID:imagej,項目名稱:imagej-ops,代碼行數:24,代碼來源:DefaultErode.java

示例3: initialize

import net.imglib2.outofbounds.OutOfBoundsConstantValueFactory; //導入依賴的package包/類
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void initialize() {
	minVal = Util.getTypeFromInterval(in()).createVariable();
	minVal.setReal(minVal.getMinValue());

	if (f == null) {
		f = new OutOfBoundsConstantValueFactory<>(
			minVal);
	}

	final UnaryComputerOp neighborComputer = minVal instanceof BitType
		? new DilateBitType() : Computers.unary(ops(), Ops.Stats.Max.class, minVal
			.createVariable(), Iterable.class);

	imgCreator = (UnaryFunctionOp) Functions.unary(ops(), Ops.Create.Img.class,
		Img.class, in(), minVal.createVariable());

	if (out() == null) setOutput(createOutput(in()));

	mapper = ops().op(MapNeighborhood.class, out(), in1(), in2(),
		neighborComputer);
}
 
開發者ID:imagej,項目名稱:imagej-ops,代碼行數:24,代碼來源:DefaultDilate.java

示例4: createValueExtended

import net.imglib2.outofbounds.OutOfBoundsConstantValueFactory; //導入依賴的package包/類
/**
 * @param source
 *            Source to be wrapped.
 * @param stepSize
 *            Strides for each dimension.
 * @param value
 *            Value for extending source.
 * @return BlockedInterval wrapped around value extended source.
 */
public static < U extends Type< U > > BlockedInterval< U > createValueExtended(
		RandomAccessibleInterval< U > source,
		long[] stepSize,
		U value )
{
	OutOfBoundsConstantValueFactory< U, RandomAccessibleInterval< U >> factory =
			new OutOfBoundsConstantValueFactory< U, RandomAccessibleInterval< U > >( value );
	return new BlockedInterval< U >( source, stepSize, factory );
}
 
開發者ID:saalfeldlab,項目名稱:bigcat,代碼行數:19,代碼來源:BlockedInterval.java

示例5: AbstractAffine3D

import net.imglib2.outofbounds.OutOfBoundsConstantValueFactory; //導入依賴的package包/類
/** With a default {@link OutOfBoundsStrategyValueFactory} with @param outside. */
@SuppressWarnings("unchecked")
public AbstractAffine3D(final Img<T> img,
		final float scaleX, final float shearX,
		final float shearY, final float scaleY,
		final float translateX, final float translateY,
		final Mode mode, final Number outside) throws Exception {
	this(img, new float[]{scaleX, shearX, 0, translateX,
			  			   shearY, scaleY, 0, translateY,
			  			   0, 0, 1, 0}, mode, new OutOfBoundsConstantValueFactory<T,Img<T>>((T)withValue(img, img.firstElement().createVariable(), outside)));
}
 
開發者ID:imglib,項目名稱:imglib2-script,代碼行數:12,代碼來源:AbstractAffine3D.java

示例6: processRGBA

import net.imglib2.outofbounds.OutOfBoundsConstantValueFactory; //導入依賴的package包/類
@SuppressWarnings("unchecked")
static private final Img<ARGBType> processRGBA(final Img<ARGBType> img, final float[] m,
		final Mode mode, final OutOfBoundsFactory<ARGBType,Img<ARGBType>> oobf) throws Exception {
	// Process each channel independently and then compose them back
	OutOfBoundsFactory<FloatType,Img<FloatType>> ored, ogreen, oblue, oalpha;
	if (OutOfBoundsConstantValueFactory.class.isAssignableFrom(oobf.getClass())) { // can't use instanceof
		final int val = ((OutOfBoundsConstantValueFactory<ARGBType,Img<ARGBType>>)oobf).getValue().get();
		ored = new OutOfBoundsConstantValueFactory<FloatType,Img<FloatType>>(new FloatType((val >> 16) & 0xff));
		ogreen = new OutOfBoundsConstantValueFactory<FloatType,Img<FloatType>>(new FloatType((val >> 8) & 0xff));
		oblue = new OutOfBoundsConstantValueFactory<FloatType,Img<FloatType>>(new FloatType(val & 0xff));
		oalpha = new OutOfBoundsConstantValueFactory<FloatType,Img<FloatType>>(new FloatType((val >> 24) & 0xff));
	} else {
		// Jump into the pool!
		try {
			ored = oobf.getClass().newInstance();
		} catch (Exception e) {
			System.out.println("Affine3D for RGBA: oops -- using a black OutOfBoundsStrategyValueFactory");
			ored = new OutOfBoundsConstantValueFactory<FloatType,Img<FloatType>>(new FloatType());
		}
		ogreen = ored;
		oblue = ored;
		oalpha = ored;
	}
	return new RGBA(processReal(Compute.inFloats(new Red(img)), m, mode, ored),
					processReal(Compute.inFloats(new Green(img)), m, mode, ogreen),
					processReal(Compute.inFloats(new Blue(img)), m, mode, oblue),
					processReal(Compute.inFloats(new Alpha(img)), m, mode, oalpha)).asImage();
}
 
開發者ID:imglib,項目名稱:imglib2-script,代碼行數:29,代碼來源:AbstractAffine3D.java

示例7: calculate

import net.imglib2.outofbounds.OutOfBoundsConstantValueFactory; //導入依賴的package包/類
@Override
public RandomAccessibleInterval<O> calculate(
	final RandomAccessibleInterval<I> img,
	final RandomAccessibleInterval<K> kernel)
{

	RandomAccessibleInterval<O> out = createOutput(img, kernel);

	if (obf == null) {
		obf = new OutOfBoundsConstantValueFactory<>(Util.getTypeFromInterval(in())
			.createVariable());
	}

	// extend the input
	RandomAccessibleInterval<I> extendedIn = Views.interval(Views.extend(img,
		obf), img);

	OutOfBoundsFactory<O, RandomAccessibleInterval<O>> obfOutput =
		new OutOfBoundsConstantValueFactory<>(Util.getTypeFromInterval(out)
			.createVariable());

	// extend the output
	RandomAccessibleInterval<O> extendedOut = Views.interval(Views.extend(out,
		obfOutput), out);

	// ops().filter().convolve(extendedOut, extendedIn, kernel);
	convolver.compute(extendedIn, extendedOut);

	return out;
}
 
開發者ID:imagej,項目名稱:imagej-ops,代碼行數:31,代碼來源:ConvolveNaiveF.java

示例8: initialize

import net.imglib2.outofbounds.OutOfBoundsConstantValueFactory; //導入依賴的package包/類
@Override
public void initialize() {

	// if no OBF was passed in set default OBF for convolve to be constant value
	// of zero (zero-pad)
	if (this.getOBFInput() == null) {
		setOBFInput(new OutOfBoundsConstantValueFactory<>(Util
			.getTypeFromInterval(in()).createVariable()));
	}

	super.initialize();

}
 
開發者ID:imagej,項目名稱:imagej-ops,代碼行數:14,代碼來源:ConvolveFFTF.java

示例9: calculate

import net.imglib2.outofbounds.OutOfBoundsConstantValueFactory; //導入依賴的package包/類
@Override
@SuppressWarnings("unchecked")
public O calculate(final I input) {

	if (obf == null) {
		obf = new OutOfBoundsConstantValueFactory<>(
			Util.getTypeFromInterval(input).createVariable());
	}

	Interval inputInterval = paddingIntervalCentered.calculate(input,
		paddedDimensions);

	return (O) Views.interval(Views.extend(input, obf), inputInterval);
}
 
開發者ID:imagej,項目名稱:imagej-ops,代碼行數:15,代碼來源:PadInput.java

示例10: testDeconvolve

import net.imglib2.outofbounds.OutOfBoundsConstantValueFactory; //導入依賴的package包/類
@Test
public void testDeconvolve() {
	int[] size = new int[] { 225, 167 };
	int[] kernelSize = new int[] { 27, 39 };

	// create an input with a small sphere at the center
	Img<FloatType> in = new ArrayImgFactory<FloatType>().create(size,
		new FloatType());
	placeSphereInCenter(in);

	// create a kernel with a small sphere in the center
	Img<FloatType> kernel = new ArrayImgFactory<FloatType>().create(kernelSize,
		new FloatType());
	placeSphereInCenter(kernel);

	// convolve and calculate the sum of output
	@SuppressWarnings("unchecked")
	final Img<FloatType> convolved = (Img<FloatType>) ops.run(
		ConvolveFFTF.class, in, kernel);

	@SuppressWarnings("unchecked")
	final RandomAccessibleInterval<FloatType> deconvolved2 =
		(RandomAccessibleInterval<FloatType>) ops.run(RichardsonLucyF.class,
			convolved, kernel, null, new OutOfBoundsConstantValueFactory<>(Util
				.getTypeFromInterval(in).createVariable()), 10);

	assertEquals(size[0], deconvolved2.dimension(0));
	assertEquals(size[1], deconvolved2.dimension(1));
	final Cursor<FloatType> deconvolved2Cursor = Views.iterable(deconvolved2)
		.cursor();
	float[] deconvolved2Values = { 1.0936068E-14f, 2.9685445E-14f,
		4.280788E-15f, 3.032084E-18f, 1.1261E-39f, 0.0f, -8.7E-44f, -8.11881E-31f,
		-2.821192E-18f, 1.8687104E-20f, -2.927517E-23f, 1.2815774E-29f,
		-1.0611375E-19f, -5.2774515E-21f, -6.154334E-20f };
	for (int i = 0; i < deconvolved2Values.length; i++) {
		assertEquals(deconvolved2Values[i], deconvolved2Cursor.next().get(),
			0.0f);
	}
}
 
開發者ID:imagej,項目名稱:imagej-ops,代碼行數:40,代碼來源:DeconvolveTest.java

示例11: Affine3D

import net.imglib2.outofbounds.OutOfBoundsConstantValueFactory; //導入依賴的package包/類
/**
 * TODO
 * 
 * @param img The {@link Img} to transform.
 * @param matrix The values of the transformation matrix, ordered as explained above.
 * @param mode Either LINEAR or NEAREST_NEIGHBOR.
 */
public Affine3D(final Img<T> img, final float[] matrix, final Mode mode) throws Exception {
	this(img, matrix, mode, new OutOfBoundsConstantValueFactory<T,Img<T>>(img.firstElement().createVariable())); // default value is zero
}
 
開發者ID:imglib,項目名稱:imglib2-script,代碼行數:11,代碼來源:Affine3D.java


注:本文中的net.imglib2.outofbounds.OutOfBoundsConstantValueFactory類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。