def __init__( self, keys: KeysCollection, output_postfixes: Optional[Sequence[str]] = None, output_names: Optional[Sequence[str]] = None, channel_dim: int = 0, remove_origin: bool = False, allow_missing_keys: bool = False, meta_key_postfix='meta_dict', ) -> None: """ Args: keys: keys of the corresponding items to be transformed. See also: :py:class:`monai.transforms.compose.MapTransform` output_postfixes: the postfixes to construct keys to store split data. for example: if the key of input data is `pred` and split 2 classes, the output data keys will be: pred_(output_postfixes[0]), pred_(output_postfixes[1]) if None, using the index number: `pred_0`, `pred_1`, ... `pred_N`. channel_dim: which dimension of input image is the channel, default to 0. allow_missing_keys: don't raise exception if key is missing. """ super().__init__(keys, allow_missing_keys) self.output_postfixes = output_postfixes self.output_names = output_names self.remove_origin = remove_origin self.meta_key_postfix = meta_key_postfix self.splitter = SplitChannel(channel_dim=channel_dim)
def test_shape(self, input_param, test_data, expected_shape): result = SplitChannel(**input_param)(test_data) for data in result: self.assertTupleEqual(data.shape, expected_shape)