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
21 changes: 13 additions & 8 deletions monai/data/image_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ def verify_suffix(self, filename: Union[Sequence[str], str]) -> bool:

def read(self, data: Union[Sequence[str], str], **kwargs):
"""
Read image data from specified file or files.
Read image data from specified file or files, it can read a list of `no-channel` images
and stack them together as multi-channels data in `get_data()`.
If passing directory path instead of file path, will treat it as DICOM images series and read.
Note that the returned object is ITK image object or list of ITK image objects.

Args:
Expand Down Expand Up @@ -218,7 +220,7 @@ def get_data(self, img):
Extract data array and meta data from loaded image and return them.
This function returns two objects, first is numpy array of image data, second is dict of meta data.
It constructs `affine`, `original_affine`, and `spatial_shape` and stores them in meta dict.
When loading a list of files, they are concatenated together at a new dimension as the first dimension,
When loading a list of files, they are stacked together at a new dimension as the first dimension,
and the meta data of the first image is used to represent the output meta data.

Args:
Expand Down Expand Up @@ -350,7 +352,8 @@ def verify_suffix(self, filename: Union[Sequence[str], str]) -> bool:

def read(self, data: Union[Sequence[str], str], **kwargs):
"""
Read image data from specified file or files.
Read image data from specified file or files, it can read a list of `no-channel` images
and stack them together as multi-channels data in `get_data()`.
Note that the returned object is Nibabel image object or list of Nibabel image objects.

Args:
Expand All @@ -376,7 +379,7 @@ def get_data(self, img):
Extract data array and meta data from loaded image and return them.
This function returns two objects, first is numpy array of image data, second is dict of meta data.
It constructs `affine`, `original_affine`, and `spatial_shape` and stores them in meta dict.
When loading a list of files, they are concatenated together at a new dimension as the first dimension,
When loading a list of files, they are stacked together at a new dimension as the first dimension,
and the meta data of the first image is used to present the output meta data.

Args:
Expand Down Expand Up @@ -497,7 +500,8 @@ def verify_suffix(self, filename: Union[Sequence[str], str]) -> bool:

def read(self, data: Union[Sequence[str], str], **kwargs):
"""
Read image data from specified file or files.
Read image data from specified file or files, it can read a list of `no-channel` data files
and stack them together as multi-channels data in `get_data()`.
Note that the returned object is Numpy array or list of Numpy arrays.

Args:
Expand Down Expand Up @@ -529,7 +533,7 @@ def get_data(self, img):
Extract data array and meta data from loaded image and return them.
This function returns two objects, first is numpy array of image data, second is dict of meta data.
It constructs `affine`, `original_affine`, and `spatial_shape` and stores them in meta dict.
When loading a list of files, they are concatenated together at a new dimension as the first dimension,
When loading a list of files, they are stacked together at a new dimension as the first dimension,
and the meta data of the first image is used to represent the output meta data.

Args:
Expand Down Expand Up @@ -581,7 +585,8 @@ def verify_suffix(self, filename: Union[Sequence[str], str]) -> bool:

def read(self, data: Union[Sequence[str], str, np.ndarray], **kwargs):
"""
Read image data from specified file or files.
Read image data from specified file or files, it can read a list of `no-channel` images
and stack them together as multi-channels data in `get_data()`.
Note that the returned object is PIL image or list of PIL image.

Args:
Expand Down Expand Up @@ -609,7 +614,7 @@ def get_data(self, img):
Extract data array and meta data from loaded image and return them.
This function returns two objects, first is numpy array of image data, second is dict of meta data.
It computes `spatial_shape` and stores it in meta dict.
When loading a list of files, they are concatenated together at a new dimension as the first dimension,
When loading a list of files, they are stacked together at a new dimension as the first dimension,
and the meta data of the first image is used to represent the output meta data.

Args:
Expand Down
5 changes: 4 additions & 1 deletion monai/transforms/io/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ def __call__(self, filename: Union[Sequence[str], str, Path, Sequence[Path]], re
Args:
filename: path file or file-like object or a list of files.
will save the filename to meta_data with key `filename_or_obj`.
if provided a list of files, use the filename of first file.
if provided a list of files, use the filename of first file to save,
and will stack them together as multi-channels data.
if provided directory path instead of file path, will treat it as
DICOM images series and read.
reader: runtime reader to load image file and meta data.

"""
Expand Down