/** * Utility function to create an ExecutorService * * Number of threads utilized matches available processors in runtime. * * @return - the new ExecutorService */ public static final ExecutorService createExecutorService() { return createExecutorService( Runtime.getRuntime().availableProcessors() ); }
public static ExecutorService createExecutorService() { return FFTConvolution.createExecutorService( Threads.numThreads() ); } }
public DeconViews( final Collection< DeconView > input, final ExecutorService service ) { this.views = new ArrayList<>(); this.views.addAll( input ); this.service = FFTConvolution.createExecutorService( Threads.numThreads() ); if ( ThreadPoolExecutor.class.isInstance( service ) ) this.numThreads = ((ThreadPoolExecutor)service).getMaximumPoolSize(); else this.numThreads = Threads.numThreads(); final RandomAccessibleInterval< ? > firstImg = input.iterator().next().getImage(); final long[] dim = new long[ firstImg.numDimensions() ]; firstImg.dimensions( dim ); for ( final DeconView view : views ) for ( int d = 0; d < dim.length; ++d ) if ( dim[ d ] != view.getImage().dimension( d ) || dim[ d ] != view.getWeight().dimension( d ) ) throw new RuntimeException( "Dimensions of the input images & weights do not match." ); this.dimensions = new FinalDimensions( dim ); // init the psfs for ( final DeconView view : views ) view.getPSF().init( this, view.getBlockSize() ); }