writing mhd + raw instead of mhd +zraw

Hello, I am using simpleitk to write mhd files using
sitk.WriteImage(img, ‘file.mhd’)
The output file is of mhd + zraw type.
How can I generate mhd + raw files using simpleitk?

Thank you in advance!

.zraw is used when the file compression is enabled, .raw is used then file is uncompressed.

If it is a one-off thing, you could edit .mhd file and change the file name along with renaming the actual file.

Hello @totoro3y,

The default setting for WriteImage's useCompression variable is False so surprising that your code creates a file with zraw extension. The following short snippet illustrates how the extension varies if compression is on or off:

import SimpleITK as sitk

img = sitk.ReadImage('training_001_ct.mha')

sitk.WriteImage(img,'with_compression.mhd', useCompression = True)
sitk.WriteImage(img,'no_compression.mhd')