Read image data from specified file or files. Note that it returns a data object or a sequence of data objects. Args: data: file name or a list of file names to read. kwargs: additional args for actual `read` API of 3rd party libs.
(self, data: Sequence[PathLike] | PathLike, **kwargs)
| 1501 | return has_nrrd and is_supported_format(filename, suffixes) |
| 1502 | |
| 1503 | def read(self, data: Sequence[PathLike] | PathLike, **kwargs) -> Sequence[Any] | Any: |
| 1504 | """ |
| 1505 | Read image data from specified file or files. |
| 1506 | Note that it returns a data object or a sequence of data objects. |
| 1507 | |
| 1508 | Args: |
| 1509 | data: file name or a list of file names to read. |
| 1510 | kwargs: additional args for actual `read` API of 3rd party libs. |
| 1511 | |
| 1512 | """ |
| 1513 | img_: list = [] |
| 1514 | filenames: Sequence[PathLike] = ensure_tuple(data) |
| 1515 | kwargs_ = self.kwargs.copy() |
| 1516 | kwargs_.update(kwargs) |
| 1517 | for name in filenames: |
| 1518 | nrrd_image = NrrdImage(*nrrd.read(name, index_order=self.index_order, **kwargs_)) |
| 1519 | img_.append(nrrd_image) |
| 1520 | return img_ if len(filenames) > 1 else img_[0] |
| 1521 | |
| 1522 | def get_data(self, img: NrrdImage | list[NrrdImage]) -> tuple[np.ndarray, dict]: |
| 1523 | """ |