Skip to content

Commit b59605e

Browse files
committed
Fix formatting
Signed-off-by: Abdessamad <abdoomis6@gmail.com>
1 parent 48c00c0 commit b59605e

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

monai/transforms/utility/array.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,11 @@ def __call__(self, img: NdarrayOrTensor) -> NdarrayOrTensor:
10701070
if img.ndim == 4 and img.shape[0] == 1:
10711071
img = img.squeeze(0)
10721072

1073-
result = [(img == 1) | (img == self.et_label), (img == 1) | (img == self.et_label) | (img == 2), img == self.et_label]
1073+
result = [
1074+
(img == 1) | (img == self.et_label),
1075+
(img == 1) | (img == self.et_label) | (img == 2),
1076+
img == self.et_label,
1077+
]
10741078
# merge labels 1 (tumor non-enh) and self.et_label (tumor enh) and 2 (large edema) to WT
10751079
# self.et_label is ET (4 or 3)
10761080
return torch.stack(result, dim=0) if isinstance(img, torch.Tensor) else np.stack(result, axis=0)

tests/transforms/test_convert_to_multi_channel.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
]
5050
)
5151

52+
5253
# Tests for et_label = 3
5354
for p in TEST_NDARRAYS:
5455
TESTS_ET_LABEL_3.extend(
@@ -66,6 +67,7 @@
6667
]
6768
)
6869

70+
6971
class TestConvertToMultiChannel(unittest.TestCase):
7072
@parameterized.expand(TESTS)
7173
def test_type_shape(self, data, expected_result):
@@ -85,5 +87,6 @@ def test_invalid_et_label(self):
8587
with self.assertRaises(ValueError):
8688
ConvertToMultiChannelBasedOnBratsClasses(et_label=2)
8789

90+
8891
if __name__ == "__main__":
8992
unittest.main()

0 commit comments

Comments
 (0)