## DIPimage 2.0 released

Last week the new release for DIPimage and DIPlib was made available at diplib.org. The change list is pretty substantial, though there should be no real compatibility concerns. One of the most important changes is that, for both Windows and Linux, some image processing functionality now can use multithreading to make best use of multi-processor and multi-core systems. For example, all separable filters will use all available cores by default. You can overrule this behaviour with the new `'NumberOfThreads'` preference setting. Let’s first see how many threads DIPimage uses by default on my computer:

`dipgetpref('NumberOfThreads')`
```ans =
4
```

I’m using an Intel Xeon with four cores. Now let’s see how this affects computation. Again, I’m using the `timeit` utility you can find here:

```a = noise(newim(500,500));
f = @() gaussf(a,15);
t4 = timeit(f)
t2 = timeit(f)
t1 = timeit(f)```
```t4 =
0.0193

t2 =
0.0266

t1 =
0.0443
```

Using four cores decreases execution time by a little over 50%. Part of the execution time is the actual calculation, but a significant part of the time is needed for memory access. All processor cores share the same memory, which makes it impossible to obtain the ideal decrease of 75% of the computation time. Note how the transition from one to two cores produces a larger advantage than the transition from two to four cores. MATLAB has the `maxNumCompThreads` command, which changes the number of threads used for linear algebra calculations:

```b = double(a);
f = @() b*b;
t4 = timeit(f)
t2 = timeit(f)
t1 = timeit(f)
```t4 =
0.0082

t2 =
0.0142

t1 =
0.0267
```

Expect the `'NumberOfThreads'` preference to be linked to the the `maxNumCompThreads` command in a future release of DIPimage.

Not all filters are affected by the number of threads. For example, the dilation with a circular structuring element is not separable:

```f = @() dilation(a,15);
t4 = timeit(f)
t2 = timeit(f)
t1 = timeit(f)```
```t4 =
0.0310

t2 =
0.0311

t1 =
0.0311
```

However, the rectangular structuring element is:

```f = @() dilation(a,15,'rectangular');
t4 = timeit(f)
t2 = timeit(f)
```t4 =