ImageSeriesWriter in rare cases writes image position (0020,0032) incorrectly


Over the last year or so I have, on some machines using ITK, run into troubles regarding the image position header being written incorrectly.

Short example of the problem:
I use the ImageSeriesWriter to write 2D images from a 3D image. In order to add the correct image positions to each 2D image I add that header to the metadata dictionary. You know like all the examples and guides tell you to do :slight_smile: . Almost all of the time it works perfectly and the image position gets written correct. However, on some ubuntu machines the header gets written incorrectly ALL of the time.

  • **Correct header: ** (0020,0032) ?? (DS) [-119.013374328613-125.03343963623-26.4799346923828] # 52,3 Image Position (Patient)

  • **Incorrect header: ** (0020,0032) ?? (DS) [-119\4.44659081257122e-323\3.93542391372225e-62 ] # 48,3 Image Position (Patient)

As you can see y and z positions are incorrectly set to zero. I have been trying to locate the error for a while know and there seems to be no posts about it for the last two years. However, there seems to be older post (such as reporting similar issues. But because ITK (I guess) has moved to github I cannot read the bugfix commits or comments to check if I am affected by the same issue.

Does anyone know if this old bug has been fixed or has some inputs for me :slight_smile:?

best regards,