Skip to content

Commit d56c002

Browse files
Nic-Mamonai-bot
andauthored
1968 Enhance meta data doc-string in SegmentationSaver (#1969)
* [DLMED] enhance doc-strings Signed-off-by: Nic Ma <[email protected]> * [MONAI] python code formatting Signed-off-by: monai-bot <[email protected]> Co-authored-by: monai-bot <[email protected]>
1 parent 8cbd59a commit d56c002

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

monai/handlers/segmentation_saver.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
class SegmentationSaver:
2929
"""
3030
Event handler triggered on completing every iteration to save the segmentation predictions into files.
31+
It can extract the input image meta data(filename, affine, original_shape, etc.) and resample the predictions
32+
based on the meta data.
33+
3134
"""
3235

3336
def __init__(
@@ -96,6 +99,7 @@ def __init__(
9699
output will be: /output/test1/image/image_seg.nii.gz
97100
batch_transform: a callable that is used to transform the
98101
ignite.engine.batch into expected format to extract the meta_data dictionary.
102+
it can be used to extract the input image meta data: filename, affine, original_shape, etc.
99103
output_transform: a callable that is used to transform the
100104
ignite.engine.output into the form expected image data.
101105
The first dimension of this transform's output will be treated as the

monai/transforms/io/dictionary.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,10 @@ class SaveImaged(MapTransform):
132132
keys: keys of the corresponding items to be transformed.
133133
See also: :py:class:`monai.transforms.compose.MapTransform`
134134
meta_key_postfix: `key_{postfix}` was used to store the metadata in `LoadImaged`.
135-
So need the key to extract metadata to save images, default is `meta_dict`.
136-
The meta data is a dictionary object, if no corresponding metadata, set to `None`.
137-
For example, for data with key `image`, the metadata by default is in `image_meta_dict`.
135+
so need the key to extract metadata to save images, default is `meta_dict`.
136+
for example, for data with key `image`, the metadata by default is in `image_meta_dict`.
137+
the meta data is a dictionary object which contains: filename, affine, original_shape, etc.
138+
if no corresponding metadata, set to `None`.
138139
output_dir: output image directory.
139140
output_postfix: a string appended to all output file names, default to `trans`.
140141
output_ext: output file extension name, available extensions: `.nii.gz`, `.nii`, `.png`.

0 commit comments

Comments
 (0)