-
Notifications
You must be signed in to change notification settings - Fork 73
/
PTcolormap.m
319 lines (303 loc) · 7.12 KB
/
PTcolormap.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
%% PTcolormap - creates a few novel, more linear, colormap options
% this is a good place to continue improving colormaps
%
% ----------------------------------------------------------------------------------
% "THE BEER-WARE LICENSE" (Revision 42):
% <[email protected]> wrote this file. As long as you retain this notice you
% can do whatever you want with this stuff. If we meet some day, and you think
% this stuff is worth it, you can buy me a beer in return. -Brian White
% ----------------------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a=colormap(parula);
viridis=[a(:,1) a(:,2) a(:,3)*.6];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 2) a couple more linear, gamma corrected, cmaps using dkl colorspace
% http://www.scholarpedia.org/article/Color_spaces
% 64 steps from -1 to 1, DKL color range
i=.01:1/64:1;%half
i2=-1:1/31.9:1;%full
% DKL 'red' white bg
for j=1:64,
linearREDcmap(j,:)=dkl2rgb([-i2(j) i(j) 0])/255;
end
% DKL 'grey' white bg
for j=1:64,
linearGREYcmap(j,:)=dkl2rgb([-i2(j) 0 0])/255;
end
% convert dkl cone opponent colors to rgb
function rgb = dkl2rgb(dkl)
% rgb = dkl2rgb(dkl)
% input (dkl) is the 3 dimensions in dkl color space = [luminance axis ; red/green axis ; blue/yellow axis] ;
% 'magic numbers', based on 'average' crt monitor and derived using
% Smith & Pokorny cone fundamentals % V. C. Smith & J. Pokorny (1975), Vision Res. 15, 161-172.
M_dkl2rgb = [
1.0000 1.0000 -0.3495
1.0000 -0.3203 0.3113
1.0000 0.0133 -1.0000
];
% convert outputs a floating point
rgb = 0.5 + M_dkl2rgb*(dkl')/2;
% % convert to uint8
rgb = uint8(rgb*255)+1;%+1 for indexing
% gamma corrected RGB based on 'average' monitor
gamma_corr=[ 0 0 0
11 5 1
16 8 2
20 11 3
24 15 5
27 18 5
30 20 6
33 23 7
35 25 8
38 27 9
40 29 10
42 31 11
45 33 13
47 35 14
49 37 15
51 40 16
53 41 17
54 43 18
56 45 20
58 46 21
60 48 22
61 50 23
63 51 23
65 53 24
66 54 25
68 56 26
69 57 28
71 58 29
72 60 30
74 61 31
75 63 32
77 65 33
78 66 34
79 68 36
81 69 36
82 70 37
83 72 38
85 73 39
86 74 40
87 75 41
89 77 43
90 78 44
91 79 45
92 80 46
94 81 47
95 83 47
96 84 48
97 85 49
98 86 51
99 87 52
101 88 53
102 90 54
103 92 55
104 93 56
105 94 57
106 95 57
107 96 59
108 97 60
109 98 61
110 99 62
112 100 63
113 101 64
114 102 65
115 103 67
116 104 67
117 105 68
118 106 69
119 107 70
120 108 71
121 109 72
122 110 74
123 111 75
124 112 76
125 113 76
127 114 77
128 116 78
128 117 79
130 118 80
131 119 82
131 120 83
132 121 84
133 122 84
134 123 85
135 124 86
136 125 87
137 126 88
138 127 90
139 128 91
140 129 92
141 129 92
141 130 93
142 131 94
143 132 95
144 133 96
145 134 98
146 135 99
147 136 100
148 137 100
148 137 101
149 138 102
150 139 103
151 141 105
152 142 106
153 143 107
154 144 108
154 145 108
155 145 109
156 146 110
157 147 111
158 148 113
158 149 114
159 150 115
160 150 116
161 151 116
162 152 117
163 153 118
163 154 119
164 155 121
165 155 122
166 156 123
166 157 123
167 158 124
168 159 125
169 159 126
170 160 128
170 161 129
171 162 130
172 163 130
173 163 131
173 164 132
174 165 133
175 167 134
176 168 136
176 168 137
177 169 138
178 170 138
179 171 139
179 171 140
180 172 141
181 173 142
182 174 144
182 175 145
183 175 145
184 176 146
185 177 147
185 178 148
186 178 149
187 179 150
187 180 152
188 181 152
189 181 153
190 182 154
190 183 155
191 184 156
192 184 157
192 185 157
193 186 159
194 186 160
194 187 161
195 188 162
196 189 163
197 189 164
197 190 164
198 192 165
199 193 167
199 193 168
200 194 169
201 195 170
201 195 171
202 196 171
203 197 172
203 198 173
204 198 175
205 199 176
205 200 177
206 200 178
207 201 178
207 202 179
208 202 180
209 203 181
209 204 183
210 205 184
211 205 184
211 206 185
212 207 186
213 207 187
213 208 188
214 209 190
215 209 191
215 210 191
216 211 192
217 211 193
217 212 194
218 213 195
218 213 196
219 214 196
220 215 198
220 215 199
221 216 200
222 218 201
222 219 202
223 219 203
224 220 203
224 221 204
225 221 206
225 222 207
226 222 208
227 223 209
227 224 209
228 224 210
228 225 211
229 226 212
230 226 214
230 227 215
231 228 215
232 228 216
232 229 217
233 230 218
233 230 219
234 231 221
235 232 222
235 232 222
236 233 223
236 234 224
237 234 225
238 235 226
238 235 227
239 236 227
239 237 229
240 237 230
241 238 231
241 239 232
242 239 233
242 240 233
243 241 234
244 241 235
244 243 237
245 243 238
245 244 239
246 245 239
246 245 240
247 246 241
248 247 242
248 247 244
249 248 245
249 248 245
250 249 246
250 250 247
251 250 248
252 251 249
252 251 250
253 252 250
253 253 252
254 253 253
254 254 254
255 255 255];
rgb = [gamma_corr(rgb(1),1); gamma_corr(rgb(2),2); gamma_corr(rgb(3),3)];
rgb(rgb<0)=0;
rgb(rgb>255)=255;
end