77import net .imglib2 .RandomAccessible ;
88import net .imglib2 .RandomAccessibleInterval ;
99import net .imglib2 .loops .LoopBuilder ;
10+ import net .imglib2 .parallel .Parallelization ;
11+ import net .imglib2 .parallel .TaskExecutor ;
12+ import net .imglib2 .parallel .TaskExecutors ;
1013import net .imglib2 .util .Intervals ;
1114import net .imglib2 .util .Localizables ;
1215import net .imglib2 .view .Views ;
1316
17+ import java .util .concurrent .ExecutorService ;
18+
1419/**
1520 * This class can be used to implement a separable convolution. It applies a
1621 * {@link LineConvolverFactory} on the given images.
@@ -23,12 +28,21 @@ public class LineConvolution< T > implements Convolution<T>
2328
2429 private final int direction ;
2530
31+ private ExecutorService executor ;
32+
2633 public LineConvolution ( final LineConvolverFactory < ? super T > factory , final int direction )
2734 {
2835 this .factory = factory ;
2936 this .direction = direction ;
3037 }
3138
39+ @ Deprecated
40+ @ Override
41+ public void setExecutor ( ExecutorService executor )
42+ {
43+ this .executor = executor ;
44+ }
45+
3246 @ Override
3347 public Interval requiredSourceInterval ( final Interval targetInterval )
3448 {
@@ -56,7 +70,8 @@ public void process( RandomAccessible< ? extends T > source, RandomAccessibleInt
5670 dim [ direction ] = 1 ;
5771
5872 RandomAccessibleInterval < Localizable > positions = Localizables .randomAccessibleInterval ( new FinalInterval ( dim ) );
59- LoopBuilder .setImages ( positions ).multiThreaded ().forEachChunk (
73+ TaskExecutor taskExecutor = executor == null ? Parallelization .getTaskExecutor () : TaskExecutors .forExecutorService ( executor );
74+ LoopBuilder .setImages ( positions ).multiThreaded (taskExecutor ).forEachChunk (
6075 chunk -> {
6176
6277 final RandomAccess < ? extends T > in = sourceInterval .randomAccess ();
0 commit comments