Skip to content

Commit e2fa1fe

Browse files
authored
Merge pull request #87 from imglib/io-package
ImgMath updates
2 parents 1096528 + cc919c6 commit e2fa1fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1284
-47
lines changed

pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ Jean-Yves Tinevez and Michael Zinsmaier.</license.copyrightOwners>
200200

201201
<!-- NB: Deploy releases to the SciJava Maven repository. -->
202202
<releaseProfiles>deploy-to-scijava</releaseProfiles>
203+
204+
<imglib2.version>5.10.0</imglib2.version>
203205
</properties>
204206

205207
<repositories>

src/main/java/net/imglib2/algorithm/math/Add.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import net.imglib2.algorithm.math.abstractions.ABinaryFunction;
66
import net.imglib2.algorithm.math.abstractions.OFunction;
77
import net.imglib2.algorithm.math.execution.Addition;
8+
import net.imglib2.algorithm.math.execution.LetBinding;
89
import net.imglib2.algorithm.math.execution.Variable;
910
import net.imglib2.converter.Converter;
1011
import net.imglib2.type.numeric.RealType;
@@ -24,7 +25,7 @@ public Add( final Object... obs )
2425
@Override
2526
public < O extends RealType< O > > Addition< O > reInit(
2627
final O tmp,
27-
final Map< String, O > bindings,
28+
final Map< String, LetBinding< O > > bindings,
2829
final Converter< RealType< ? >, O > converter,
2930
final Map< Variable< O >, OFunction< O > > imgSources )
3031
{

src/main/java/net/imglib2/algorithm/math/Compute.java

Lines changed: 401 additions & 14 deletions
Large diffs are not rendered by default.

src/main/java/net/imglib2/algorithm/math/Div.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import net.imglib2.algorithm.math.abstractions.ABinaryFunction;
66
import net.imglib2.algorithm.math.abstractions.OFunction;
77
import net.imglib2.algorithm.math.execution.Division;
8+
import net.imglib2.algorithm.math.execution.LetBinding;
89
import net.imglib2.algorithm.math.execution.Variable;
910
import net.imglib2.converter.Converter;
1011
import net.imglib2.type.numeric.RealType;
@@ -25,7 +26,7 @@ public Div( final Object... obs )
2526
@Override
2627
public < O extends RealType< O > > Division< O > reInit(
2728
final O tmp,
28-
final Map< String, O > bindings,
29+
final Map< String, LetBinding< O > > bindings,
2930
final Converter< RealType< ? >, O > converter,
3031
final Map< Variable< O >, OFunction< O > > imgSources )
3132
{

src/main/java/net/imglib2/algorithm/math/Equal.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import net.imglib2.algorithm.math.abstractions.Compare;
66
import net.imglib2.algorithm.math.abstractions.OFunction;
77
import net.imglib2.algorithm.math.execution.Equality;
8+
import net.imglib2.algorithm.math.execution.LetBinding;
89
import net.imglib2.algorithm.math.execution.Variable;
910
import net.imglib2.converter.Converter;
1011
import net.imglib2.type.numeric.RealType;
@@ -19,7 +20,7 @@ public Equal( final Object o1, final Object o2 )
1920
@Override
2021
public < O extends RealType< O > > OFunction< O > reInit(
2122
final O tmp,
22-
final Map< String, O > bindings,
23+
final Map< String, LetBinding< O > > bindings,
2324
final Converter< RealType< ? >, O > converter,
2425
final Map< Variable< O >, OFunction< O > > imgSources )
2526
{
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package net.imglib2.algorithm.math;
2+
3+
import java.util.Map;
4+
5+
import net.imglib2.algorithm.math.abstractions.AUnaryFunction;
6+
import net.imglib2.algorithm.math.abstractions.OFunction;
7+
import net.imglib2.algorithm.math.execution.Exponential;
8+
import net.imglib2.algorithm.math.execution.LetBinding;
9+
import net.imglib2.algorithm.math.execution.Variable;
10+
import net.imglib2.converter.Converter;
11+
import net.imglib2.type.numeric.RealType;
12+
13+
public final class Exp extends AUnaryFunction
14+
{
15+
public Exp( final Object o1 )
16+
{
17+
super( o1 );
18+
}
19+
20+
@Override
21+
public < O extends RealType< O > > Exponential< O > reInit(
22+
final O tmp,
23+
final Map< String, LetBinding< O > > bindings,
24+
final Converter< RealType< ? >, O > converter,
25+
final Map< Variable< O >, OFunction< O > > imgSources )
26+
{
27+
return new Exponential< O >( tmp.copy(),
28+
this.a.reInit( tmp, bindings, converter, imgSources ) );
29+
}
30+
}

src/main/java/net/imglib2/algorithm/math/GreaterThan.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import net.imglib2.algorithm.math.abstractions.Compare;
66
import net.imglib2.algorithm.math.abstractions.OFunction;
77
import net.imglib2.algorithm.math.execution.IsGreaterThan;
8+
import net.imglib2.algorithm.math.execution.LetBinding;
89
import net.imglib2.algorithm.math.execution.Variable;
910
import net.imglib2.converter.Converter;
1011
import net.imglib2.type.numeric.RealType;
@@ -19,7 +20,7 @@ public GreaterThan( final Object o1, final Object o2 )
1920
@Override
2021
public < O extends RealType< O > > IsGreaterThan< O > reInit(
2122
final O tmp,
22-
final Map< String, O > bindings,
23+
final Map< String, LetBinding< O > > bindings,
2324
final Converter< RealType< ? >, O > converter,
2425
final Map< Variable< O >, OFunction< O > > imgSources )
2526
{

src/main/java/net/imglib2/algorithm/math/If.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public If( final Object o1, final Object o2, final Object o3 )
2424
@Override
2525
public < O extends RealType< O > > OFunction< O > reInit(
2626
final O tmp,
27-
final Map< String, O > bindings,
27+
final Map< String, LetBinding< O > > bindings,
2828
final Converter< RealType< ? >, O > converter,
2929
final Map< Variable< O >, OFunction< O > > imgSources )
3030
{

src/main/java/net/imglib2/algorithm/math/ImgMath.java

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import net.imglib2.algorithm.math.abstractions.Util;
66
import net.imglib2.converter.Converter;
77
import net.imglib2.img.array.ArrayImgFactory;
8+
import net.imglib2.type.NativeType;
89
import net.imglib2.type.numeric.RealType;
910
import net.imglib2.type.numeric.real.FloatType;
1011

@@ -98,6 +99,16 @@ static public final < O extends RealType< O > > RandomAccessibleInterval< O > co
9899
return new Compute( operation ).into( target, converter );
99100
}
100101

102+
static public final < O extends NativeType< O > & RealType< O > > RandomAccessibleInterval< O > computeIntoImg( final IFunction operation )
103+
{
104+
return compute( operation ).intoImg();
105+
}
106+
107+
static public final < O extends NativeType< O > & RealType< O > > RandomAccessibleInterval< O > computeIntoArrayImg( final IFunction operation )
108+
{
109+
return compute( operation ).intoArrayImg();
110+
}
111+
101112
static public final Add add( final Object o1, final Object o2 )
102113
{
103114
return new Add( o1, o2 );
@@ -138,6 +149,26 @@ static public final Div div( final Object... obs )
138149
return new Div( obs );
139150
}
140151

152+
static public final Pow pow( final Object o1, final Object o2 )
153+
{
154+
return new Pow( o1, o2 );
155+
}
156+
157+
static public final Pow power( final Object... obs )
158+
{
159+
return new Pow( obs );
160+
}
161+
162+
static public final Pow power( final Object o1, final Object o2 )
163+
{
164+
return new Pow( o1, o2 );
165+
}
166+
167+
static public final Pow pow( final Object... obs )
168+
{
169+
return new Pow( obs );
170+
}
171+
141172
static public final Max max( final Object o1, final Object o2 )
142173
{
143174
return new Max( o1, o2 );
@@ -178,6 +209,21 @@ static public final Min minimum( final Object... obs )
178209
return new Min( obs );
179210
}
180211

212+
static public final Log log( final Object o1 )
213+
{
214+
return new Log( o1 );
215+
}
216+
217+
static public final Log logarithm( final Object o1 )
218+
{
219+
return new Log( o1 );
220+
}
221+
222+
static public final Exp exp( final Object o1 )
223+
{
224+
return new Exp( o1 );
225+
}
226+
181227
static public final Let let( final String varName, final Object varValue, final Object body )
182228
{
183229
return new Let( varName, varValue, body );
@@ -203,21 +249,41 @@ static public final Equal EQ( final Object o1, final Object o2 )
203249
return new Equal( o1, o2 );
204250
}
205251

252+
static public final Equal equal( final Object o1, final Object o2 )
253+
{
254+
return new Equal( o1, o2 );
255+
}
256+
206257
static public final NotEqual NEQ( final Object o1, final Object o2 )
207258
{
208259
return new NotEqual( o1, o2 );
209260
}
210261

262+
static public final NotEqual notEqual( final Object o1, final Object o2 )
263+
{
264+
return new NotEqual( o1, o2 );
265+
}
266+
211267
static public final LessThan LT( final Object o1, final Object o2 )
212268
{
213269
return new LessThan( o1, o2 );
214270
}
215271

272+
static public final LessThan lessThan( final Object o1, final Object o2 )
273+
{
274+
return new LessThan( o1, o2 );
275+
}
276+
216277
static public final GreaterThan GT( final Object o1, final Object o2 )
217278
{
218279
return new GreaterThan( o1, o2 );
219280
}
220281

282+
static public final GreaterThan greaterThan( final Object o1, final Object o2 )
283+
{
284+
return new GreaterThan( o1, o2 );
285+
}
286+
221287
static public final If IF( final Object o1, final Object o2, final Object o3 )
222288
{
223289
return new If( o1, o2, o3 );

src/main/java/net/imglib2/algorithm/math/ImgSource.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import net.imglib2.algorithm.math.abstractions.ViewableFunction;
99
import net.imglib2.algorithm.math.execution.ImgSourceIterable;
1010
import net.imglib2.algorithm.math.execution.ImgSourceIterableDirect;
11+
import net.imglib2.algorithm.math.execution.LetBinding;
1112
import net.imglib2.algorithm.math.execution.Variable;
1213
import net.imglib2.converter.Converter;
1314
import net.imglib2.type.numeric.RealType;
@@ -25,7 +26,7 @@ public ImgSource( final RandomAccessibleInterval< I > rai )
2526
@Override
2627
public < O extends RealType< O > > OFunction< O > reInit(
2728
final O tmp,
28-
final Map< String, O > bindings,
29+
final Map< String, LetBinding< O > > bindings,
2930
final Converter< RealType< ? >, O > converter,
3031
final Map< Variable< O >, OFunction< O > > imgSources )
3132
{

0 commit comments

Comments
 (0)