From 82e825dddbb35c449fd4c739da7325157a93acda Mon Sep 17 00:00:00 2001 From: Yotam Yaniv Date: Wed, 4 Oct 2023 14:48:23 -0700 Subject: [PATCH] Turning on compression for SimpleITK writer. When saving segmentation in nrrd format without compression the file size is significantly larger than with compression, 20mb versus 19kb for a 5000x4000 nrrd binary segmentation. --- nnunetv2/imageio/simpleitk_reader_writer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nnunetv2/imageio/simpleitk_reader_writer.py b/nnunetv2/imageio/simpleitk_reader_writer.py index 2b9b168c3..4d82cb568 100644 --- a/nnunetv2/imageio/simpleitk_reader_writer.py +++ b/nnunetv2/imageio/simpleitk_reader_writer.py @@ -126,4 +126,4 @@ def write_seg(self, seg: np.ndarray, output_fname: str, properties: dict) -> Non itk_image.SetOrigin(properties['sitk_stuff']['origin']) itk_image.SetDirection(properties['sitk_stuff']['direction']) - sitk.WriteImage(itk_image, output_fname) + sitk.WriteImage(itk_image, output_fname, True)