net.imglib2.img.planar.PlanarImg Java Examples

The following examples show how to use net.imglib2.img.planar.PlanarImg. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImgSaver.java    From scifio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * @return The number of planes in the provided {@link Img}.
 */
private int getPlaneCount(final Img<?> img) {
	// PlanarImg case
	if (PlanarImg.class.isAssignableFrom(img.getClass())) {
		final PlanarImg<?, ?> planarImg = (PlanarImg<?, ?>) img;
		return planarImg.numSlices();
	}
	// General case
	int count = 1;

	for (int d = 2; d < img.numDimensions(); d++) {
		count *= img.dimension(d);
	}

	return count;
}
 
Example #2
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(ops = {
	net.imagej.ops.math.ConstantToPlanarImage.MultiplyByte.class,
	net.imagej.ops.math.ConstantToPlanarImage.MultiplyUnsignedByte.class })
public <B extends GenericByteType<B>> PlanarImg<B, ByteArray> multiply(
	final PlanarImg<B, ByteArray> image, final byte value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<B, ByteArray> result = (PlanarImg<B, ByteArray>) ops().run(
		Ops.Math.Divide.NAME, image, value);
	return result;
}
 
Example #3
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(ops = {
	net.imagej.ops.math.ConstantToPlanarImage.SubtractShort.class,
	net.imagej.ops.math.ConstantToPlanarImage.SubtractUnsignedShort.class })
public <S extends GenericShortType<S>> PlanarImg<S, ShortArray> subtract(
	final PlanarImg<S, ShortArray> image, final short value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<S, ShortArray> result = (PlanarImg<S, ShortArray>) ops()
		.run(Ops.Math.Subtract.NAME, image, value);
	return result;
}
 
Example #4
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(ops = {
	net.imagej.ops.math.ConstantToPlanarImage.SubtractLong.class,
	net.imagej.ops.math.ConstantToPlanarImage.SubtractUnsignedLong.class })
public <N extends NativeType<N>, A extends ArrayDataAccess<A>> PlanarImg<N, A>
	subtract(final PlanarImg<N, A> image, final long value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<N, A> result = (PlanarImg<N, A>) ops().run(
		Ops.Math.Subtract.NAME, image, value);
	return result;
}
 
Example #5
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.SubtractInt.class,
	net.imagej.ops.math.ConstantToPlanarImage.SubtractUnsignedInt.class })
public <I extends GenericIntType<I>> PlanarImg<I, IntArray> subtract(
	final PlanarImg<I, IntArray> image, final int value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<I, IntArray> result = (PlanarImg<I, IntArray>) ops().run(
		Ops.Math.Subtract.NAME, image, value);
	return result;
}
 
Example #6
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(op = net.imagej.ops.math.ConstantToPlanarImage.SubtractFloat.class)
public PlanarImg<FloatType, FloatArray> subtract(
	final PlanarImg<FloatType, FloatArray> image, final float value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<FloatType, FloatArray> result =
		(PlanarImg<FloatType, FloatArray>) ops().run(
			net.imagej.ops.Ops.Math.Subtract.class, image, value);
	return result;
}
 
Example #7
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(op = net.imagej.ops.math.ConstantToPlanarImage.SubtractDouble.class)
public PlanarImg<DoubleType, DoubleArray> subtract(
	final PlanarImg<DoubleType, DoubleArray> image, final double value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<DoubleType, DoubleArray> result =
		(PlanarImg<DoubleType, DoubleArray>) ops().run(
			net.imagej.ops.Ops.Math.Subtract.class, image, value);
	return result;
}
 
Example #8
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(ops = {
	net.imagej.ops.math.ConstantToPlanarImage.SubtractByte.class,
	net.imagej.ops.math.ConstantToPlanarImage.SubtractUnsignedByte.class })
public <B extends GenericByteType<B>> PlanarImg<B, ByteArray> subtract(
	final PlanarImg<B, ByteArray> image, final byte value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<B, ByteArray> result = (PlanarImg<B, ByteArray>) ops().run(
		Ops.Math.Subtract.NAME, image, value);
	return result;
}
 
Example #9
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(ops = {
	net.imagej.ops.math.ConstantToPlanarImage.MultiplyShort.class,
	net.imagej.ops.math.ConstantToPlanarImage.MultiplyUnsignedShort.class })
public <S extends GenericShortType<S>> PlanarImg<S, ShortArray> multiply(
	final PlanarImg<S, ShortArray> arg, final short value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<S, ShortArray> result = (PlanarImg<S, ShortArray>) ops()
		.run(Ops.Math.Multiply.NAME, arg, value);
	return result;
}
 
Example #10
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(ops = {
	net.imagej.ops.math.ConstantToPlanarImage.MultiplyLong.class,
	net.imagej.ops.math.ConstantToPlanarImage.MultiplyUnsignedLong.class })
public <N extends NativeType<N>> PlanarImg<N, LongArray> multiply(
	final PlanarImg<N, LongArray> image, final long value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<N, LongArray> result = (PlanarImg<N, LongArray>) ops().run(
		Ops.Math.Multiply.NAME, image, value);
	return result;
}
 
Example #11
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.MultiplyInt.class,
	net.imagej.ops.math.ConstantToPlanarImage.MultiplyUnsignedInt.class })
public <I extends GenericIntType<I>> PlanarImg<I, IntArray> multiply(
	final PlanarImg<I, IntArray> image, final int value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<I, IntArray> result = (PlanarImg<I, IntArray>) ops().run(
		Ops.Math.Multiply.NAME, image, value);
	return result;
}
 
Example #12
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(op = net.imagej.ops.math.ConstantToPlanarImage.MultiplyFloat.class)
public PlanarImg<FloatType, FloatArray> multiply(
	final PlanarImg<FloatType, FloatArray> image, final float value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<FloatType, FloatArray> result =
		(PlanarImg<FloatType, FloatArray>) ops().run(
			net.imagej.ops.Ops.Math.Multiply.class, image, value);
	return result;
}
 
Example #13
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(op = net.imagej.ops.math.ConstantToPlanarImage.MultiplyDouble.class)
public PlanarImg<DoubleType, DoubleArray> multiply(
	final PlanarImg<DoubleType, DoubleArray> image, final double value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<DoubleType, DoubleArray> result =
		(PlanarImg<DoubleType, DoubleArray>) ops().run(
			net.imagej.ops.Ops.Math.Multiply.class, image, value);
	return result;
}
 
Example #14
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.AddByte.class,
	net.imagej.ops.math.ConstantToPlanarImage.AddUnsignedByte.class })
public <B extends GenericByteType<B>> PlanarImg<B, ByteArray> add(
	final PlanarImg<B, ByteArray> image, final byte value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<B, ByteArray> result = (PlanarImg<B, ByteArray>) ops().run(
		Ops.Math.Add.NAME, image, value);
	return result;
}
 
Example #15
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.DivideShort.class,
	net.imagej.ops.math.ConstantToPlanarImage.DivideUnsignedShort.class })
public <S extends GenericShortType<S>> PlanarImg<S, ShortArray> divide(
	final PlanarImg<S, ShortArray> arg, final short value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<S, ShortArray> result = (PlanarImg<S, ShortArray>) ops()
		.run(Ops.Math.Divide.NAME, arg, value);
	return result;
}
 
Example #16
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.DivideLong.class,
	net.imagej.ops.math.ConstantToPlanarImage.DivideUnsignedLong.class })
public <N extends NativeType<N>> PlanarImg<N, LongArray> divide(
	final PlanarImg<N, LongArray> image, final long value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<N, LongArray> result = (PlanarImg<N, LongArray>) ops().run(
		Ops.Math.Divide.NAME, image, value);
	return result;
}
 
Example #17
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.DivideInt.class,
	net.imagej.ops.math.ConstantToPlanarImage.DivideUnsignedInt.class })
public <I extends GenericIntType<I>> PlanarImg<I, IntArray> divide(
	final PlanarImg<I, IntArray> image, final int value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<I, IntArray> result = (PlanarImg<I, IntArray>) ops().run(
		Ops.Math.Divide.NAME, image, value);
	return result;
}
 
Example #18
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(op = net.imagej.ops.math.ConstantToPlanarImage.DivideFloat.class)
public PlanarImg<FloatType, FloatArray> divide(
	final PlanarImg<FloatType, FloatArray> image, final float value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<FloatType, FloatArray> result =
		(PlanarImg<FloatType, FloatArray>) ops().run(
			net.imagej.ops.Ops.Math.Divide.class, image, value);
	return result;
}
 
Example #19
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(op = net.imagej.ops.math.ConstantToPlanarImage.DivideDouble.class)
public PlanarImg<DoubleType, DoubleArray> divide(
	final PlanarImg<DoubleType, DoubleArray> image, final double value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<DoubleType, DoubleArray> result =
		(PlanarImg<DoubleType, DoubleArray>) ops().run(
			net.imagej.ops.Ops.Math.Divide.class, image, value);
	return result;
}
 
Example #20
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.DivideByte.class,
	net.imagej.ops.math.ConstantToPlanarImage.DivideUnsignedByte.class })
public <B extends GenericByteType<B>> PlanarImg<B, ByteArray> divide(
	final PlanarImg<B, ByteArray> image, final byte value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<B, ByteArray> result = (PlanarImg<B, ByteArray>) ops().run(
		Ops.Math.Divide.NAME, image, value);
	return result;
}
 
Example #21
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.AddShort.class,
	net.imagej.ops.math.ConstantToPlanarImage.AddUnsignedShort.class })
public <S extends GenericShortType<S>> PlanarImg<S, ShortArray> add(
	final PlanarImg<S, ShortArray> arg, final short value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<S, ShortArray> result = (PlanarImg<S, ShortArray>) ops()
		.run(Ops.Math.Add.NAME, arg, value);
	return result;
}
 
Example #22
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.AddLong.class,
	net.imagej.ops.math.ConstantToPlanarImage.AddUnsignedLong.class })
public <N extends NativeType<N>> PlanarImg<N, LongArray> add(
	final PlanarImg<N, LongArray> image, final long value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<N, LongArray> result = (PlanarImg<N, LongArray>) ops().run(
		Ops.Math.Add.NAME, image, value);
	return result;
}
 
Example #23
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.AddInt.class,
	net.imagej.ops.math.ConstantToPlanarImage.AddUnsignedInt.class })
public <I extends GenericIntType<I>> PlanarImg<I, IntArray> add(
	final PlanarImg<I, IntArray> image, final int value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<I, IntArray> result = (PlanarImg<I, IntArray>) ops().run(
		Ops.Math.Add.NAME, image, value);
	return result;
}
 
Example #24
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(op = net.imagej.ops.math.ConstantToPlanarImage.AddFloat.class)
public PlanarImg<FloatType, FloatArray> add(
	final PlanarImg<FloatType, FloatArray> image, final float value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<FloatType, FloatArray> result =
		(PlanarImg<FloatType, FloatArray>) ops().run(
			net.imagej.ops.Ops.Math.Add.class, image, value);
	return result;
}
 
Example #25
Source File: MathNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(op = net.imagej.ops.math.ConstantToPlanarImage.AddDouble.class)
public PlanarImg<DoubleType, DoubleArray> add(
	final PlanarImg<DoubleType, DoubleArray> image, final double value)
{
	@SuppressWarnings("unchecked")
	final PlanarImg<DoubleType, DoubleArray> result =
		(PlanarImg<DoubleType, DoubleArray>) ops().run(
			net.imagej.ops.Ops.Math.Add.class, image, value);
	return result;
}