From f6ace5a415c540abaed6faffe0906b86932f24f5 Mon Sep 17 00:00:00 2001 From: Nic Ma Date: Thu, 8 Apr 2021 11:18:38 +0800 Subject: [PATCH 1/2] [DLMED] enhance doc-strings Signed-off-by: Nic Ma --- monai/handlers/segmentation_saver.py | 5 ++++- monai/transforms/io/dictionary.py | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/monai/handlers/segmentation_saver.py b/monai/handlers/segmentation_saver.py index 9ee7ca67f9..d99983f645 100644 --- a/monai/handlers/segmentation_saver.py +++ b/monai/handlers/segmentation_saver.py @@ -28,8 +28,10 @@ class SegmentationSaver: """ Event handler triggered on completing every iteration to save the segmentation predictions into files. - """ + It can extract the input image meta data(filename, affine, original_shape, etc.) and resample the predictions + based on the meta data. + """ def __init__( self, output_dir: str = "./", @@ -96,6 +98,7 @@ def __init__( output will be: /output/test1/image/image_seg.nii.gz batch_transform: a callable that is used to transform the ignite.engine.batch into expected format to extract the meta_data dictionary. + it can be used to extract the input image meta data: filename, affine, original_shape, etc. output_transform: a callable that is used to transform the ignite.engine.output into the form expected image data. The first dimension of this transform's output will be treated as the diff --git a/monai/transforms/io/dictionary.py b/monai/transforms/io/dictionary.py index 58d6431c74..413f83b62d 100644 --- a/monai/transforms/io/dictionary.py +++ b/monai/transforms/io/dictionary.py @@ -132,9 +132,10 @@ class SaveImaged(MapTransform): keys: keys of the corresponding items to be transformed. See also: :py:class:`monai.transforms.compose.MapTransform` meta_key_postfix: `key_{postfix}` was used to store the metadata in `LoadImaged`. - So need the key to extract metadata to save images, default is `meta_dict`. - The meta data is a dictionary object, if no corresponding metadata, set to `None`. - For example, for data with key `image`, the metadata by default is in `image_meta_dict`. + so need the key to extract metadata to save images, default is `meta_dict`. + for example, for data with key `image`, the metadata by default is in `image_meta_dict`. + the meta data is a dictionary object which contains: filename, affine, original_shape, etc. + if no corresponding metadata, set to `None`. output_dir: output image directory. output_postfix: a string appended to all output file names, default to `trans`. output_ext: output file extension name, available extensions: `.nii.gz`, `.nii`, `.png`. From d9d390283904bd1ea32b842d56e00496254f0b27 Mon Sep 17 00:00:00 2001 From: monai-bot Date: Thu, 8 Apr 2021 03:24:24 +0000 Subject: [PATCH 2/2] [MONAI] python code formatting Signed-off-by: monai-bot --- monai/handlers/segmentation_saver.py | 1 + 1 file changed, 1 insertion(+) diff --git a/monai/handlers/segmentation_saver.py b/monai/handlers/segmentation_saver.py index d99983f645..6a98abf3ca 100644 --- a/monai/handlers/segmentation_saver.py +++ b/monai/handlers/segmentation_saver.py @@ -32,6 +32,7 @@ class SegmentationSaver: based on the meta data. """ + def __init__( self, output_dir: str = "./",