Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions monai/transforms/io/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ class SaveImage(Transform):
output_dir: /output,
data_root_dir: /foo/bar,
output will be: /output/test1/image/image_seg.nii.gz
print_log: whether to print log about the saved file path, etc. default to `True`.

"""

Expand All @@ -240,6 +241,7 @@ def __init__(
save_batch: bool = False,
squeeze_end_dims: bool = True,
data_root_dir: str = "",
print_log: bool = True,
) -> None:
self.saver: Union[NiftiSaver, PNGSaver]
if output_ext in (".nii.gz", ".nii"):
Expand All @@ -254,6 +256,7 @@ def __init__(
output_dtype=output_dtype,
squeeze_end_dims=squeeze_end_dims,
data_root_dir=data_root_dir,
print_log=print_log,
)
elif output_ext == ".png":
self.saver = PNGSaver(
Expand All @@ -264,6 +267,7 @@ def __init__(
mode=InterpolateMode(mode),
scale=scale,
data_root_dir=data_root_dir,
print_log=print_log,
)
else:
raise ValueError(f"unsupported output extension: {output_ext}.")
Expand Down
3 changes: 3 additions & 0 deletions monai/transforms/io/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ class SaveImaged(MapTransform):
output_dir: /output,
data_root_dir: /foo/bar,
output will be: /output/test1/image/image_seg.nii.gz
print_log: whether to print log about the saved file path, etc. default to `True`.

"""

Expand All @@ -220,6 +221,7 @@ def __init__(
allow_missing_keys: bool = False,
squeeze_end_dims: bool = True,
data_root_dir: str = "",
print_log: bool = True,
) -> None:
super().__init__(keys, allow_missing_keys)
self.meta_keys = ensure_tuple_rep(meta_keys, len(self.keys))
Expand All @@ -237,6 +239,7 @@ def __init__(
save_batch=save_batch,
squeeze_end_dims=squeeze_end_dims,
data_root_dir=data_root_dir,
print_log=print_log,
)

def __call__(self, data):
Expand Down