kfb-view 2.1.9 → 2.1.10
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.
- package/.idea/workspace.xml +45 -26
- package/config/webpack.dev.conf.js +2 -2
- package/example/index.js +91 -69
- package/lib/kfb-view.js +1 -1
- package/package.json +2 -2
- package/src/util/imageData.js +10 -6
package/.idea/workspace.xml
CHANGED
|
@@ -37,7 +37,11 @@
|
|
|
37
37
|
</component>
|
|
38
38
|
<component name="ChangeListManager">
|
|
39
39
|
<list default="true" id="55024232-8108-4dc9-9bd3-0fd2aa2f34f8" name="Default Changelist" comment="">
|
|
40
|
+
<change beforePath="$PROJECT_DIR$/config/webpack.dev.conf.js" beforeDir="false" afterPath="$PROJECT_DIR$/config/webpack.dev.conf.js" afterDir="false" />
|
|
41
|
+
<change beforePath="$PROJECT_DIR$/example/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/example/index.html" afterDir="false" />
|
|
42
|
+
<change beforePath="$PROJECT_DIR$/example/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/example/index.js" afterDir="false" />
|
|
40
43
|
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
|
|
44
|
+
<change beforePath="$PROJECT_DIR$/src/util/imageData.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/util/imageData.js" afterDir="false" />
|
|
41
45
|
</list>
|
|
42
46
|
<option name="SHOW_DIALOG" value="false" />
|
|
43
47
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
@@ -60,6 +64,9 @@
|
|
|
60
64
|
</option>
|
|
61
65
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
62
66
|
</component>
|
|
67
|
+
<component name="GitToolBoxStore">
|
|
68
|
+
<option name="projectConfigVersion" value="4" />
|
|
69
|
+
</component>
|
|
63
70
|
<component name="MarkdownSettingsMigration">
|
|
64
71
|
<option name="stateVersion" value="1" />
|
|
65
72
|
</component>
|
|
@@ -127,24 +134,23 @@
|
|
|
127
134
|
<envs />
|
|
128
135
|
<method v="2" />
|
|
129
136
|
</configuration>
|
|
130
|
-
<configuration name="
|
|
137
|
+
<configuration name="clean:lib" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
|
|
131
138
|
<package-json value="$PROJECT_DIR$/package.json" />
|
|
132
139
|
<command value="run" />
|
|
133
140
|
<scripts>
|
|
134
|
-
<script value="
|
|
141
|
+
<script value="clean:lib" />
|
|
135
142
|
</scripts>
|
|
136
143
|
<node-interpreter value="project" />
|
|
137
144
|
<envs />
|
|
138
145
|
<method v="2" />
|
|
139
146
|
</configuration>
|
|
140
|
-
<configuration name="server
|
|
147
|
+
<configuration name="server" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
|
|
141
148
|
<package-json value="$PROJECT_DIR$/package.json" />
|
|
142
149
|
<command value="run" />
|
|
143
150
|
<scripts>
|
|
144
|
-
<script value="server
|
|
151
|
+
<script value="server" />
|
|
145
152
|
</scripts>
|
|
146
153
|
<node-interpreter value="project" />
|
|
147
|
-
<package-manager value="npm" />
|
|
148
154
|
<envs />
|
|
149
155
|
<method v="2" />
|
|
150
156
|
</configuration>
|
|
@@ -160,19 +166,19 @@
|
|
|
160
166
|
<method v="2" />
|
|
161
167
|
</configuration>
|
|
162
168
|
<list>
|
|
163
|
-
<item itemvalue="npm.server:dev" />
|
|
164
169
|
<item itemvalue="npm.server:hot" />
|
|
165
170
|
<item itemvalue="npm.build:lib" />
|
|
166
171
|
<item itemvalue="npm.build:prod" />
|
|
167
|
-
<item itemvalue="npm.
|
|
172
|
+
<item itemvalue="npm.server" />
|
|
173
|
+
<item itemvalue="npm.clean:lib" />
|
|
168
174
|
</list>
|
|
169
175
|
<recent_temporary>
|
|
170
176
|
<list>
|
|
171
177
|
<item itemvalue="npm.build:lib" />
|
|
178
|
+
<item itemvalue="npm.clean:lib" />
|
|
179
|
+
<item itemvalue="npm.server" />
|
|
172
180
|
<item itemvalue="npm.build:prod" />
|
|
173
181
|
<item itemvalue="npm.server:hot" />
|
|
174
|
-
<item itemvalue="npm.lint" />
|
|
175
|
-
<item itemvalue="npm.server:dev" />
|
|
176
182
|
</list>
|
|
177
183
|
</recent_temporary>
|
|
178
184
|
</component>
|
|
@@ -256,14 +262,13 @@
|
|
|
256
262
|
<workItem from="1641349006244" duration="1011000" />
|
|
257
263
|
<workItem from="1641351835998" duration="596000" />
|
|
258
264
|
<workItem from="1646288182802" duration="1809000" />
|
|
259
|
-
<workItem from="1646290338220" duration="
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
<
|
|
263
|
-
<
|
|
264
|
-
<
|
|
265
|
-
<
|
|
266
|
-
<updated>1600767106537</updated>
|
|
265
|
+
<workItem from="1646290338220" duration="3020000" />
|
|
266
|
+
<workItem from="1647822528539" duration="6003000" />
|
|
267
|
+
<workItem from="1647829382894" duration="594000" />
|
|
268
|
+
<workItem from="1647836886455" duration="602000" />
|
|
269
|
+
<workItem from="1648018813125" duration="1482000" />
|
|
270
|
+
<workItem from="1648082997200" duration="605000" />
|
|
271
|
+
<workItem from="1648452730691" duration="3597000" />
|
|
267
272
|
</task>
|
|
268
273
|
<task id="LOCAL-00002" summary="2.0.0重构">
|
|
269
274
|
<created>1600861772922</created>
|
|
@@ -594,19 +599,33 @@
|
|
|
594
599
|
<option name="project" value="LOCAL" />
|
|
595
600
|
<updated>1646293408931</updated>
|
|
596
601
|
</task>
|
|
597
|
-
<
|
|
602
|
+
<task id="LOCAL-00049" summary="2.1.9">
|
|
603
|
+
<created>1646293508969</created>
|
|
604
|
+
<option name="number" value="00049" />
|
|
605
|
+
<option name="presentableId" value="LOCAL-00049" />
|
|
606
|
+
<option name="project" value="LOCAL" />
|
|
607
|
+
<updated>1646293508969</updated>
|
|
608
|
+
</task>
|
|
609
|
+
<task id="LOCAL-00050" summary="增加图像处理操作">
|
|
610
|
+
<created>1647827904359</created>
|
|
611
|
+
<option name="number" value="00050" />
|
|
612
|
+
<option name="presentableId" value="LOCAL-00050" />
|
|
613
|
+
<option name="project" value="LOCAL" />
|
|
614
|
+
<updated>1647827904359</updated>
|
|
615
|
+
</task>
|
|
616
|
+
<option name="localTasksCounter" value="51" />
|
|
598
617
|
<servers />
|
|
599
618
|
</component>
|
|
600
619
|
<component name="TypeScriptGeneratedFilesManager">
|
|
601
620
|
<option name="version" value="3" />
|
|
602
621
|
</component>
|
|
603
622
|
<component name="Vcs.Log.History.Properties">
|
|
604
|
-
<option name="
|
|
623
|
+
<option name="COLUMN_ID_ORDER">
|
|
605
624
|
<list>
|
|
606
|
-
<option value="
|
|
607
|
-
<option value="
|
|
608
|
-
<option value="
|
|
609
|
-
<option value="
|
|
625
|
+
<option value="Default.Root" />
|
|
626
|
+
<option value="Default.Author" />
|
|
627
|
+
<option value="Default.Date" />
|
|
628
|
+
<option value="Default.Subject" />
|
|
610
629
|
</list>
|
|
611
630
|
</option>
|
|
612
631
|
</component>
|
|
@@ -636,8 +655,6 @@
|
|
|
636
655
|
<component name="VcsManagerConfiguration">
|
|
637
656
|
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
|
|
638
657
|
<option name="LOCAL_CHANGES_DETAILS_PREVIEW_SHOWN" value="false" />
|
|
639
|
-
<MESSAGE value="导航图优化" />
|
|
640
|
-
<MESSAGE value="gnore" />
|
|
641
658
|
<MESSAGE value="标注信息从shape中移到area" />
|
|
642
659
|
<MESSAGE value="2.0.15" />
|
|
643
660
|
<MESSAGE value="优化代码结构" />
|
|
@@ -661,7 +678,9 @@
|
|
|
661
678
|
<MESSAGE value="优化,增加部分注释" />
|
|
662
679
|
<MESSAGE value="2.1.8" />
|
|
663
680
|
<MESSAGE value="TerserPlugin" />
|
|
664
|
-
<
|
|
681
|
+
<MESSAGE value="2.1.9" />
|
|
682
|
+
<MESSAGE value="增加图像处理操作" />
|
|
683
|
+
<option name="LAST_COMMIT_MESSAGE" value="增加图像处理操作" />
|
|
665
684
|
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" />
|
|
666
685
|
</component>
|
|
667
686
|
<component name="XSLT-Support.FileAssociations.UIState">
|
|
@@ -65,9 +65,9 @@ module.exports = function() {
|
|
|
65
65
|
context: ['/api', '/image.php', '/process.php'],
|
|
66
66
|
// target: 'http://gastric.label.hzztai.com/',
|
|
67
67
|
// target: 'http://192.168.1.91:7007',
|
|
68
|
-
|
|
68
|
+
target: 'http://192.168.1.91',
|
|
69
69
|
// target: 'https://tct.hzztai.com',
|
|
70
|
-
target: 'https://pis-ningbo.hzztai.com',
|
|
70
|
+
// target: 'https://pis-ningbo.hzztai.com',
|
|
71
71
|
secure: false,
|
|
72
72
|
changeOrigin: true,
|
|
73
73
|
},
|
package/example/index.js
CHANGED
|
@@ -1,16 +1,31 @@
|
|
|
1
|
-
import {KfbView,
|
|
1
|
+
import {KfbView, hslToRgb, rgbToHsl, cacheGammaTable} from '../src';
|
|
2
2
|
import axios from 'axios';
|
|
3
3
|
import {EVENT_TAILORING_SCREENSHOT} from '../src/const/event';
|
|
4
4
|
|
|
5
|
-
const fileName = '/upload/large_file/last/
|
|
5
|
+
const fileName = '/upload/large_file/last/2022/02/21/d31a31bf1ae5b73fca63f72e2affc879/胃镜1.kfb';
|
|
6
6
|
|
|
7
7
|
const instance = axios.create({
|
|
8
8
|
baseURL: '/api',
|
|
9
9
|
timeout: 1000,
|
|
10
|
-
headers: {'Authorization': 'bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.
|
|
10
|
+
headers: {'Authorization': 'bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC8xOTIuMTY4LjEuOTFcL2FwaVwvYXV0aFwvbG9naW4iLCJpYXQiOjE2NDg0NTQwNjEsImV4cCI6MTY0OTA1ODg2MSwibmJmIjoxNjQ4NDU0MDYxLCJqdGkiOiJ6WXZUNnJXVzhoQTBrUTYzIiwic3ViIjoxLCJwcnYiOiI4N2UwYWYxZWY5ZmQxNTgxMmZkZWM5NzE1M2ExNGUwYjA0NzU0NmFhIn0.qMTNZvIxSVLGfh8jFTiXKBf7BQXXuz4n2cUj7Ewj6lk'},
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
let cacheImage = {};
|
|
14
|
+
|
|
15
|
+
const debounce = (func, delay) => {
|
|
16
|
+
let timer;
|
|
17
|
+
return function(...args) {
|
|
18
|
+
if (timer) {
|
|
19
|
+
clearTimeout(timer);
|
|
20
|
+
}
|
|
21
|
+
timer = setTimeout(() => {
|
|
22
|
+
// eslint-disable-next-line no-invalid-this,babel/no-invalid-this
|
|
23
|
+
func.apply(this, args);
|
|
24
|
+
}, delay);
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
instance.get(`/slide/info?file=${fileName}`).then(({data}) => {
|
|
14
29
|
let params = {};
|
|
15
30
|
params.file = fileName;
|
|
16
31
|
const kv = new KfbView({
|
|
@@ -31,7 +46,7 @@ instance.get(`/ai/kfb/info?file=${fileName}`).then(({data}) => {
|
|
|
31
46
|
disabled: false,
|
|
32
47
|
height: 200,
|
|
33
48
|
style: 'right: 0;top: 0',
|
|
34
|
-
thumbnail: `/api/
|
|
49
|
+
thumbnail: `/api/slide/getImage?file=${fileName}&type=thumbnail`,
|
|
35
50
|
vestige: true,
|
|
36
51
|
vestigeZoom: .1,
|
|
37
52
|
},
|
|
@@ -78,15 +93,16 @@ instance.get(`/ai/kfb/info?file=${fileName}`).then(({data}) => {
|
|
|
78
93
|
position,
|
|
79
94
|
size,
|
|
80
95
|
initRendered,
|
|
96
|
+
tile,
|
|
81
97
|
} = e;
|
|
82
98
|
let rangeA = document.querySelector('#a').value / 1;
|
|
99
|
+
let rangeS = document.querySelector('#s').value / 1;
|
|
100
|
+
let rangeL = document.querySelector('#l').value / 1;
|
|
101
|
+
let rangeR = document.querySelector('#r').value / 1;
|
|
102
|
+
let rangeG = document.querySelector('#g').value / 1;
|
|
83
103
|
let rangeB = document.querySelector('#b').value / 1;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
position.y = position.y >> 0;
|
|
87
|
-
size.y = size.y >> 0;
|
|
88
|
-
size.x = size.x >> 0;
|
|
89
|
-
if (rangeB === 0 && rangeA === 1 && rangeC === 0) {
|
|
104
|
+
if (rangeB === 0 && rangeA === 1 && rangeS === 0 && rangeL === 0 &&
|
|
105
|
+
rangeR === 0 && rangeG === 0) {
|
|
90
106
|
context.drawImage(
|
|
91
107
|
rendered.canvas,
|
|
92
108
|
0,
|
|
@@ -100,64 +116,67 @@ instance.get(`/ai/kfb/info?file=${fileName}`).then(({data}) => {
|
|
|
100
116
|
);
|
|
101
117
|
return;
|
|
102
118
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
let imageData = undefined;
|
|
108
|
-
let length = isSource ? sourceLength : sizeLength;
|
|
109
|
-
if (isSource) {
|
|
110
|
-
imageData = initRendered.getImageData(0, 0, canvas.width,
|
|
119
|
+
if (!cacheImage[tile.url]) {
|
|
120
|
+
const sourceLength = sourceWidth * sourceHeight;
|
|
121
|
+
const canvas = rendered.canvas;
|
|
122
|
+
let imageData = initRendered.getImageData(0, 0, canvas.width,
|
|
111
123
|
canvas.height);
|
|
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
|
-
|
|
124
|
+
for (let i = 0; i < sourceLength; i++) {
|
|
125
|
+
let r = imageData.data[i * 4 + 0];
|
|
126
|
+
let g = imageData.data[i * 4 + 1];
|
|
127
|
+
let b = imageData.data[i * 4 + 2];
|
|
128
|
+
if (rangeR !== 0) {
|
|
129
|
+
r = r * (1 + rangeR);
|
|
130
|
+
r = r > 255 ? 255 : r;
|
|
131
|
+
}
|
|
132
|
+
if (rangeG !== 0) {
|
|
133
|
+
g = g * (1 + rangeG);
|
|
134
|
+
g = g > 255 ? 255 : g;
|
|
135
|
+
}
|
|
136
|
+
if (rangeB !== 0) {
|
|
137
|
+
b = b * (1 + rangeB);
|
|
138
|
+
g = g > 255 ? 255 : g;
|
|
139
|
+
}
|
|
140
|
+
if (rangeS !== 0) {
|
|
141
|
+
let {h, s, l} = rgbToHsl(r, g, b);
|
|
142
|
+
const rgb = hslToRgb(h, s * (1 + rangeS), l);
|
|
143
|
+
r = rgb.r;
|
|
144
|
+
g = rgb.g;
|
|
145
|
+
b = rgb.b;
|
|
146
|
+
}
|
|
147
|
+
if (rangeL !== 0) {
|
|
148
|
+
let {h, s, l} = rgbToHsl(r, g, b);
|
|
149
|
+
const rgb = hslToRgb(h, s, l * (1 + rangeL));
|
|
150
|
+
r = rgb.r;
|
|
151
|
+
g = rgb.g;
|
|
152
|
+
b = rgb.b;
|
|
153
|
+
}
|
|
154
|
+
if (rangeA !== 1) {
|
|
155
|
+
r = cacheGammaTable[rangeA][r >> 0];
|
|
156
|
+
g = cacheGammaTable[rangeA][g >> 0];
|
|
157
|
+
b = cacheGammaTable[rangeA][b >> 0];
|
|
158
|
+
}
|
|
159
|
+
if (r > 255 || g > 255 || b > 255) {
|
|
160
|
+
console.log(r, g, b);
|
|
161
|
+
}
|
|
162
|
+
imageData.data[i * 4 + 0] = r;
|
|
163
|
+
imageData.data[i * 4 + 1] = g;
|
|
164
|
+
imageData.data[i * 4 + 2] = b;
|
|
139
165
|
}
|
|
140
|
-
imageData.data[i * 4 + 0] = r;
|
|
141
|
-
imageData.data[i * 4 + 1] = g;
|
|
142
|
-
imageData.data[i * 4 + 2] = b;
|
|
143
|
-
}
|
|
144
|
-
if (isSource) {
|
|
145
166
|
rendered.putImageData(imageData, 0, 0);
|
|
146
|
-
|
|
147
|
-
canvas,
|
|
148
|
-
0,
|
|
149
|
-
0,
|
|
150
|
-
sourceWidth,
|
|
151
|
-
sourceHeight,
|
|
152
|
-
position.x,
|
|
153
|
-
position.y,
|
|
154
|
-
size.x,
|
|
155
|
-
size.y,
|
|
156
|
-
);
|
|
157
|
-
} else {
|
|
158
|
-
context.putImageData(imageData, position.x, position.y);
|
|
159
|
-
/* context.drawImage(offCanvas, position.x, position.y, size.x, size.y);*/
|
|
167
|
+
cacheImage[tile.url] = canvas;
|
|
160
168
|
}
|
|
169
|
+
context.drawImage(
|
|
170
|
+
cacheImage[tile.url],
|
|
171
|
+
0,
|
|
172
|
+
0,
|
|
173
|
+
sourceWidth,
|
|
174
|
+
sourceHeight,
|
|
175
|
+
position.x,
|
|
176
|
+
position.y,
|
|
177
|
+
size.x,
|
|
178
|
+
size.y,
|
|
179
|
+
);
|
|
161
180
|
},
|
|
162
181
|
});
|
|
163
182
|
/* kv.board.startDraw({
|
|
@@ -165,13 +184,16 @@ instance.get(`/ai/kfb/info?file=${fileName}`).then(({data}) => {
|
|
|
165
184
|
});*/
|
|
166
185
|
console.log(kv);
|
|
167
186
|
let list = [];
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
187
|
+
document.querySelector('#a').onchange = debounce(changeRange, 500);
|
|
188
|
+
document.querySelector('#s').onchange = debounce(changeRange, 500);
|
|
189
|
+
document.querySelector('#l').onchange = debounce(changeRange, 500);
|
|
190
|
+
document.querySelector('#r').onchange = debounce(changeRange, 500);
|
|
191
|
+
document.querySelector('#g').onchange = debounce(changeRange, 500);
|
|
192
|
+
document.querySelector('#b').onchange = debounce(changeRange, 500);
|
|
172
193
|
|
|
173
194
|
// eslint-disable-next-line no-unused-vars
|
|
174
195
|
function changeRange() {
|
|
196
|
+
cacheImage = {};
|
|
175
197
|
kv.viewer.forceRedraw();
|
|
176
198
|
}
|
|
177
199
|
|