MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / set_data_array

Method set_data_array

monai/data/image_writer.py:566–585  ·  view source on GitHub ↗

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
    )

Source from the content-addressed store, hash-verified

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 """

Callers 6

test_orientationMethod · 0.95
test_consistencyMethod · 0.95
test_write_2dMethod · 0.95
test_write_3dMethod · 0.95
test_write_4dMethod · 0.95
test_write_5dMethod · 0.95

Calls 2

popMethod · 0.80

Tested by 6

test_orientationMethod · 0.76
test_consistencyMethod · 0.76
test_write_2dMethod · 0.76
test_write_3dMethod · 0.76
test_write_4dMethod · 0.76
test_write_5dMethod · 0.76