Open makarovNick opened 7 months ago
Thank you for contributing an issue! π
Welcome to the ITK community! π€πβοΈ
We are glad you are here and appreciate your contribution. Please keep in mind our community participation guidelines. π Also, please check existing open issues and consider discussion on the ITK Discourse. π
This is an automatic message. Allow for time for the ITK community to be able to read the issue and comment on it.
edited Not clear to me what the race conditions are causing the varying results after my initial investigation.
GlobalDefaultNumberOfThreads affects result Applying ErodeObjectMorphologyImageFilter on binary image produces different result with GlobalDefaultNumberOfThreads > 1
To Reproduce Steps to reproduce the behavior:
Operating system, version, and architecture
Programming language: Python 3.9.14]
Version of SimpleITK: tested on 2.1.0, 2.2.0, 2.3.1
How was SimpleITK installed?
A minimal working example which causes the error. data - shape.zip
sitk.ProcessObject.SetGlobalDefaultNumberOfThreads(1) eroded_img = sitk.ErodeObjectMorphology(img) result_volume = sitk.GetArrayFromImage(eroded_img).sum() print("Expecting volume: ", result_volume)
sitk.ProcessObject.SetGlobalDefaultNumberOfThreads(16) for _ in range(10): eroded_img = sitk.ErodeObjectMorphology(img) volume = sitk.GetArrayFromImage(eroded_img).sum() if result_volume != volume: print("Wrong result! Got", volume)
Expecting volume: 6039 Wrong result! Got 6213 Wrong result! Got 6109 Wrong result! Got 6046 Wrong result! Got 6119 Wrong result! Got 6212 Wrong result! Got 6042 Wrong result! Got 6183 Wrong result! Got 6212 Wrong result! Got 6044