Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 25, 2024
1 parent 4df1d61 commit c2abf09
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions monai/transforms/utility/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ def __call__(self, img: NdarrayOrTensor) -> NdarrayOrTensor:
# merge labels 1 (tumor non-enh) and 4 (tumor enh) and 2 (large edema) to WT
# label 4 is ET
return torch.stack(result, dim=0) if isinstance(img, torch.Tensor) else np.stack(result, axis=0)


class ConvertToMultiChannelBasedOnBrats23Classes(Transform):
"""
Expand All @@ -1093,8 +1093,8 @@ def __call__(self, img: NdarrayOrTensor) -> NdarrayOrTensor:
result = [(img == 1) | (img == 3), (img == 1) | (img == 3) | (img == 2), img == 3] # -> tc, wt, et
# merge labels 1 (ncr) and 3 (et) and 2 (ed) to WT
return torch.stack(result, dim=0) if isinstance(img, torch.Tensor) else np.stack(result, axis=0)


class ConvertToMultiChannelBasedOnBrats23ClassesNoReg(Transform):
"""
Convert labels to multi channels based on brats23 classes:
Expand All @@ -1114,7 +1114,7 @@ def __call__(self, img: NdarrayOrTensor) -> NdarrayOrTensor:
result = [(img == 1), (img == 2), (img == 3)]

return torch.stack(result, dim=0) if isinstance(img, torch.Tensor) else np.stack(result, axis=0)


class AddExtremePointsChannel(Randomizable, Transform):
"""
Expand Down
8 changes: 4 additions & 4 deletions monai/transforms/utility/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -1313,8 +1313,8 @@ def __call__(self, data: Mapping[Hashable, NdarrayOrTensor]) -> dict[Hashable, N
for key in self.key_iterator(d):
d[key] = self.converter(d[key])
return d


class ConvertToMultiChannelBasedOnBrats23Classesd(MapTransform):
"""
Dictionary-based wrapper of :py:class:`monai.transforms.ConvertToMultiChannelBasedOnBrats23Classes`.
Expand All @@ -1337,8 +1337,8 @@ def __call__(self, data: Mapping[Hashable, NdarrayOrTensor]) -> dict[Hashable, N
for key in self.key_iterator(d):
d[key] = self.converter(d[key])
return d


class ConvertToMultiChannelBasedOnBrats23ClassesNoRegd(MapTransform):
"""
Dictionary-based wrapper of :py:class:`monai.transforms.ConvertToMultiChannelBasedOnBratsClasses`.
Expand Down

0 comments on commit c2abf09

Please sign in to comment.