diff --git a/monai/data/image_writer.py b/monai/data/image_writer.py index 7a9cdcb6b4..b467a5ae99 100644 --- a/monai/data/image_writer.py +++ b/monai/data/image_writer.py @@ -373,11 +373,11 @@ class ITKWriter(ImageWriter): output_dtype: DtypeLike = None channel_dim: int | None - def __init__(self, output_dtype: DtypeLike = np.float32, affine_lps_to_ras: bool | None = None, **kwargs): + def __init__(self, output_dtype: DtypeLike = np.float32, affine_lps_to_ras: bool | None = True, **kwargs): """ Args: output_dtype: output data type. - affine_lps_to_ras: whether to convert the affine matrix from "LPS" to "RAS". Defaults to ``None``. + affine_lps_to_ras: whether to convert the affine matrix from "LPS" to "RAS". Defaults to ``True``. Set to ``True`` to be consistent with ``NibabelWriter``, otherwise the affine matrix is assumed already in the ITK convention. kwargs: keyword arguments passed to ``ImageWriter``. @@ -478,7 +478,7 @@ def create_backend_obj( channel_dim: int | None = 0, affine: NdarrayOrTensor | None = None, dtype: DtypeLike = np.float32, - affine_lps_to_ras: bool | None = None, + affine_lps_to_ras: bool | None = True, **kwargs, ): """ @@ -489,7 +489,7 @@ def create_backend_obj( channel_dim: channel dimension of the data array. This is used to create a Vector Image if it is not ``None``. affine: affine matrix of the data array. This is used to compute `spacing`, `direction` and `origin`. dtype: output data type. - affine_lps_to_ras: whether to convert the affine matrix from "LPS" to "RAS". Defaults to ``None``. + affine_lps_to_ras: whether to convert the affine matrix from "LPS" to "RAS". Defaults to ``True``. Set to ``True`` to be consistent with ``NibabelWriter``, otherwise the affine matrix is assumed already in the ITK convention. kwargs: keyword arguments. Current `itk.GetImageFromArray` will read ``ttype`` from this dictionary.