mergechannels 0.2.0__cp312-cp312-musllinux_1_2_aarch64.whl → 0.4.0__cp312-cp312-musllinux_1_2_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mergechannels might be problematic. Click here for more details.
- mergechannels/__init__.py +2 -1
- mergechannels/__init__.pyi +13 -4
- mergechannels/_internal.py +40 -46
- mergechannels/_luts.py +96 -0
- mergechannels/mergechannels.cpython-312-aarch64-linux-musl.so +0 -0
- {mergechannels-0.2.0.dist-info → mergechannels-0.4.0.dist-info}/METADATA +6 -5
- mergechannels-0.4.0.dist-info/RECORD +12 -0
- mergechannels-0.2.0.dist-info/RECORD +0 -12
- {mergechannels-0.2.0.dist-info → mergechannels-0.4.0.dist-info}/WHEEL +0 -0
- {mergechannels-0.2.0.dist-info → mergechannels-0.4.0.dist-info}/licenses/LICENSE +0 -0
mergechannels/__init__.py
CHANGED
|
@@ -3,11 +3,12 @@ from .mergechannels import ( # type: ignore
|
|
|
3
3
|
dispatch_single_channel,
|
|
4
4
|
dispatch_multi_channel,
|
|
5
5
|
)
|
|
6
|
-
from ._internal import merge
|
|
6
|
+
from ._internal import merge, apply_color_map
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
__all__ = [
|
|
10
10
|
'dispatch_single_channel',
|
|
11
11
|
'dispatch_multi_channel',
|
|
12
12
|
'merge',
|
|
13
|
+
'apply_color_map',
|
|
13
14
|
]
|
mergechannels/__init__.pyi
CHANGED
|
@@ -6,11 +6,20 @@ from python.mergechannels._blending import BLENDING_OPTIONS
|
|
|
6
6
|
from python.mergechannels._luts import COLORMAPS
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
def apply_color_map(
|
|
10
|
+
arr: np.ndarray,
|
|
11
|
+
color: COLORMAPS,
|
|
12
|
+
percentiles: tuple[float, float] | None = None,
|
|
13
|
+
saturation_limits: tuple[float, float] | None = None,
|
|
14
|
+
) -> np.ndarray:
|
|
15
|
+
...
|
|
16
|
+
|
|
9
17
|
def merge(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
18
|
+
arrs: Sequence[np.ndarray],
|
|
19
|
+
colors: Sequence[COLORMAPS],
|
|
20
|
+
blending: BLENDING_OPTIONS = 'max',
|
|
21
|
+
percentiles: tuple[float, float] | Sequence[tuple[float, float]] | None = None,
|
|
22
|
+
saturation_limits: tuple[float, float] | Sequence[tuple[float, float]] | None = None,
|
|
14
23
|
) -> np.ndarray:
|
|
15
24
|
...
|
|
16
25
|
|
mergechannels/_internal.py
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import (
|
|
2
|
+
Sequence,
|
|
3
|
+
Union,
|
|
4
|
+
)
|
|
2
5
|
|
|
3
6
|
import numpy as np
|
|
4
7
|
|
|
@@ -9,57 +12,48 @@ from mergechannels import (
|
|
|
9
12
|
from ._luts import COLORMAPS
|
|
10
13
|
from ._blending import BLENDING_OPTIONS
|
|
11
14
|
|
|
15
|
+
def apply_color_map(
|
|
16
|
+
arr: np.ndarray,
|
|
17
|
+
color: COLORMAPS,
|
|
18
|
+
percentiles: Union[tuple[float, float], None] = None,
|
|
19
|
+
saturation_limits: Union[tuple[float, float], None] = None,
|
|
20
|
+
) -> np.ndarray:
|
|
21
|
+
'''
|
|
22
|
+
apply a color map to an array
|
|
23
|
+
'''
|
|
24
|
+
if saturation_limits is None:
|
|
25
|
+
if percentiles is None:
|
|
26
|
+
percentiles = (1.1, 99.9)
|
|
27
|
+
low, high = np.percentile(arr, percentiles)
|
|
28
|
+
saturation_limits = (low, high)
|
|
29
|
+
|
|
30
|
+
return dispatch_single_channel(
|
|
31
|
+
array_reference=arr,
|
|
32
|
+
cmap_name=color,
|
|
33
|
+
limits=saturation_limits,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
12
37
|
def merge(
|
|
13
38
|
arrs: Sequence[np.ndarray],
|
|
14
39
|
colors: Sequence[COLORMAPS],
|
|
15
40
|
blending: BLENDING_OPTIONS = 'max',
|
|
16
|
-
|
|
41
|
+
percentiles: Union[Sequence[tuple[float, float]], None] = None,
|
|
42
|
+
saturation_limits: Union[Sequence[tuple[float, float]], None] = None,
|
|
17
43
|
) -> np.ndarray:
|
|
18
44
|
'''
|
|
19
45
|
apply cmaps to arrays and blend the colors
|
|
20
46
|
'''
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
f'Got {n_arrs} arrays and {n_colors} colors'
|
|
28
|
-
)
|
|
29
|
-
arr_shapes = [arr.shape for arr in arrs]
|
|
30
|
-
if not len(set(arr_shapes)) == 1:
|
|
31
|
-
raise ValueError(
|
|
32
|
-
f'Expected every array to have the same shape, got {arr_shapes}'
|
|
33
|
-
)
|
|
34
|
-
if len(arr_shapes[0]) not in (2, 3):
|
|
35
|
-
raise ValueError(
|
|
36
|
-
f'Expected every array to be 2D or 3D, got {arr_shapes[0]}'
|
|
37
|
-
)
|
|
38
|
-
arr_dtypes = [arr.dtype for arr in arrs]
|
|
39
|
-
if not len(set(arr_dtypes)) == 1:
|
|
40
|
-
raise ValueError(
|
|
41
|
-
f'Expected every array to have the same dtype, got {arr_dtypes}'
|
|
42
|
-
)
|
|
43
|
-
# endregion
|
|
44
|
-
if n_arrs == 1:
|
|
45
|
-
if arrs[0].dtype == 'uint8':
|
|
46
|
-
limits = (0, 255)
|
|
47
|
-
else:
|
|
48
|
-
low, high = np.percentile(arrs[0], np.array(saturation_limits) * 100)
|
|
49
|
-
limits = (low, high)
|
|
50
|
-
return dispatch_single_channel(
|
|
51
|
-
array_reference=arrs[0],
|
|
52
|
-
cmap_name=colors[0],
|
|
53
|
-
limits=limits,
|
|
54
|
-
)
|
|
55
|
-
else:
|
|
56
|
-
if all(arr.dtype == 'uint8' for arr in arrs):
|
|
57
|
-
limits = (0, 255)
|
|
58
|
-
else:
|
|
59
|
-
limits = tuple(np.percentile(arr, np.array(saturation_limits) * 100) for arr in arrs)
|
|
60
|
-
return dispatch_multi_channel(
|
|
61
|
-
array_references=arrs,
|
|
62
|
-
cmap_names=colors,
|
|
63
|
-
blending=blending,
|
|
64
|
-
limits=limits, # type: ignore
|
|
47
|
+
if saturation_limits is None:
|
|
48
|
+
if percentiles is None:
|
|
49
|
+
percentiles = [(1.1, 99.9)] * len(arrs)
|
|
50
|
+
saturation_limits = tuple(
|
|
51
|
+
np.percentile(arr, ch_percentiles)
|
|
52
|
+
for arr, ch_percentiles in zip(arrs, percentiles) # type: ignore
|
|
65
53
|
)
|
|
54
|
+
return dispatch_multi_channel(
|
|
55
|
+
array_references=arrs,
|
|
56
|
+
cmap_names=colors,
|
|
57
|
+
blending=blending,
|
|
58
|
+
limits=saturation_limits, # type: ignore
|
|
59
|
+
)
|
mergechannels/_luts.py
CHANGED
|
@@ -1,81 +1,177 @@
|
|
|
1
1
|
from typing import Literal
|
|
2
2
|
|
|
3
3
|
COLORMAPS = Literal[
|
|
4
|
+
'Circus Ink Purple',
|
|
5
|
+
'Spectrum Parabolic Ramp',
|
|
6
|
+
'Pop cherry',
|
|
7
|
+
'Circus Green',
|
|
4
8
|
'Rainbow RGB',
|
|
9
|
+
'Parabolic RGB',
|
|
5
10
|
'3color-RMB',
|
|
11
|
+
'Pop magenta inverted',
|
|
6
12
|
'Red Hot',
|
|
13
|
+
'Duo Cyan',
|
|
7
14
|
'Yellow',
|
|
15
|
+
'Grays g=0.25 inverted',
|
|
8
16
|
'betterRed',
|
|
17
|
+
'Grays g=1.75',
|
|
9
18
|
'blue_orange_icb',
|
|
19
|
+
'Pop green',
|
|
10
20
|
'mpl-inferno',
|
|
11
21
|
'I Blue',
|
|
12
22
|
'BOP purple',
|
|
23
|
+
'Duo Yellow',
|
|
24
|
+
'Phase Ink Mint-Cherry',
|
|
13
25
|
'betterOrange',
|
|
14
26
|
'Blue',
|
|
15
27
|
'6_shades',
|
|
28
|
+
'Ink Cyan',
|
|
16
29
|
'OIMB3',
|
|
30
|
+
'Quartetto MYGB Blue',
|
|
31
|
+
'Ink Green',
|
|
17
32
|
'Red/Green',
|
|
18
33
|
'Turbo',
|
|
34
|
+
'Circus Ink Black',
|
|
35
|
+
'Duo Green',
|
|
19
36
|
'mpl-viridis',
|
|
37
|
+
'Grays g=0.25',
|
|
38
|
+
'Quartetto RYGB Blue',
|
|
20
39
|
'smart',
|
|
21
40
|
'Thermal',
|
|
22
41
|
'OIMB2',
|
|
42
|
+
'Pop blue inverted',
|
|
43
|
+
'Duo Intense Cherry',
|
|
44
|
+
'Phase Bold Green-Magenta',
|
|
45
|
+
'Quartetto MYGB Magenta',
|
|
46
|
+
'Pop purple inverted',
|
|
23
47
|
'glow',
|
|
24
48
|
'OPF orange',
|
|
49
|
+
'Pop cyan inverted',
|
|
25
50
|
'physics',
|
|
51
|
+
'Phase Ink Yellow-Cyan',
|
|
52
|
+
'Circus Ink Mint',
|
|
53
|
+
'Ink Wash Purple',
|
|
26
54
|
'OIMB1',
|
|
27
55
|
'betterCyan',
|
|
28
56
|
'mpl-magma',
|
|
57
|
+
'Duo Intense Green',
|
|
29
58
|
'edges',
|
|
59
|
+
'Quartetto MYGB Green',
|
|
60
|
+
'Ink Wash Cherry',
|
|
30
61
|
'OPF purple',
|
|
62
|
+
'Ink Wash Cyan',
|
|
63
|
+
'Duo Intense Purple',
|
|
31
64
|
'I Yellow',
|
|
32
65
|
'16_colors',
|
|
66
|
+
'Circus Cyan',
|
|
67
|
+
'Pop lavender inverted',
|
|
33
68
|
'sepia',
|
|
69
|
+
'Duo Intense Cyan',
|
|
70
|
+
'Grays g=1.00 inverted',
|
|
34
71
|
'ICA2',
|
|
72
|
+
'Quartetto RYGB Green',
|
|
73
|
+
'Ink Wash Green',
|
|
74
|
+
'Pop blue',
|
|
75
|
+
'Quartetto RYGB Red',
|
|
35
76
|
'I Forest',
|
|
36
77
|
'ICA3',
|
|
78
|
+
'Circus Yellow',
|
|
79
|
+
'Pop mint',
|
|
37
80
|
'BOP orange',
|
|
81
|
+
'Grays g=1.25 inverted',
|
|
38
82
|
'I Red',
|
|
39
83
|
'3color-CGY',
|
|
40
84
|
'I Green',
|
|
41
85
|
'Fire',
|
|
42
86
|
'Magenta Hot',
|
|
87
|
+
'Grays g=0.50',
|
|
43
88
|
'Orange Hot',
|
|
89
|
+
'Circus Ink Cherry',
|
|
90
|
+
'Pop purple',
|
|
91
|
+
'Ink Yellow',
|
|
44
92
|
'unionjack',
|
|
93
|
+
'Ink Wash Yellow',
|
|
45
94
|
'I Cyan',
|
|
46
95
|
'Cyan Hot',
|
|
96
|
+
'Pop mint inverted',
|
|
47
97
|
'I Magenta',
|
|
48
98
|
'Grays',
|
|
99
|
+
'Phase Green-Magenta',
|
|
49
100
|
'Cyan',
|
|
101
|
+
'Grays g=0.75',
|
|
102
|
+
'Phase Bold Ink Mint-Cherry',
|
|
103
|
+
'Grays g=1.75 inverted',
|
|
50
104
|
'phase',
|
|
51
105
|
'gem',
|
|
106
|
+
'Pop cherry inverted',
|
|
107
|
+
'Pop red',
|
|
108
|
+
'Circus Cherry',
|
|
52
109
|
'OPF fresh',
|
|
110
|
+
'Circus Ink Cyan',
|
|
53
111
|
'betterGreen',
|
|
112
|
+
'Phase Ink Green-Magenta',
|
|
54
113
|
'3color-BMR',
|
|
114
|
+
'Ink Wash Black',
|
|
115
|
+
'Pop red inverted',
|
|
116
|
+
'Duo Purple',
|
|
55
117
|
'betterBlue',
|
|
118
|
+
'Phase Bold Ink Yellow-Cyan',
|
|
119
|
+
'Quartetto RYGB Yellow',
|
|
56
120
|
'Magenta',
|
|
121
|
+
'Duo Mint',
|
|
57
122
|
'Red',
|
|
123
|
+
'Grays g=1.25',
|
|
58
124
|
'I Bordeaux',
|
|
125
|
+
'Grays g=1.50 inverted',
|
|
126
|
+
'Green Hot',
|
|
59
127
|
'glasbey',
|
|
60
128
|
'glasbey_on_dark',
|
|
61
129
|
'mpl-plasma',
|
|
130
|
+
'Ink Cherry',
|
|
131
|
+
'Ink Mint',
|
|
132
|
+
'Circus Ink Yellow',
|
|
133
|
+
'Pop cyan',
|
|
134
|
+
'Pop green inverted',
|
|
135
|
+
'Ink Purple',
|
|
62
136
|
'3color-YGC',
|
|
137
|
+
'Pop yellow',
|
|
138
|
+
'Quartetto MYGB Yellow',
|
|
139
|
+
'Duo Cherry',
|
|
63
140
|
'Green',
|
|
141
|
+
'Grays g=0.50 inverted',
|
|
142
|
+
'Circus Ink Green',
|
|
64
143
|
'ICA',
|
|
144
|
+
'Phase Mint-Cherry',
|
|
145
|
+
'Ink Black',
|
|
65
146
|
'Yellow Hot',
|
|
147
|
+
'Phase Bold Yellow-Cyan',
|
|
66
148
|
'thallium',
|
|
149
|
+
'Pop yellow inverted',
|
|
67
150
|
'Spectrum',
|
|
68
151
|
'royal',
|
|
69
152
|
'glasbey_inverted',
|
|
70
153
|
'betterYellow',
|
|
154
|
+
'Circus Purple',
|
|
155
|
+
'Grays g=2.00',
|
|
71
156
|
'HiLo',
|
|
72
157
|
'cool',
|
|
73
158
|
'Green Fire Blue',
|
|
159
|
+
'Ink Wash Mint',
|
|
160
|
+
'Grays g=0.75 inverted',
|
|
74
161
|
'BOP blue',
|
|
75
162
|
'thal',
|
|
76
163
|
'Ice',
|
|
164
|
+
'Circus Mint',
|
|
165
|
+
'Grays g=1.50',
|
|
166
|
+
'Duo Intense Mint',
|
|
77
167
|
'brgbcmyw',
|
|
168
|
+
'Phase Yellow-Cyan',
|
|
78
169
|
'I Purple',
|
|
170
|
+
'Duo Intense Yellow',
|
|
171
|
+
'Phase Bold Ink Green-Magenta',
|
|
172
|
+
'Pop magenta',
|
|
79
173
|
'3-3-2 RGB',
|
|
174
|
+
'Grays g=2.00 inverted',
|
|
80
175
|
'5_ramps',
|
|
176
|
+
'Phase Bold Mint-Cherry',
|
|
81
177
|
]
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mergechannels
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
@@ -50,6 +50,7 @@ pip install git+https://github.com/zacswider/mergechannels.git
|
|
|
50
50
|
|
|
51
51
|
```python
|
|
52
52
|
from skimage import data
|
|
53
|
+
import matplotlib.pyplot as plt
|
|
53
54
|
import mergechannels as mc
|
|
54
55
|
|
|
55
56
|
img = data.camera()
|
|
@@ -116,10 +117,10 @@ b.imshow(
|
|
|
116
117
|
channels,
|
|
117
118
|
colormaps,
|
|
118
119
|
blending='min',
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
),
|
|
120
|
+
percentiles=[(
|
|
121
|
+
1, # bottom 1% of pixels set to black point
|
|
122
|
+
97, # top 3% of pixels set to white point
|
|
123
|
+
)]*len(channels),
|
|
123
124
|
),
|
|
124
125
|
)
|
|
125
126
|
fig.tight_layout()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
mergechannels-0.4.0.dist-info/METADATA,sha256=UFSUXd5ow06vtucS9sA9wum226fAXxzK8oQignieJtY,5762
|
|
2
|
+
mergechannels-0.4.0.dist-info/WHEEL,sha256=TE1mZA2wMYutqqvZXGIxT5tBliKoOBY2cbiY193djpA,108
|
|
3
|
+
mergechannels-0.4.0.dist-info/licenses/LICENSE,sha256=csvD60rgtSorbYEM3f8867qNyPCzmIXyFNj8h01Bd6c,1071
|
|
4
|
+
mergechannels.libs/libgcc_s-e52197c3.so.1,sha256=vkPW1Auw6CH9Bjk7frmX3hry_1H9c0tRI0Ncyg71WUI,724137
|
|
5
|
+
mergechannels/__init__.py,sha256=87haN6eeG02qnJJerNCb4Tfn-3GpChD89DKsFAYIH3Y,269
|
|
6
|
+
mergechannels/__init__.pyi,sha256=FZYQH4ue5M9r3zeUMHVZoU2D_RYwd3UiVD-GkcReY7M,1011
|
|
7
|
+
mergechannels/_blending.py,sha256=mE5Cr9wvVJRcwfymg_UUZUjdIKx2mldfLU8QJT95bVM,84
|
|
8
|
+
mergechannels/_internal.py,sha256=tMQtEG3s-N8eamqLUPUHy_fTO-7FqR8Q0Xng-4RSAC0,1421
|
|
9
|
+
mergechannels/_luts.py,sha256=RswhkrCGAFtDthmVHt-Kk7lxROwS-kdsQy1EboyUUc8,3009
|
|
10
|
+
mergechannels/mergechannels.cpython-312-aarch64-linux-musl.so,sha256=zLEAKYYOwzeGrAbvgmy-3OG-lhdviRpXQ185r98Yl8w,1116985
|
|
11
|
+
mergechannels/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
+
mergechannels-0.4.0.dist-info/RECORD,,
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
mergechannels-0.2.0.dist-info/METADATA,sha256=t-okrnqyvIiZxuLqTlubmCkXCxKz9U43u7bhSIEiNBc,5725
|
|
2
|
-
mergechannels-0.2.0.dist-info/WHEEL,sha256=TE1mZA2wMYutqqvZXGIxT5tBliKoOBY2cbiY193djpA,108
|
|
3
|
-
mergechannels-0.2.0.dist-info/licenses/LICENSE,sha256=csvD60rgtSorbYEM3f8867qNyPCzmIXyFNj8h01Bd6c,1071
|
|
4
|
-
mergechannels.libs/libgcc_s-e52197c3.so.1,sha256=vkPW1Auw6CH9Bjk7frmX3hry_1H9c0tRI0Ncyg71WUI,724137
|
|
5
|
-
mergechannels/__init__.py,sha256=TTNiDGOOJ6_-yR-qvX_nXph646Sz6-MEORc8ItksCRE,232
|
|
6
|
-
mergechannels/__init__.pyi,sha256=tiDx6v14J0cedFdk6fzVRRyA21b4Z8eB_rtSTUjI804,749
|
|
7
|
-
mergechannels/_blending.py,sha256=mE5Cr9wvVJRcwfymg_UUZUjdIKx2mldfLU8QJT95bVM,84
|
|
8
|
-
mergechannels/_internal.py,sha256=ZcdBUFEq8k2Ve_ASOZLTuPBaFEEPqadc9LqAGmBqOas,1773
|
|
9
|
-
mergechannels/_luts.py,sha256=DxwCMBnAAJc1ZX-D4cq8HabW-sLuBQpUqOWMWXqt_84,1035
|
|
10
|
-
mergechannels/mergechannels.cpython-312-aarch64-linux-musl.so,sha256=wco5PuwyHu87E6dIQzdYV-v7ZPCYfoB3WN_FoVuRx7Q,985913
|
|
11
|
-
mergechannels/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
-
mergechannels-0.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|