@abi-software/scaffoldvuer 1.11.0-demo.3 → 1.11.1
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/.eslintrc.js +6 -4
- package/dist/scaffoldvuer.js +9922 -9556
- package/dist/scaffoldvuer.umd.cjs +173 -173
- package/dist/style.css +1 -1
- package/package.json +6 -7
- package/src/App.vue +6 -2
- package/src/components/LinesControls.vue +105 -27
- package/src/components/PrimitiveControls.vue +19 -2
- package/src/components/ScaffoldTreeControls.vue +21 -5
- package/src/components/ScaffoldVuer.vue +121 -76
- package/src/components/TransformationControls.vue +16 -1
- package/src/scripts/GraphicsHighlight.js +38 -3
- package/src/scripts/MappedNerves.js +0 -1
- package/src/scripts/MappedOrgans.js +50 -0
- package/src/scripts/OrgansRenderer.js +12 -2
- package/src/scripts/RendererModule.js +3 -20
- package/src/scripts/Utilities.js +27 -0
|
@@ -104,15 +104,15 @@
|
|
|
104
104
|
@object-selected="objectSelected"
|
|
105
105
|
@object-hovered="objectHovered"
|
|
106
106
|
@drawer-toggled="drawerToggled"
|
|
107
|
-
@checked-regions="setCheckedRegions"
|
|
108
107
|
/>
|
|
109
108
|
</template>
|
|
110
109
|
</el-popover>
|
|
111
110
|
<div class="primitive-controls-box">
|
|
112
111
|
<primitive-controls
|
|
113
|
-
v-if="viewingMode === 'Exploration'"
|
|
114
112
|
ref="primitiveControls"
|
|
115
113
|
:createData="createData"
|
|
114
|
+
:viewingMode="viewingMode"
|
|
115
|
+
:usageConfig="usageConfig"
|
|
116
116
|
@primitivesUpdated="primitivesUpdated"
|
|
117
117
|
/>
|
|
118
118
|
</div>
|
|
@@ -457,11 +457,20 @@ import { AnnotationService } from '@abi-software/sparc-annotation';
|
|
|
457
457
|
import { EventNotifier } from "../scripts/EventNotifier.js";
|
|
458
458
|
import { OrgansViewer } from "../scripts/OrgansRenderer.js";
|
|
459
459
|
import { SearchIndex } from "../scripts/Search.js";
|
|
460
|
-
import { mapState } from 'pinia';
|
|
460
|
+
import { mapState, mapStores } from 'pinia';
|
|
461
461
|
import { useMainStore } from "@/store/index";
|
|
462
462
|
import { getNerveMaps } from "../scripts/MappedNerves.js";
|
|
463
|
+
import { getOrganMaps } from '../scripts/MappedOrgans.js';
|
|
463
464
|
const nervesMap = getNerveMaps();
|
|
464
|
-
|
|
465
|
+
const organsMap = getOrganMaps();
|
|
466
|
+
let foundNerves = 0;
|
|
467
|
+
|
|
468
|
+
const haveSameElements = (arr1, arr2) => {
|
|
469
|
+
if (arr1.length !== arr2.length) return false;
|
|
470
|
+
return arr1.sort().every((value, index) => {
|
|
471
|
+
return value === arr2.sort()[index]
|
|
472
|
+
});
|
|
473
|
+
}
|
|
465
474
|
|
|
466
475
|
/**
|
|
467
476
|
* A vue component of the scaffold viewer.
|
|
@@ -680,8 +689,10 @@ export default {
|
|
|
680
689
|
*/
|
|
681
690
|
isNerves: {
|
|
682
691
|
type: Object,
|
|
683
|
-
default: {
|
|
684
|
-
|
|
692
|
+
default: function () {
|
|
693
|
+
return {
|
|
694
|
+
regions: ["nerves"]
|
|
695
|
+
};
|
|
685
696
|
},
|
|
686
697
|
},
|
|
687
698
|
/**
|
|
@@ -762,6 +773,18 @@ export default {
|
|
|
762
773
|
type: Boolean,
|
|
763
774
|
default: true,
|
|
764
775
|
},
|
|
776
|
+
/**
|
|
777
|
+
* Manage the settings when used in standalone or as child component.
|
|
778
|
+
*/
|
|
779
|
+
usageConfig: {
|
|
780
|
+
type: Object,
|
|
781
|
+
default: function () {
|
|
782
|
+
return {
|
|
783
|
+
showTubeLinesControls: true,
|
|
784
|
+
tubeLines: false,
|
|
785
|
+
};
|
|
786
|
+
},
|
|
787
|
+
},
|
|
765
788
|
},
|
|
766
789
|
provide() {
|
|
767
790
|
return {
|
|
@@ -891,7 +914,7 @@ export default {
|
|
|
891
914
|
group: "",
|
|
892
915
|
isSearch: false,
|
|
893
916
|
}),
|
|
894
|
-
checkedRegions: []
|
|
917
|
+
//checkedRegions: []
|
|
895
918
|
};
|
|
896
919
|
},
|
|
897
920
|
watch: {
|
|
@@ -1019,6 +1042,7 @@ export default {
|
|
|
1019
1042
|
this.$module = undefined;
|
|
1020
1043
|
},
|
|
1021
1044
|
computed: {
|
|
1045
|
+
...mapStores(useMainStore),
|
|
1022
1046
|
...mapState(useMainStore, ['userToken']),
|
|
1023
1047
|
annotationDisplay: function() {
|
|
1024
1048
|
return this.viewingMode === 'Annotation' && this.tData.active === true &&
|
|
@@ -1039,52 +1063,34 @@ export default {
|
|
|
1039
1063
|
},
|
|
1040
1064
|
},
|
|
1041
1065
|
methods: {
|
|
1066
|
+
/*
|
|
1042
1067
|
setCheckedRegions: function (data) {
|
|
1043
1068
|
this.checkedRegions = data;
|
|
1044
1069
|
},
|
|
1070
|
+
*/
|
|
1045
1071
|
/**
|
|
1046
|
-
*
|
|
1072
|
+
*
|
|
1047
1073
|
* @param nerves array of nerve names, show all nerves if empty
|
|
1048
1074
|
* @param processed boolean, whether unselect all checkboxes
|
|
1049
1075
|
*/
|
|
1050
1076
|
zoomToNerves: function (nerves, processed = false) {
|
|
1051
1077
|
if (this.$module.scene) {
|
|
1052
|
-
|
|
1078
|
+
this.$module.setIgnorePicking(processed);
|
|
1079
|
+
const nervesList = [];
|
|
1053
1080
|
const regions = this.$module.scene.getRootRegion().getChildRegions();
|
|
1054
1081
|
regions.forEach((region) => {
|
|
1055
1082
|
const regionName = region.getName();
|
|
1056
|
-
if (
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
const ids = primitive.map((object) => {
|
|
1063
|
-
object.setVisibility(true);
|
|
1064
|
-
return `${object.region.uuid}/${object.uuid}`;
|
|
1065
|
-
});
|
|
1066
|
-
acc.push(...ids);
|
|
1067
|
-
return acc;
|
|
1068
|
-
}, []);
|
|
1069
|
-
idsList.push(...ids)
|
|
1070
|
-
} else {
|
|
1071
|
-
region.showAllPrimitives();
|
|
1072
|
-
idsList.push(region.uuid)
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
} else {
|
|
1076
|
-
// if the checkboxes are checked previously, restore them
|
|
1077
|
-
const isChecked = this.checkedRegions.find(item => item.label === regionName);
|
|
1078
|
-
if (isChecked) {
|
|
1079
|
-
region.showAllPrimitives();
|
|
1080
|
-
idsList.push(region.uuid);
|
|
1083
|
+
if (regionName === 'Nerves') {
|
|
1084
|
+
if (processed) {
|
|
1085
|
+
nerves.forEach((nerve) => {
|
|
1086
|
+
const primitives = this.findObjectsWithGroupName(nerve);
|
|
1087
|
+
nervesList.push(...primitives);
|
|
1088
|
+
});
|
|
1081
1089
|
}
|
|
1082
1090
|
}
|
|
1083
1091
|
});
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
}
|
|
1087
|
-
this.$refs.scaffoldTreeControls.setCheckedKeys(idsList, processed);
|
|
1092
|
+
this.$module.setSelectedByZincObjects(nervesList, undefined, {}, true);
|
|
1093
|
+
this.$module.scene.viewAll();
|
|
1088
1094
|
}
|
|
1089
1095
|
},
|
|
1090
1096
|
enableAxisDisplay: function (enable, miniaxes) {
|
|
@@ -1119,25 +1125,37 @@ export default {
|
|
|
1119
1125
|
if (this.timeVarying === false && zincObject.isTimeVarying()) {
|
|
1120
1126
|
this.timeVarying = true;
|
|
1121
1127
|
}
|
|
1128
|
+
const groupName = zincObject.groupName.toLowerCase();
|
|
1129
|
+
if (groupName in organsMap) {
|
|
1130
|
+
zincObject.setAnatomicalId(organsMap[groupName]);
|
|
1131
|
+
}
|
|
1132
|
+
const morph = zincObject.getGroup();
|
|
1133
|
+
if (morph && morph.position) {
|
|
1134
|
+
zincObject.userData.originalPos = [
|
|
1135
|
+
morph.position.x,
|
|
1136
|
+
morph.position.y,
|
|
1137
|
+
morph.position.z
|
|
1138
|
+
];
|
|
1139
|
+
} else {
|
|
1140
|
+
zincObject.userData.originalPos = [0, 0, 0];
|
|
1141
|
+
}
|
|
1122
1142
|
//Temporary way to mark an object as nerves
|
|
1123
1143
|
const regions = this.isNerves?.regions;
|
|
1124
1144
|
if (regions) {
|
|
1125
1145
|
const regionPath = zincObject.getRegion().getFullPath().toLowerCase();
|
|
1126
1146
|
for (let i = 0; i < regions.length; i++) {
|
|
1127
1147
|
if (regionPath.includes(regions[i].toLowerCase())) {
|
|
1128
|
-
totalNerves++;
|
|
1129
1148
|
zincObject.userData.isNerves = true;
|
|
1130
|
-
|
|
1149
|
+
zincObject.userData.defaultColour = `#${zincObject.getColourHex()}`;
|
|
1150
|
+
zincObject.userData.isGreyScale = false;
|
|
1131
1151
|
if (groupName in nervesMap) {
|
|
1132
1152
|
foundNerves++;
|
|
1133
1153
|
zincObject.setAnatomicalId(nervesMap[groupName]);
|
|
1134
|
-
// console.log(groupName, zincObject.anatomicalId, zincObject.uuid)
|
|
1135
1154
|
}
|
|
1136
1155
|
} else {
|
|
1137
1156
|
zincObject.userData.isNerves = false;
|
|
1138
1157
|
}
|
|
1139
1158
|
}
|
|
1140
|
-
|
|
1141
1159
|
}
|
|
1142
1160
|
/**
|
|
1143
1161
|
* Emit when a new object is added to the scene
|
|
@@ -1745,16 +1763,21 @@ export default {
|
|
|
1745
1763
|
this.$refs.scaffoldTreeControls.removeActive(false);
|
|
1746
1764
|
}
|
|
1747
1765
|
}
|
|
1766
|
+
|
|
1748
1767
|
//Store the following for state saving. Search will handle the case with more than 1
|
|
1749
1768
|
//identifiers.
|
|
1750
1769
|
if (event.identifiers.length === 1) {
|
|
1751
|
-
this.lastSelected
|
|
1752
|
-
|
|
1753
|
-
|
|
1770
|
+
this.lastSelected = {
|
|
1771
|
+
isSearch: false,
|
|
1772
|
+
region: regionPath,
|
|
1773
|
+
group: event.identifiers[0].data.group,
|
|
1774
|
+
}
|
|
1754
1775
|
} else if (event.identifiers.length === 0) {
|
|
1755
|
-
this.lastSelected
|
|
1756
|
-
|
|
1757
|
-
|
|
1776
|
+
this.lastSelected = {
|
|
1777
|
+
isSearch: false,
|
|
1778
|
+
region: "",
|
|
1779
|
+
group: "",
|
|
1780
|
+
}
|
|
1758
1781
|
}
|
|
1759
1782
|
/**
|
|
1760
1783
|
* Emit when an object is selected
|
|
@@ -1841,7 +1864,7 @@ export default {
|
|
|
1841
1864
|
* @arg objects objects to be set for the selected
|
|
1842
1865
|
*/
|
|
1843
1866
|
updatePrimitiveControls: function (objects) {
|
|
1844
|
-
if (this.viewingMode === 'Exploration') {
|
|
1867
|
+
if (this.viewingMode === 'Exploration' || this.viewingMode === 'Annotation') {
|
|
1845
1868
|
this.selectedObjects = objects;
|
|
1846
1869
|
if (this.selectedObjects && this.selectedObjects.length > 0) {
|
|
1847
1870
|
this.$refs.primitiveControls.setObject(this.selectedObjects[0]);
|
|
@@ -1858,6 +1881,7 @@ export default {
|
|
|
1858
1881
|
* is made
|
|
1859
1882
|
*/
|
|
1860
1883
|
objectSelected: function (objects, propagate) {
|
|
1884
|
+
if (this.$module.isIgnorePicking()) return;
|
|
1861
1885
|
this.updatePrimitiveControls(objects);
|
|
1862
1886
|
this.$module.setSelectedByZincObjects(objects, undefined, {}, propagate);
|
|
1863
1887
|
},
|
|
@@ -2189,10 +2213,10 @@ export default {
|
|
|
2189
2213
|
* Optional, can be used to update the view mode.
|
|
2190
2214
|
*/
|
|
2191
2215
|
changeViewingMode: function (modeName) {
|
|
2216
|
+
let objectIsPickable = true;
|
|
2192
2217
|
if (this.$module) {
|
|
2193
2218
|
if (modeName) {
|
|
2194
2219
|
this.viewingMode = modeName;
|
|
2195
|
-
this.setIsPickable(true);
|
|
2196
2220
|
}
|
|
2197
2221
|
this.clearAnnotationFeature();
|
|
2198
2222
|
if (this.viewingMode === "Annotation") {
|
|
@@ -2214,9 +2238,11 @@ export default {
|
|
|
2214
2238
|
this.activeDrawMode = undefined;
|
|
2215
2239
|
this.createData.shape = "";
|
|
2216
2240
|
} else if (this.viewingMode === "Neuron Connection") {
|
|
2217
|
-
|
|
2241
|
+
// enable to make organs and nerves clickable and searchable for neuron connection mode
|
|
2242
|
+
objectIsPickable = false;
|
|
2218
2243
|
}
|
|
2219
2244
|
if ((this.viewingMode === "Exploration") ||
|
|
2245
|
+
(this.viewingMode === "Neuron Connection") ||
|
|
2220
2246
|
(this.viewingMode === "Annotation") &&
|
|
2221
2247
|
(this.createData.shape === "")) {
|
|
2222
2248
|
this.$module.selectObjectOnPick = true;
|
|
@@ -2224,6 +2250,9 @@ export default {
|
|
|
2224
2250
|
this.$module.selectObjectOnPick = false;
|
|
2225
2251
|
}
|
|
2226
2252
|
this.cancelCreate();
|
|
2253
|
+
if (modeName) {
|
|
2254
|
+
this.setObjectIsPickable(objectIsPickable);
|
|
2255
|
+
}
|
|
2227
2256
|
}
|
|
2228
2257
|
},
|
|
2229
2258
|
/**
|
|
@@ -2249,30 +2278,36 @@ export default {
|
|
|
2249
2278
|
this.tData.region = undefined;
|
|
2250
2279
|
},
|
|
2251
2280
|
/**
|
|
2252
|
-
* Currently will
|
|
2281
|
+
* Currently will apply to non-nerve object and object without anatomical id
|
|
2253
2282
|
* @param flag boolean to control whether objects pickable
|
|
2254
2283
|
*/
|
|
2255
|
-
|
|
2284
|
+
setObjectIsPickable: function (flag) {
|
|
2256
2285
|
const objects = this.$module.scene.getRootRegion().getAllObjects(true);
|
|
2257
2286
|
objects.forEach((zincObject) => {
|
|
2258
|
-
if (!zincObject.userData
|
|
2287
|
+
if (!zincObject.userData?.isNerves && !zincObject.anatomicalId) {
|
|
2288
|
+
zincObject.setIsPickable(flag);
|
|
2289
|
+
}
|
|
2259
2290
|
});
|
|
2260
2291
|
},
|
|
2261
2292
|
/**
|
|
2262
|
-
*
|
|
2293
|
+
* Update objects to greyscale or colour.
|
|
2294
|
+
* This will update all objects except those with the provided nerves labels.
|
|
2263
2295
|
* @param flag boolean
|
|
2264
|
-
* @param
|
|
2296
|
+
* @param labels array of nerve names that exclude from greyscale
|
|
2265
2297
|
*/
|
|
2266
|
-
setGreyScale: function (flag,
|
|
2298
|
+
setGreyScale: function (flag, labels = []) {
|
|
2267
2299
|
const objects = this.$module.scene.getRootRegion().getAllObjects(true);
|
|
2268
2300
|
objects.forEach((zincObject) => {
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2301
|
+
const groupName = zincObject.groupName.toLowerCase();
|
|
2302
|
+
const isNerves = zincObject.userData?.isNerves;
|
|
2303
|
+
|
|
2304
|
+
const shouldUpdate =
|
|
2305
|
+
(labels.length > 0 && isNerves && !labels.includes(groupName)) ||
|
|
2306
|
+
(labels.length === 0 && !isNerves);
|
|
2307
|
+
|
|
2308
|
+
if (shouldUpdate) {
|
|
2309
|
+
zincObject.setGreyScale(flag);
|
|
2310
|
+
zincObject.userData.isGreyScale = flag;
|
|
2276
2311
|
}
|
|
2277
2312
|
});
|
|
2278
2313
|
this.$refs.scaffoldTreeControls.updateAllNodeColours();
|
|
@@ -2285,7 +2320,7 @@ export default {
|
|
|
2285
2320
|
*/
|
|
2286
2321
|
setColour: function (flag, forced = false) {
|
|
2287
2322
|
if (this.isReady && this.$module.scene &&
|
|
2288
|
-
typeof flag === "boolean" &&
|
|
2323
|
+
typeof flag === "boolean" &&
|
|
2289
2324
|
(forced || flag !== this.colourRadio)) {
|
|
2290
2325
|
this.loading = true;
|
|
2291
2326
|
//This can take sometime to finish , nextTick does not bring out
|
|
@@ -2296,7 +2331,7 @@ export default {
|
|
|
2296
2331
|
this.colourRadio = flag;
|
|
2297
2332
|
}, 100);
|
|
2298
2333
|
}
|
|
2299
|
-
},
|
|
2334
|
+
},
|
|
2300
2335
|
/**
|
|
2301
2336
|
* @public
|
|
2302
2337
|
* Function to toggle lines graphics.
|
|
@@ -2305,7 +2340,7 @@ export default {
|
|
|
2305
2340
|
*/
|
|
2306
2341
|
setOutlines: function (flag, forced = false) {
|
|
2307
2342
|
if (this.isReady && this.$module.scene &&
|
|
2308
|
-
typeof flag === "boolean" &&
|
|
2343
|
+
typeof flag === "boolean" &&
|
|
2309
2344
|
(forced || flag !== this.outlinesRadio)) {
|
|
2310
2345
|
this.outlinesRadio = flag;
|
|
2311
2346
|
this.$nextTick(() => this.$refs.scaffoldTreeControls.setOutlines(flag));
|
|
@@ -2382,15 +2417,19 @@ export default {
|
|
|
2382
2417
|
if (text === undefined || text === "" ||
|
|
2383
2418
|
((Array.isArray(text) && text.length === 0))
|
|
2384
2419
|
) {
|
|
2385
|
-
this.lastSelected
|
|
2386
|
-
|
|
2387
|
-
|
|
2420
|
+
this.lastSelected = {
|
|
2421
|
+
region: "",
|
|
2422
|
+
group: "",
|
|
2423
|
+
isSearch: true,
|
|
2424
|
+
}
|
|
2388
2425
|
this.objectSelected([], true);
|
|
2389
2426
|
return false;
|
|
2390
2427
|
} else {
|
|
2391
|
-
this.lastSelected
|
|
2392
|
-
|
|
2393
|
-
|
|
2428
|
+
this.lastSelected = {
|
|
2429
|
+
region: "",
|
|
2430
|
+
group: text,
|
|
2431
|
+
isSearch: true,
|
|
2432
|
+
}
|
|
2394
2433
|
const result = this.$_searchIndex.searchAndProcessResult(text);
|
|
2395
2434
|
const zincObjects = result.zincObjects;
|
|
2396
2435
|
if (zincObjects.length > 0) {
|
|
@@ -2477,7 +2516,7 @@ export default {
|
|
|
2477
2516
|
if (options.offlineAnnotations) {
|
|
2478
2517
|
sessionStorage.setItem('anonymous-annotation', options.offlineAnnotations);
|
|
2479
2518
|
}
|
|
2480
|
-
if ("outlines" in options) {
|
|
2519
|
+
if ("outlines" in options) {
|
|
2481
2520
|
this.setOutlines(options.outlines);
|
|
2482
2521
|
}
|
|
2483
2522
|
if (options.viewingMode) {
|
|
@@ -2523,7 +2562,7 @@ export default {
|
|
|
2523
2562
|
//this.$module.scene.createAxisDisplay(false);
|
|
2524
2563
|
//this.$module.scene.enableAxisDisplay(true, true);
|
|
2525
2564
|
this.isReady = true;
|
|
2526
|
-
//
|
|
2565
|
+
//console.log(`found ${foundNerves}`);
|
|
2527
2566
|
this.$nextTick(() => {
|
|
2528
2567
|
this.restoreSettings(options);
|
|
2529
2568
|
this.$emit("on-ready");
|
|
@@ -2546,6 +2585,7 @@ export default {
|
|
|
2546
2585
|
colour: this.colourRadio,
|
|
2547
2586
|
outlines: this.outlinesRadio,
|
|
2548
2587
|
viewingMode: this.viewingMode,
|
|
2588
|
+
usageConfig: this.usageConfig,
|
|
2549
2589
|
};
|
|
2550
2590
|
if (this.$refs.scaffoldTreeControls)
|
|
2551
2591
|
state.visibility = this.$refs.scaffoldTreeControls.getState();
|
|
@@ -2667,6 +2707,7 @@ export default {
|
|
|
2667
2707
|
*/
|
|
2668
2708
|
setURLAndState: function (newValue, state) {
|
|
2669
2709
|
if (newValue != this._currentURL) {
|
|
2710
|
+
const options = {};
|
|
2670
2711
|
if (state?.format) this.fileFormat = state.format;
|
|
2671
2712
|
this._currentURL = newValue;
|
|
2672
2713
|
if (this.$refs.scaffoldTreeControls) this.$refs.scaffoldTreeControls.clear();
|
|
@@ -2695,13 +2736,17 @@ export default {
|
|
|
2695
2736
|
if (this.fileFormat === "gltf") {
|
|
2696
2737
|
this.$module.loadGLTFFromURL(newValue, "scene", true);
|
|
2697
2738
|
} else {
|
|
2739
|
+
if (this?.usageConfig?.tubeLines || state?.usageConfig?.tubeLines){
|
|
2740
|
+
options.tubeLines = true;
|
|
2741
|
+
}
|
|
2698
2742
|
this.$module.loadOrgansFromURL(
|
|
2699
2743
|
newValue,
|
|
2700
2744
|
undefined,
|
|
2701
2745
|
undefined,
|
|
2702
2746
|
"scene",
|
|
2703
2747
|
undefined,
|
|
2704
|
-
true
|
|
2748
|
+
true,
|
|
2749
|
+
options
|
|
2705
2750
|
);
|
|
2706
2751
|
}
|
|
2707
2752
|
if (this.$module && this.$module.scene) {
|
|
@@ -171,6 +171,7 @@ export default {
|
|
|
171
171
|
if (object.isZincObject) {
|
|
172
172
|
this.zincObject = markRaw(object);
|
|
173
173
|
const morph = this.zincObject.getGroup();
|
|
174
|
+
const originalPos = this.zincObject.userData.originalPos;
|
|
174
175
|
if (morph && morph.position) {
|
|
175
176
|
this.x = morph.position.x;
|
|
176
177
|
this.y = morph.position.y;
|
|
@@ -181,6 +182,18 @@ export default {
|
|
|
181
182
|
this.scale = morph.scale.x;
|
|
182
183
|
}
|
|
183
184
|
this.enableScaling = this.zincObject.isTextureSlides ? false : true;
|
|
185
|
+
if (originalPos && this.boundingDims) {
|
|
186
|
+
this.min = [
|
|
187
|
+
originalPos[0] - this.boundingDims.size[0],
|
|
188
|
+
originalPos[1] - this.boundingDims.size[1],
|
|
189
|
+
originalPos[2] - this.boundingDims.size[2]
|
|
190
|
+
];
|
|
191
|
+
this.max = [
|
|
192
|
+
originalPos[0] + this.boundingDims.size[0],
|
|
193
|
+
originalPos[1] + this.boundingDims.size[1],
|
|
194
|
+
originalPos[2] + this.boundingDims.size[2]
|
|
195
|
+
];
|
|
196
|
+
}
|
|
184
197
|
}
|
|
185
198
|
} else {
|
|
186
199
|
this.zincObject = undefined;
|
|
@@ -191,7 +204,9 @@ export default {
|
|
|
191
204
|
}
|
|
192
205
|
},
|
|
193
206
|
modifyPosition: function() {
|
|
194
|
-
this.zincObject
|
|
207
|
+
if (this.zincObject) {
|
|
208
|
+
this.zincObject.setPosition(this.x, this.y, this.z);
|
|
209
|
+
}
|
|
195
210
|
},
|
|
196
211
|
modifyScale: function() {
|
|
197
212
|
this.zincObject.setScaleAll(this.scale);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { THREE } from 'zincjs';
|
|
2
|
+
import { objectsToZincObjects, NERVE_CONFIG } from "./Utilities";
|
|
2
3
|
|
|
3
4
|
const setEmissiveColour = (fullList, colour, setDepthFunc) => {
|
|
4
5
|
for (let i = 0; i < fullList.length; i++) {
|
|
@@ -117,11 +118,13 @@ const GraphicsHighlight = function() {
|
|
|
117
118
|
*/
|
|
118
119
|
|
|
119
120
|
this.setHighlighted = function(objects) {
|
|
120
|
-
const previousHighlightedObjects = [...currentHighlightedObjects];
|
|
121
|
+
const previousHighlightedObjects = [...currentHighlightedObjects];
|
|
122
|
+
this.setNervesStyle(previousHighlightedObjects);
|
|
121
123
|
_this.resetHighlighted();
|
|
122
124
|
// Selected object cannot be highlighted
|
|
123
125
|
const array = getUnmatchingObjects(objects, currentSelectedObjects);
|
|
124
126
|
const fullList = getFullListOfObjects(array);
|
|
127
|
+
this.setNervesStyle(array, NERVE_CONFIG.HIGHLIGHTED_COLOUR);
|
|
125
128
|
setEmissiveColour(fullList, _this.highlightColour, false);
|
|
126
129
|
currentHighlightedObjects = array;
|
|
127
130
|
return isDifferent(currentHighlightedObjects, previousHighlightedObjects);
|
|
@@ -129,14 +132,16 @@ const GraphicsHighlight = function() {
|
|
|
129
132
|
|
|
130
133
|
this.setSelected = function(objects) {
|
|
131
134
|
// first find highlighted object that are not selected
|
|
132
|
-
const
|
|
135
|
+
const previousSelectedObjects = [...currentSelectedObjects];
|
|
136
|
+
this.setNervesStyle(previousSelectedObjects);
|
|
133
137
|
//const array = getUnmatchingObjects(currentHighlightedObjects, objects);
|
|
134
138
|
_this.resetHighlighted();
|
|
135
139
|
_this.resetSelected();
|
|
136
140
|
const fullList = getFullListOfObjects(objects);
|
|
141
|
+
this.setNervesStyle(objects, NERVE_CONFIG.SELECTED_COLOUR);
|
|
137
142
|
setEmissiveColour(fullList, _this.selectColour, false);
|
|
138
143
|
currentSelectedObjects = objects;
|
|
139
|
-
return isDifferent(currentSelectedObjects,
|
|
144
|
+
return isDifferent(currentSelectedObjects, previousSelectedObjects);
|
|
140
145
|
}
|
|
141
146
|
|
|
142
147
|
const getFullListOfObjects = function(objects) {
|
|
@@ -147,15 +152,45 @@ const GraphicsHighlight = function() {
|
|
|
147
152
|
}
|
|
148
153
|
return _temp2;
|
|
149
154
|
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
*
|
|
158
|
+
* @param {*} target
|
|
159
|
+
* @param {*} colour use colour as flag to set or reset the style
|
|
160
|
+
* @returns
|
|
161
|
+
*/
|
|
162
|
+
this.setNervesStyle = function(target, colour) {
|
|
163
|
+
const currentObjects = objectsToZincObjects(target);
|
|
164
|
+
if (currentObjects && currentObjects.length) {
|
|
165
|
+
const radius = colour ?
|
|
166
|
+
NERVE_CONFIG.ZOOM_RADIUS : NERVE_CONFIG.DEFAULT_RADIUS;
|
|
167
|
+
const radialSegments = colour ?
|
|
168
|
+
NERVE_CONFIG.ZOOM_RADIAL_SEGMENTS : NERVE_CONFIG.DEFAULT_RADIAL_SEGMENTS;
|
|
169
|
+
currentObjects.forEach((currentObject) => {
|
|
170
|
+
if (
|
|
171
|
+
currentObject.isTubeLines &&
|
|
172
|
+
currentObject.userData?.isNerves &&
|
|
173
|
+
!currentObject.userData?.isGreyScale
|
|
174
|
+
) {
|
|
175
|
+
currentObject.setTubeLines(radius, radialSegments);
|
|
176
|
+
let hexString = colour ? colour : currentObject.userData?.defaultColour;
|
|
177
|
+
hexString = hexString.replace("#", "0x");
|
|
178
|
+
currentObject.setColourHex(hexString);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
150
183
|
|
|
151
184
|
this.resetHighlighted = function() {
|
|
152
185
|
const fullList = getFullListOfObjects(currentHighlightedObjects);
|
|
186
|
+
this.setNervesStyle(currentHighlightedObjects);
|
|
153
187
|
setEmissiveColour(fullList, _this.originalColour, true);
|
|
154
188
|
currentHighlightedObjects = [];
|
|
155
189
|
}
|
|
156
190
|
|
|
157
191
|
this.resetSelected = function() {
|
|
158
192
|
const fullList = getFullListOfObjects(currentSelectedObjects);
|
|
193
|
+
this.setNervesStyle(currentHighlightedObjects);
|
|
159
194
|
setEmissiveColour(fullList, _this.originalColour, true);
|
|
160
195
|
currentSelectedObjects = [];
|
|
161
196
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const organsWithAnatomicalIds = [
|
|
2
|
+
{
|
|
3
|
+
"label": "urinary bladder",
|
|
4
|
+
"anatomicalId": "UBERON:0001255",
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
"label": "brainstem",
|
|
8
|
+
"anatomicalId": "UBERON:0002298",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"label": "caecum",
|
|
12
|
+
"anatomicalId": "UBERON:0001153",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"label": "colon",
|
|
16
|
+
"anatomicalId": "UBERON:0001155",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"label": "esophagus",
|
|
20
|
+
"anatomicalId": "UBERON:0001043",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"label": "small intestine",
|
|
24
|
+
"anatomicalId": "UBERON:0002108",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"label": "stomach",
|
|
28
|
+
"anatomicalId": "UBERON:0000945",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"label": "heart",
|
|
32
|
+
"anatomicalId": "UBERON:0000948",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"label": "lung",
|
|
36
|
+
"anatomicalId": "UBERON:0002048",
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
const getOrganMaps = () => {
|
|
41
|
+
const curatedMap = {};
|
|
42
|
+
organsWithAnatomicalIds.forEach((item) => {
|
|
43
|
+
const label = item.label.toLowerCase();
|
|
44
|
+
if (!(label in curatedMap))
|
|
45
|
+
curatedMap[label.toLowerCase()] = item["anatomicalId"];
|
|
46
|
+
});
|
|
47
|
+
return curatedMap;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export { getOrganMaps };
|
|
@@ -44,6 +44,15 @@ const OrgansSceneData = function() {
|
|
|
44
44
|
const modelsLoader = ModelsLoaderIn;
|
|
45
45
|
this.NDCCameraControl = undefined;
|
|
46
46
|
_this.typeName = "Organ Viewer";
|
|
47
|
+
let ignorePicking = false;
|
|
48
|
+
|
|
49
|
+
this.isIgnorePicking = function() {
|
|
50
|
+
return ignorePicking;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
this.setIgnorePicking = function(value) {
|
|
54
|
+
ignorePicking = value;
|
|
55
|
+
}
|
|
47
56
|
|
|
48
57
|
this.getSceneData = function() {
|
|
49
58
|
return _this.sceneData;
|
|
@@ -275,6 +284,7 @@ const OrgansSceneData = function() {
|
|
|
275
284
|
}
|
|
276
285
|
return;
|
|
277
286
|
} else {
|
|
287
|
+
if (ignorePicking) return;
|
|
278
288
|
_this.setSelectedByObjects([], coords, extraData, true);
|
|
279
289
|
}
|
|
280
290
|
}
|
|
@@ -546,7 +556,7 @@ const OrgansSceneData = function() {
|
|
|
546
556
|
_this.sceneData.currentName = name;
|
|
547
557
|
}
|
|
548
558
|
|
|
549
|
-
this.loadOrgansFromURL = function(url, speciesName, systemName, partName, viewURL, clearFirst) {
|
|
559
|
+
this.loadOrgansFromURL = function(url, speciesName, systemName, partName, viewURL, clearFirst, options) {
|
|
550
560
|
if (_this.zincRenderer) {
|
|
551
561
|
if (partName && (_this.sceneData.metaURL !== url)) {
|
|
552
562
|
setSceneData(speciesName, systemName, partName, undefined);
|
|
@@ -571,7 +581,7 @@ const OrgansSceneData = function() {
|
|
|
571
581
|
_this.sceneData.metaURL = url;
|
|
572
582
|
organScene.addZincObjectAddedCallbacks(_addOrganPartCallback(systemName, partName, false));
|
|
573
583
|
organScene.addZincObjectRemovedCallbacks(_removeOrganPartCallback(undefined, partName, false));
|
|
574
|
-
organScene.loadMetadataURL(url, singleItemFinishCallback(), downloadCompletedCallback());
|
|
584
|
+
organScene.loadMetadataURL(url, singleItemFinishCallback(), downloadCompletedCallback(), options);
|
|
575
585
|
_this.scene = organScene;
|
|
576
586
|
_this.zincRenderer.setCurrentScene(organScene);
|
|
577
587
|
_this.graphicsHighlight.reset();
|