Convert ``data_array`` into 'channel-last' numpy ndarray. Args: data_array: input data array with the channel dimension specified by ``channel_dim``. channel_dim: channel dimension of the data array. Defaults to 0. ``None`` indicates data wit
(
self, data_array: NdarrayOrTensor, channel_dim: int | None = 0, squeeze_end_dims: bool = True, **kwargs
)
| 564 | super().__init__(output_dtype=output_dtype, affine=None, **kwargs) |
| 565 | |
| 566 | def set_data_array( |
| 567 | self, data_array: NdarrayOrTensor, channel_dim: int | None = 0, squeeze_end_dims: bool = True, **kwargs |
| 568 | ): |
| 569 | """ |
| 570 | Convert ``data_array`` into 'channel-last' numpy ndarray. |
| 571 | |
| 572 | Args: |
| 573 | data_array: input data array with the channel dimension specified by ``channel_dim``. |
| 574 | channel_dim: channel dimension of the data array. Defaults to 0. |
| 575 | ``None`` indicates data without any channel dimension. |
| 576 | squeeze_end_dims: if ``True``, any trailing singleton dimensions will be removed. |
| 577 | kwargs: keyword arguments passed to ``self.convert_to_channel_last``, |
| 578 | currently support ``spatial_ndim``, defaulting to ``3``. |
| 579 | """ |
| 580 | self.data_obj = self.convert_to_channel_last( |
| 581 | data=data_array, |
| 582 | channel_dim=channel_dim, |
| 583 | squeeze_end_dims=squeeze_end_dims, |
| 584 | spatial_ndim=kwargs.pop("spatial_ndim", 3), |
| 585 | ) |
| 586 | |
| 587 | def set_metadata(self, meta_dict: Mapping | None, resample: bool = True, **options): |
| 588 | """ |