Args: label: input data to compute the indices of every class. image: if image is not None, use ``image > image_threshold`` to define valid region, and only select the indices within the valid region. output_shape: expected shape of output
(
self, label: NdarrayOrTensor, image: NdarrayOrTensor | None = None, output_shape: Sequence[int] | None = None
)
| 1020 | self.max_samples_per_class = max_samples_per_class |
| 1021 | |
| 1022 | def __call__( |
| 1023 | self, label: NdarrayOrTensor, image: NdarrayOrTensor | None = None, output_shape: Sequence[int] | None = None |
| 1024 | ) -> list[NdarrayOrTensor]: |
| 1025 | """ |
| 1026 | Args: |
| 1027 | label: input data to compute the indices of every class. |
| 1028 | image: if image is not None, use ``image > image_threshold`` to define valid region, and only select |
| 1029 | the indices within the valid region. |
| 1030 | output_shape: expected shape of output indices. if None, use `self.output_shape` instead. |
| 1031 | |
| 1032 | """ |
| 1033 | |
| 1034 | if output_shape is None: |
| 1035 | output_shape = self.output_shape |
| 1036 | indices: list[NdarrayOrTensor] |
| 1037 | indices = map_classes_to_indices( |
| 1038 | label, self.num_classes, image, self.image_threshold, self.max_samples_per_class |
| 1039 | ) |
| 1040 | if output_shape is not None: |
| 1041 | indices = [unravel_indices(cls_indices, output_shape) for cls_indices in indices] |
| 1042 | |
| 1043 | return indices |
| 1044 | |
| 1045 | |
| 1046 | class ConvertToMultiChannelBasedOnBratsClasses(Transform): |
nothing calls this directly
no test coverage detected