Skip to content

Commit 9ac8b78

Browse files
committed
ImgMath: additional constructors for KDTreeSource
1 parent 08dd4a5 commit 9ac8b78

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package net.imglib2.algorithm.math;
22

3+
import java.util.List;
4+
35
import net.imglib2.Interval;
46
import net.imglib2.KDTree;
7+
import net.imglib2.Point;
58
import net.imglib2.RandomAccessible;
69
import net.imglib2.RandomAccessibleInterval;
710
import net.imglib2.algorithm.math.abstractions.IFunction;
@@ -407,6 +410,36 @@ static public final < T extends RealType< T > > IFunction source( final RandomAc
407410
return intervalSource( ( RandomAccessibleInterval< T > )src );
408411
return new RandomAccessibleSource< T >( src );
409412
}
413+
414+
static public final < T extends RealType< T > > KDTreeSource< T > gen( final List< Point > positions, final T value, final double radius )
415+
{
416+
return new KDTreeSource< T >( positions, value, radius );
417+
}
418+
419+
static public final < T extends RealType< T > > KDTreeSource< T > gen( final List< Point > positions, final T value, final double radius, final Object outside )
420+
{
421+
return new KDTreeSource< T >( positions, value, radius, outside );
422+
}
423+
424+
static public final < T extends RealType< T > > KDTreeSource< T > gen( final List< Point > positions, final T value, final double radius, final Object outside, final Interval interval )
425+
{
426+
return new KDTreeSource< T >( positions, value, radius, outside, interval );
427+
}
428+
429+
static public final < T extends RealType< T > > KDTreeSource< T > gen( final List< Point > positions, final List< T > values, final double radius )
430+
{
431+
return new KDTreeSource< T >( positions, values, radius );
432+
}
433+
434+
static public final < T extends RealType< T > > KDTreeSource< T > gen( final List< Point > positions, final List< T > values, final double radius, final Object outside )
435+
{
436+
return new KDTreeSource< T >( positions, values, radius, outside );
437+
}
438+
439+
static public final < T extends RealType< T > > KDTreeSource< T > gen( final List< Point > positions, final List< T > values, final double radius, final Object outside, final Interval interval )
440+
{
441+
return new KDTreeSource< T >( positions, values, radius, outside, interval );
442+
}
410443

411444
static public final < T extends RealType< T > > KDTreeSource< T > gen( final KDTree< T > kdtree, final double radius )
412445
{

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,31 @@ public KDTreeSource( final List< Point > points, final I value, final double rad
3838
this( new KDTree< I >( points.stream().map( ( p ) -> value ).collect( Collectors.toList() ), points ), radius );
3939
}
4040

41+
public KDTreeSource( final List< Point > points, final I value, final double radius, final Object outside )
42+
{
43+
this( new KDTree< I >( points.stream().map( ( p ) -> value ).collect( Collectors.toList() ), points ), radius, outside, null );
44+
}
45+
46+
public KDTreeSource( final List< Point > points, final I value, final double radius, final Object outside, final Interval interval )
47+
{
48+
this( new KDTree< I >( points.stream().map( ( p ) -> value ).collect( Collectors.toList() ), points ), radius, outside, interval );
49+
}
50+
4151
public KDTreeSource( final List< Point > points, final List< I > values, final double radius )
4252
{
4353
this( new KDTree< I >( values, points ), radius );
4454
}
4555

56+
public KDTreeSource( final List< Point > points, final List< I > values, final double radius, final Object outside )
57+
{
58+
this( new KDTree< I >( values, points ), radius, outside, null );
59+
}
60+
61+
public KDTreeSource( final List< Point > points, final List< I > values, final double radius, final Object outside, final Interval interval )
62+
{
63+
this( new KDTree< I >( values, points ), radius, outside, interval );
64+
}
65+
4666
public KDTreeSource( final KDTree< I > kdtree, final double radius )
4767
{
4868
this( kdtree, radius, kdtree.firstElement().createVariable(), null ); // with outside of value zero

0 commit comments

Comments
 (0)