open both files in MITK, open segmentation utilities (not multilabel!)
Then run difference, union or intersection.
Due to the large image size all of these take a long time:
Difference: ~14s
Intersection: ~13.5s
Union: ~12s
(times measured with a stop watch, so +- 0.5s)
I understand that there is some overhead involved with writing back the result into some image and then displaying it, but boolean operations are rather basic stuff and should run WAY faster.
Furthermore MITK uses a an unreasonable amount of RAM to compute the results (compared to a python implementation). That is probably because the target image is unsigned short, even though both source images were unsigned char. Why?
Here is a reference implementation in python:
import numpy as np import tifffile from time import time a = tifffile.imread('tmp2.tif') b = tifffile.imread('tmp3.tif') # difference st = time() c = np.copy(a) c[b > 0] = 0 end = time() print('difference took', end - st, 's') # union st = time() c = ((a > 0) | (b > 0)).astype(np.uint8) end = time() print('union took', end - st, 's') # intersection st = time() c = ((a > 0) & (b > 0)).astype(np.uint8) end = time() print('intersection took', end - st, 's')
difference took 0.4352085590362549 s
union took 0.5148181915283203 s
intersection took 0.5096790790557861 s
Even though MITK uses multiprocessing the single threaded python/numpy implementation is much faster.
Best,
Fabian