@abi-software/scaffoldvuer 1.21.1-beta.2 → 2.0.0
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/README.md +31 -12
- package/dist/index.html +9 -6
- package/dist/scaffoldvuer.js +14095 -13154
- package/dist/scaffoldvuer.umd.cjs +48 -48
- package/dist/style.css +1 -1
- package/eslint.config.js +37 -9
- package/package.json +10 -3
- package/public/index.html +9 -6
- package/src/App.vue +312 -279
- package/src/ScaffoldVuer-wc.js +4 -4
- package/src/app/DropZone.vue +11 -27
- package/src/app/ModelsInformation.js +22 -19
- package/src/app/ModelsTable.vue +42 -65
- package/src/app/TextureDemos.js +38 -64
- package/src/assets/_variables.scss +12 -10
- package/src/components/GlyphsControls.vue +3 -23
- package/src/components/LinesControls.vue +27 -66
- package/src/components/OpacityControls.vue +22 -26
- package/src/components/PointsControls.vue +20 -71
- package/src/components/PrimitiveControls.vue +35 -49
- package/src/components/ScaffoldOverlay.vue +63 -63
- package/src/components/ScaffoldTooltip.vue +36 -49
- package/src/components/ScaffoldTreeControls.vue +81 -129
- package/src/components/ScaffoldVuer.vue +509 -498
- package/src/components/TextureSlidesControls.vue +22 -64
- package/src/components/TransformationControls.vue +15 -42
- package/src/components/index.js +2 -2
- package/src/main.js +16 -18
- package/src/scripts/Annotation.js +3 -3
- package/src/scripts/BaseModule.js +26 -30
- package/src/scripts/EventNotifier.js +30 -36
- package/src/scripts/GraphicsHighlight.js +43 -50
- package/src/scripts/LocalFilesHelper.js +27 -26
- package/src/scripts/MappedNerves.js +2139 -697
- package/src/scripts/MappedOrgans.js +24 -25
- package/src/scripts/OrgansRenderer.js +445 -425
- package/src/scripts/RendererModule.js +133 -122
- package/src/scripts/Search.js +135 -151
- package/src/scripts/Utilities.js +129 -127
- package/src/scripts/WebGL.js +57 -91
- package/src/scripts/niftiHelper.js +3 -3
- package/src/store/index.js +7 -7
- package/vite.config.js +51 -50
- package/vite.static-build.js +7 -7
- package/vuese-generator.js +48 -56
package/src/scripts/Search.js
CHANGED
|
@@ -18,7 +18,6 @@ limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
******************************************************************************/
|
|
20
20
|
|
|
21
|
-
|
|
22
21
|
//==============================================================================
|
|
23
22
|
|
|
24
23
|
import MiniSearch from 'minisearch';
|
|
@@ -29,172 +28,157 @@ import { createUnqiuesFromObjects } from './Utilities';
|
|
|
29
28
|
|
|
30
29
|
// The properties of a feature we index and show
|
|
31
30
|
|
|
32
|
-
export const indexedProperties = [
|
|
33
|
-
'label',
|
|
34
|
-
'models',
|
|
35
|
-
'source'
|
|
36
|
-
];
|
|
31
|
+
export const indexedProperties = ['label', 'models', 'source'];
|
|
37
32
|
|
|
38
33
|
//==============================================================================
|
|
39
34
|
|
|
40
|
-
export class SearchIndex
|
|
41
|
-
{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
updateZincObject(zincObject, id)
|
|
35
|
+
export class SearchIndex {
|
|
36
|
+
constructor() {
|
|
37
|
+
this._searchEngine = new MiniSearch({
|
|
38
|
+
fields: ['path', 'name'],
|
|
39
|
+
storeFields: ['path'],
|
|
40
|
+
tokenize: (string, _fieldName) => string.split(/[\s/]+/), // indexing tokenizer
|
|
41
|
+
});
|
|
42
|
+
this.idMaps = {};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
updateZincObject(zincObject, id) {
|
|
53
46
|
//=======================
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
addZincObject(zincObject, id)
|
|
47
|
+
const path = zincObject.getRegion().getFullPath();
|
|
48
|
+
let groupName = zincObject.groupName;
|
|
49
|
+
let fullPath = path ? `${path}/${zincObject.groupName}` : zincObject.groupName;
|
|
50
|
+
groupName = groupName.replaceAll('"', '');
|
|
51
|
+
fullPath = fullPath.replaceAll('"', '');
|
|
52
|
+
const item = { path: fullPath, name: groupName, id };
|
|
53
|
+
this._searchEngine.replace(item);
|
|
54
|
+
this.idMaps[id] = { path: fullPath, zincObject };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
addZincObject(zincObject, id) {
|
|
66
58
|
//=======================
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
removeZincObject(zincObject, id)
|
|
59
|
+
const path = zincObject.getRegion().getFullPath();
|
|
60
|
+
let groupName = zincObject.groupName;
|
|
61
|
+
let fullPath = path ? `${path}/${zincObject.groupName}` : zincObject.groupName;
|
|
62
|
+
groupName = groupName.replaceAll('"', '');
|
|
63
|
+
fullPath = fullPath.replaceAll('"', '');
|
|
64
|
+
const item = { path: fullPath, name: groupName, id };
|
|
65
|
+
this._searchEngine.add(item);
|
|
66
|
+
this.idMaps[id] = { path: fullPath, zincObject };
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
removeZincObject(zincObject, id) {
|
|
79
70
|
//=======================
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
addRegion(region, id)
|
|
71
|
+
const path = zincObject.getRegion().getFullPath();
|
|
72
|
+
let groupName = zincObject.groupName;
|
|
73
|
+
let fullPath = path ? `${path}/${zincObject.groupName}` : zincObject.groupName;
|
|
74
|
+
groupName = groupName.replaceAll('"', '');
|
|
75
|
+
fullPath = fullPath.replaceAll('"', '');
|
|
76
|
+
const item = { path: fullPath, name: groupName, id };
|
|
77
|
+
this._searchEngine.remove(item);
|
|
78
|
+
delete this.idMaps[id];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
addRegion(region, id) {
|
|
92
82
|
//=======================
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
clearResults()
|
|
83
|
+
let path = region.getFullPath();
|
|
84
|
+
let regionName = region.getName();
|
|
85
|
+
path = path.replaceAll('"', '');
|
|
86
|
+
regionName = regionName.replaceAll('"', '');
|
|
87
|
+
const item = { path, name: regionName, id };
|
|
88
|
+
this._searchEngine.add(item);
|
|
89
|
+
this.idMaps[id] = { path, zincObject: region };
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
clearResults() {
|
|
104
93
|
//============
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
94
|
+
this._;
|
|
95
|
+
}
|
|
108
96
|
|
|
109
|
-
|
|
97
|
+
removeAll() {
|
|
110
98
|
//=======================
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
99
|
+
this._searchEngine.removeAll();
|
|
100
|
+
//this.zincObjects.length = 0;
|
|
101
|
+
//this.regions.length = 0;
|
|
102
|
+
this.idMaps = {};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
auto_suggest(text) {
|
|
106
|
+
let results = [];
|
|
107
|
+
if (text.length > 2 && ["'", '"'].includes(text.slice(0, 1))) {
|
|
108
|
+
text = text.replaceAll(text.slice(0, 1), '');
|
|
109
|
+
results = this._searchEngine.search(text, { prefix: true, combineWith: 'AND' });
|
|
110
|
+
} else if (text.length > 1) {
|
|
111
|
+
results = this._searchEngine.search(text, { prefix: true });
|
|
116
112
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
text = text.replaceAll(text.slice(0, 1), '')
|
|
122
|
-
results = this._searchEngine.search(text, {prefix: true, combineWith: 'AND'})
|
|
123
|
-
} else if (text.length > 1) {
|
|
124
|
-
results = this._searchEngine.search(text, {prefix: true})
|
|
125
|
-
}
|
|
126
|
-
const items = [];
|
|
127
|
-
results.forEach(r => {
|
|
128
|
-
if (r.id in this.idMaps) {
|
|
129
|
-
items.push(this.idMaps[r.id].path);
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
const unique = [...new Set(items)];
|
|
133
|
-
const returned = [];
|
|
134
|
-
unique.forEach(u => returned.push({suggestion: '"' + u + '"'}));
|
|
135
|
-
return returned;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
processResults(zincObjects, searchText) {
|
|
140
|
-
const result = {
|
|
141
|
-
regionPath: undefined,
|
|
142
|
-
label: `Search Results for \"`,
|
|
143
|
-
};
|
|
144
|
-
if (Array.isArray(searchText)) {
|
|
145
|
-
result.label += ','.join(searchText);
|
|
146
|
-
} else {
|
|
147
|
-
result.label += searchText;
|
|
148
|
-
}
|
|
149
|
-
result.label += `\"`;
|
|
150
|
-
if (zincObjects.length === 1) {
|
|
151
|
-
if (zincObjects[0].isRegion) {
|
|
152
|
-
result.regionPath = zincObjects[0].getFullPath();
|
|
153
|
-
} else if (zincObjects[0].isZincObject) {
|
|
154
|
-
result.regionPath = zincObjects[0].getRegion().getFullPath();
|
|
155
|
-
result.label = zincObjects[0].groupName;
|
|
156
|
-
}
|
|
113
|
+
const items = [];
|
|
114
|
+
results.forEach((r) => {
|
|
115
|
+
if (r.id in this.idMaps) {
|
|
116
|
+
items.push(this.idMaps[r.id].path);
|
|
157
117
|
}
|
|
158
|
-
|
|
159
|
-
|
|
118
|
+
});
|
|
119
|
+
const unique = [...new Set(items)];
|
|
120
|
+
const returned = [];
|
|
121
|
+
unique.forEach((u) => returned.push({ suggestion: '"' + u + '"' }));
|
|
122
|
+
return returned;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
processResults(zincObjects, searchText) {
|
|
126
|
+
const result = {
|
|
127
|
+
regionPath: undefined,
|
|
128
|
+
label: `Search Results for "`,
|
|
129
|
+
};
|
|
130
|
+
if (Array.isArray(searchText)) {
|
|
131
|
+
result.label += ','.join(searchText);
|
|
132
|
+
} else {
|
|
133
|
+
result.label += searchText;
|
|
160
134
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
results = this._searchEngine.search(text, {prefix: true})
|
|
135
|
+
result.label += `"`;
|
|
136
|
+
if (zincObjects.length === 1) {
|
|
137
|
+
if (zincObjects[0].isRegion) {
|
|
138
|
+
result.regionPath = zincObjects[0].getFullPath();
|
|
139
|
+
} else if (zincObjects[0].isZincObject) {
|
|
140
|
+
result.regionPath = zincObjects[0].getRegion().getFullPath();
|
|
141
|
+
result.label = zincObjects[0].groupName;
|
|
169
142
|
}
|
|
170
|
-
const zincResults = [];
|
|
171
|
-
results.forEach(r => {
|
|
172
|
-
if (r.id in this.idMaps) {
|
|
173
|
-
zincResults.push(this.idMaps[r.id].zincObject);
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
return zincResults;
|
|
177
143
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
144
|
+
result['zincObjects'] = createUnqiuesFromObjects(zincObjects);
|
|
145
|
+
return result;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
search(text) {
|
|
149
|
+
let results = undefined;
|
|
150
|
+
if (text.length > 2 && ["'", '"'].includes(text.slice(0, 1))) {
|
|
151
|
+
text = text.replaceAll(text.slice(0, 1), '');
|
|
152
|
+
results = this._searchEngine.search(text, { prefix: true, combineWith: 'AND' });
|
|
153
|
+
} else if (text.length > 1) {
|
|
154
|
+
results = this._searchEngine.search(text, { prefix: true });
|
|
187
155
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
zincObjectResults = this.searchTerms(terms);
|
|
193
|
-
} else {
|
|
194
|
-
zincObjectResults = this.search(terms);
|
|
156
|
+
const zincResults = [];
|
|
157
|
+
results.forEach((r) => {
|
|
158
|
+
if (r.id in this.idMaps) {
|
|
159
|
+
zincResults.push(this.idMaps[r.id].zincObject);
|
|
195
160
|
}
|
|
196
|
-
|
|
161
|
+
});
|
|
162
|
+
return zincResults;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
searchTerms(terms) {
|
|
166
|
+
let results = [];
|
|
167
|
+
terms.forEach((term) => {
|
|
168
|
+
const result = this.search(term);
|
|
169
|
+
results.push(...result);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
return results;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
searchAndProcessResult(terms) {
|
|
176
|
+
let zincObjectResults;
|
|
177
|
+
if (Array.isArray(terms)) {
|
|
178
|
+
zincObjectResults = this.searchTerms(terms);
|
|
179
|
+
} else {
|
|
180
|
+
zincObjectResults = this.search(terms);
|
|
197
181
|
}
|
|
198
|
-
|
|
182
|
+
return this.processResults(zincObjectResults, terms);
|
|
183
|
+
}
|
|
199
184
|
}
|
|
200
|
-
|