I have just tested the release candidate for version 5.2 of itk and wanted to share with you that it solved a previous issue with multiprocessing (as promised in the release notes ).
Also, I did not encounter any problems with the new version, apart from minor modifications (which were also in the release notes), so thanks!
The code that did not work is:
from multiprocessing.dummy import Pool
import itk
import numpy as np
n_imgs = 10
fnames = [f'img_{n}.nii' for n in range(n_imgs)] # a list of images
# Write the images - uncomment only once for writing the images
# list(map(lambda fname: itk.imwrite(itk.image_from_array(np.zeros((10, 10, 10), dtype=np.int16)), fname), fnames))
# Read images with threads (itk backend) - did not work before itk 5.2
pool = Pool(n_imgs)
pool.map(lambda fname: itk.imread(fname), fnames)
# The error reads:
# AttributeError: module 'ITKIOImageBase' has no attribute 'swig'
# Close the pool and wait for the work to finish
pool.close()
pool.join()
But with 5.2 the error is gone.