本文整理汇总了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();
}
示例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);
}
示例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);
}
示例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 );
}
示例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)));
}
示例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();
}
示例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;
}
示例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();
}
示例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);
}
示例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);
}
}
示例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
}