use of net.imglib2.type.numeric.integer.LongType in project imagej-ops by imagej.
the class UnaryRealTypeMathTest method testPower.
@Test
public void testPower() {
final LongType in = new LongType(1234567890);
final DoubleType out = new DoubleType();
ops.run(PowerConstant.class, out, in, 1.5);
assertEquals(out.get(), Math.pow(1234567890, 1.5), 0.0);
}
use of net.imglib2.type.numeric.integer.LongType in project imagej-ops by imagej.
the class UnaryRealTypeMathTest method testLog.
@Test
public void testLog() {
final LongType in = new LongType(1234567890);
final DoubleType out = new DoubleType();
ops.run(Log.class, out, in);
assertEquals(out.get(), Math.log(1234567890), 0.0);
}
use of net.imglib2.type.numeric.integer.LongType in project imagej-ops by imagej.
the class UnaryRealTypeMathTest method testArctanh.
@Test
public void testArctanh() {
final LongType in = new LongType(1234567890);
final DoubleType out = new DoubleType();
ops.run(Arctanh.class, out, in);
assertEquals(out.get(), 0.5 * Math.log(1234567891.0 / -1234567889.0), 0.0);
}
use of net.imglib2.type.numeric.integer.LongType in project imagej-ops by imagej.
the class UnaryRealTypeMathTest method testCos.
@Test
public void testCos() {
final LongType in = new LongType(1234567890);
final DoubleType out = new DoubleType();
ops.run(Cos.class, out, in);
assertEquals(out.get(), Math.cos(1234567890), 0.0);
}
use of net.imglib2.type.numeric.integer.LongType in project imagej-ops by imagej.
the class DefaultLBP2D method compute.
@SuppressWarnings("unchecked")
@Override
public void compute(RandomAccessibleInterval<I> input, ArrayList<LongType> output) {
ArrayList<LongType> numberList = new ArrayList<>();
RandomAccess<I> raInput = Views.extendZero(input).randomAccess();
final Cursor<I> cInput = Views.flatIterable(input).cursor();
final ClockwiseDistanceNeighborhoodIterator<I> cNeigh = new ClockwiseDistanceNeighborhoodIterator<>(raInput, distance);
while (cInput.hasNext()) {
cInput.next();
double centerValue = cInput.get().getRealDouble();
int resultBinaryValue = 0;
cNeigh.reset();
while (cNeigh.hasNext()) {
double nValue = cNeigh.next().getRealDouble();
int pos = cNeigh.getIndex();
if (nValue >= centerValue) {
resultBinaryValue |= (1 << pos);
}
}
numberList.add(new LongType(resultBinaryValue));
}
Histogram1d<Integer> hist = histOp.calculate(numberList);
Iterator<LongType> c = hist.iterator();
while (c.hasNext()) {
output.add(new LongType(c.next().get()));
}
}
Aggregations