Skip to content

Commit 755b083

Browse files
committed
UPD: Fix mypy issues
1 parent 4ff5e43 commit 755b083

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tiatoolbox/utils/postproc_defs.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ def validate(self: MultichannelToRGB, n: int) -> None:
4949
self.is_validated = True
5050
return
5151

52+
if self.channels is None:
53+
self.channels = list(range(n_colors))
54+
5255
if n_colors - 1 == n:
5356
self.colors = self.colors[:n]
5457
self.channels = [c for c in self.channels if c < n]
@@ -103,7 +106,7 @@ def __call__(self: MultichannelToRGB, image: np.ndarray) -> np.ndarray:
103106
self.validate(n)
104107

105108
if self.channels is None:
106-
self.channels = list(range(n))
109+
self.channels = list(range(image.shape[2]))
107110

108111
if image.dtype == np.uint16:
109112
image = (image / 256).astype(np.uint8)

0 commit comments

Comments
 (0)