|
2 | 2 |
|
3 | 3 | import net.imglib2.RandomAccessibleInterval; |
4 | 4 | import net.imglib2.algorithm.math.abstractions.IFunction; |
| 5 | +import net.imglib2.algorithm.math.abstractions.Util; |
| 6 | +import net.imglib2.converter.Converter; |
| 7 | +import net.imglib2.img.array.ArrayImgFactory; |
| 8 | +import net.imglib2.type.numeric.RealType; |
| 9 | +import net.imglib2.type.numeric.real.FloatType; |
5 | 10 |
|
6 | 11 | /** |
7 | 12 | * An easy yet high performance way to perform pixel-wise math |
@@ -73,6 +78,26 @@ static public final Compute compute( final IFunction operation ) |
73 | 78 | return new Compute( operation ); |
74 | 79 | } |
75 | 80 |
|
| 81 | + static public final RandomAccessibleInterval< FloatType > computeIntoFloat( final IFunction operation ) |
| 82 | + { |
| 83 | + return new Compute( operation ).into( new ArrayImgFactory< FloatType >( new FloatType() ).create( Util.findImg( operation ).iterator().next() ) ); |
| 84 | + } |
| 85 | + |
| 86 | + static public final < O extends RealType< O > > RandomAccessibleInterval< O > computeInto( |
| 87 | + final IFunction operation, |
| 88 | + final RandomAccessibleInterval< O > target ) |
| 89 | + { |
| 90 | + return new Compute( operation ).into( target ); |
| 91 | + } |
| 92 | + |
| 93 | + static public final < O extends RealType< O > > RandomAccessibleInterval< O > computeInto( |
| 94 | + final IFunction operation, |
| 95 | + final RandomAccessibleInterval< O > target, |
| 96 | + final Converter< RealType< ? >, O > converter ) |
| 97 | + { |
| 98 | + return new Compute( operation ).into( target, converter ); |
| 99 | + } |
| 100 | + |
76 | 101 | static public final Add add( final Object o1, final Object o2 ) |
77 | 102 | { |
78 | 103 | return new Add( o1, o2 ); |
|
0 commit comments