@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.
Files changed (45) hide show
  1. package/README.md +31 -12
  2. package/dist/index.html +9 -6
  3. package/dist/scaffoldvuer.js +14095 -13154
  4. package/dist/scaffoldvuer.umd.cjs +48 -48
  5. package/dist/style.css +1 -1
  6. package/eslint.config.js +37 -9
  7. package/package.json +10 -3
  8. package/public/index.html +9 -6
  9. package/src/App.vue +312 -279
  10. package/src/ScaffoldVuer-wc.js +4 -4
  11. package/src/app/DropZone.vue +11 -27
  12. package/src/app/ModelsInformation.js +22 -19
  13. package/src/app/ModelsTable.vue +42 -65
  14. package/src/app/TextureDemos.js +38 -64
  15. package/src/assets/_variables.scss +12 -10
  16. package/src/components/GlyphsControls.vue +3 -23
  17. package/src/components/LinesControls.vue +27 -66
  18. package/src/components/OpacityControls.vue +22 -26
  19. package/src/components/PointsControls.vue +20 -71
  20. package/src/components/PrimitiveControls.vue +35 -49
  21. package/src/components/ScaffoldOverlay.vue +63 -63
  22. package/src/components/ScaffoldTooltip.vue +36 -49
  23. package/src/components/ScaffoldTreeControls.vue +81 -129
  24. package/src/components/ScaffoldVuer.vue +509 -498
  25. package/src/components/TextureSlidesControls.vue +22 -64
  26. package/src/components/TransformationControls.vue +15 -42
  27. package/src/components/index.js +2 -2
  28. package/src/main.js +16 -18
  29. package/src/scripts/Annotation.js +3 -3
  30. package/src/scripts/BaseModule.js +26 -30
  31. package/src/scripts/EventNotifier.js +30 -36
  32. package/src/scripts/GraphicsHighlight.js +43 -50
  33. package/src/scripts/LocalFilesHelper.js +27 -26
  34. package/src/scripts/MappedNerves.js +2139 -697
  35. package/src/scripts/MappedOrgans.js +24 -25
  36. package/src/scripts/OrgansRenderer.js +445 -425
  37. package/src/scripts/RendererModule.js +133 -122
  38. package/src/scripts/Search.js +135 -151
  39. package/src/scripts/Utilities.js +129 -127
  40. package/src/scripts/WebGL.js +57 -91
  41. package/src/scripts/niftiHelper.js +3 -3
  42. package/src/store/index.js +7 -7
  43. package/vite.config.js +51 -50
  44. package/vite.static-build.js +7 -7
  45. package/vuese-generator.js +48 -56
@@ -2,16 +2,10 @@
2
2
  <el-container class="t-slides-container">
3
3
  <el-main class="slides-block">
4
4
  <el-row class="slide-row">
5
- <el-checkbox
6
- v-model="discardAlpha"
7
- >
8
- Discard Translucent Pixel
9
- </el-checkbox>
5
+ <el-checkbox v-model="discardAlpha">Discard Translucent Pixel</el-checkbox>
10
6
  </el-row>
11
7
  <el-row class="slide-row">
12
- <el-col :offset="0" :span="8">
13
- Brightness
14
- </el-col>
8
+ <el-col :offset="0" :span="8">Brightness</el-col>
15
9
  <el-col :offset="0" :span="10">
16
10
  <el-slider
17
11
  v-model="brightness"
@@ -34,9 +28,7 @@
34
28
  </el-col>
35
29
  </el-row>
36
30
  <el-row class="slide-row">
37
- <el-col :offset="0" :span="8">
38
- Contrast
39
- </el-col>
31
+ <el-col :offset="0" :span="8">Contrast</el-col>
40
32
  <el-col :offset="0" :span="10">
41
33
  <el-slider
42
34
  v-model="contrast"
@@ -100,10 +92,7 @@
100
92
  />
101
93
  </el-col>
102
94
  <el-col :offset="0" :span="2">
103
- <el-icon
104
- class="delete-icon"
105
- @click="removeSlide(index, slide)"
106
- >
95
+ <el-icon class="delete-icon" @click="removeSlide(index, slide)">
107
96
  <el-icon-delete />
108
97
  </el-icon>
109
98
  </el-col>
@@ -114,52 +103,22 @@
114
103
  <el-col :span="2">
115
104
  <el-icon><el-icon-plus /></el-icon>
116
105
  </el-col>
117
- <el-col :span="20"> Add a new slide </el-col>
106
+ <el-col :span="20">Add a new slide</el-col>
118
107
  </el-row>
119
108
  </el-footer>
120
109
  </el-container>
121
110
  </template>
122
111
 
123
112
  <script>
124
- /* eslint-disable no-alert, no-console */
125
- import {
126
- Delete as ElIconDelete,
127
- Plus as ElIconPlus,
128
- } from '@element-plus/icons-vue'
129
- import {
130
- ElCheckbox as Checkbox,
131
- ElCol as Col,
132
- ElContainer as Container,
133
- ElDivider as Divider,
134
- ElFooter as Footer,
135
- ElIcon as Icon,
136
- ElInputNumber as InputNumber,
137
- ElMain as Main,
138
- ElRow as Row,
139
- ElSelect as Select,
140
- ElSlider as Slider,
141
- ElOption as Option,
142
- } from "element-plus";
113
+ import { Delete as ElIconDelete, Plus as ElIconPlus } from '@element-plus/icons-vue';
143
114
  import { markRaw } from 'vue';
144
115
 
145
116
  /**
146
117
  * A component to control the opacity of the target object.
147
118
  */
148
119
  export default {
149
- name: "TextureSlidesControls",
120
+ name: 'TextureSlidesControls',
150
121
  components: {
151
- Checkbox,
152
- Col,
153
- Container,
154
- Divider,
155
- Footer,
156
- Icon,
157
- InputNumber,
158
- Main,
159
- Row,
160
- Select,
161
- Slider,
162
- Option,
163
122
  ElIconDelete,
164
123
  ElIconPlus,
165
124
  },
@@ -171,16 +130,16 @@ export default {
171
130
  settings: [],
172
131
  directions: [
173
132
  {
174
- value: "x",
175
- label: "x",
133
+ value: 'x',
134
+ label: 'x',
176
135
  },
177
136
  {
178
- value: "y",
179
- label: "y",
137
+ value: 'y',
138
+ label: 'y',
180
139
  },
181
140
  {
182
- value: "z",
183
- label: "z",
141
+ value: 'z',
142
+ label: 'z',
184
143
  },
185
144
  ],
186
145
  zincObject: undefined,
@@ -210,7 +169,7 @@ export default {
210
169
  }
211
170
  },
212
171
  immediate: false,
213
- }
172
+ },
214
173
  },
215
174
  methods: {
216
175
  setObject: function (object) {
@@ -229,11 +188,11 @@ export default {
229
188
  }
230
189
  },
231
190
  addNewSlide: function () {
232
- const newSettings = { direction: "x", value: 0 };
191
+ const newSettings = { direction: 'x', value: 0 };
233
192
  const returnSettings = this.zincObject.createSlide(newSettings);
234
193
  this.settings.push(returnSettings);
235
194
  },
236
- modifyDirection: function(direction, slide) {
195
+ modifyDirection: function (direction, slide) {
237
196
  if (slide) {
238
197
  slide.direction = direction;
239
198
  this.zincObject.modifySlideSettings(slide);
@@ -254,7 +213,6 @@ export default {
254
213
 
255
214
  <!-- Add "scoped" attribute to limit CSS to this component only -->
256
215
  <style scoped lang="scss">
257
-
258
216
  .add-slides-text {
259
217
  color: $app-primary-color;
260
218
  line-height: 1;
@@ -263,7 +221,7 @@ export default {
263
221
  font-size: 12px;
264
222
  cursor: pointer;
265
223
  pointer-events: auto;
266
- direction:ltr;
224
+ direction: ltr;
267
225
  }
268
226
 
269
227
  :deep(.el-divider--horizontal) {
@@ -271,7 +229,7 @@ export default {
271
229
  }
272
230
 
273
231
  .slides-block {
274
- direction:rtl;
232
+ direction: rtl;
275
233
  pointer-events: auto;
276
234
  &.el-main {
277
235
  padding: 5px;
@@ -286,8 +244,8 @@ export default {
286
244
  }
287
245
  }
288
246
 
289
- #scroll div{
290
- direction:ltr;
247
+ #scroll div {
248
+ direction: ltr;
291
249
  }
292
250
 
293
251
  .my-slider {
@@ -331,7 +289,7 @@ export default {
331
289
  padding-left: 4px;
332
290
  padding-right: 8px;
333
291
  border: none;
334
- font-family: "Asap", sans-serif;
292
+ font-family: 'Asap', sans-serif;
335
293
  line-height: 22px;
336
294
  }
337
295
 
@@ -349,6 +307,6 @@ export default {
349
307
  }
350
308
 
351
309
  .slide-row {
352
- direction:ltr;
310
+ direction: ltr;
353
311
  }
354
312
  </style>
@@ -2,9 +2,7 @@
2
2
  <el-container class="transformation-container">
3
3
  <el-main class="slides-block">
4
4
  <el-row class="tool-row">
5
- <el-col :offset="0" :span="6">
6
- x:
7
- </el-col>
5
+ <el-col :offset="0" :span="6">x:</el-col>
8
6
  <el-col :offset="0" :span="10">
9
7
  <el-slider
10
8
  v-model="x"
@@ -28,9 +26,7 @@
28
26
  </el-col>
29
27
  </el-row>
30
28
  <el-row class="tool-row">
31
- <el-col :offset="0" :span="6">
32
- y:
33
- </el-col>
29
+ <el-col :offset="0" :span="6">y:</el-col>
34
30
  <el-col :offset="0" :span="10">
35
31
  <el-slider
36
32
  v-model="y"
@@ -54,9 +50,7 @@
54
50
  </el-col>
55
51
  </el-row>
56
52
  <el-row class="tool-row">
57
- <el-col :offset="0" :span="6">
58
- z:
59
- </el-col>
53
+ <el-col :offset="0" :span="6">z:</el-col>
60
54
  <el-col :offset="0" :span="10">
61
55
  <el-slider
62
56
  v-model="z"
@@ -80,9 +74,7 @@
80
74
  </el-col>
81
75
  </el-row>
82
76
  <el-row class="tool-row" v-if="enableScaling">
83
- <el-col :offset="0" :span="6">
84
- Scale:
85
- </el-col>
77
+ <el-col :offset="0" :span="6">Scale:</el-col>
86
78
  <el-col :offset="0" :span="10">
87
79
  <el-slider
88
80
  v-model="scale"
@@ -110,29 +102,13 @@
110
102
  </template>
111
103
 
112
104
  <script>
113
- /* eslint-disable no-alert, no-console */
114
-
115
- import {
116
- ElCol as Col,
117
- ElContainer as Container,
118
- ElInputNumber as InputNumber,
119
- ElMain as Main,
120
- ElSlider as Slider,
121
- } from "element-plus";
122
- import { markRaw } from "vue";
105
+ import { markRaw } from 'vue';
123
106
 
124
107
  /**
125
108
  * A component to control the opacity of the target object.
126
109
  */
127
110
  export default {
128
- name: "TransformationControls",
129
- components: {
130
- Col,
131
- Container,
132
- InputNumber,
133
- Main,
134
- Slider,
135
- },
111
+ name: 'TransformationControls',
136
112
  inject: ['boundingDims'],
137
113
  data: function () {
138
114
  return {
@@ -143,12 +119,12 @@ export default {
143
119
  min: [0, 0, 0],
144
120
  max: [1, 1, 1],
145
121
  zincObject: undefined,
146
- enableScaling: true
122
+ enableScaling: true,
147
123
  };
148
124
  },
149
125
  watch: {
150
126
  boundingDims: {
151
- handler: function (value) {
127
+ handler: function (_value) {
152
128
  this.calculateMinAndMax();
153
129
  },
154
130
  immediate: true,
@@ -156,20 +132,19 @@ export default {
156
132
  },
157
133
  },
158
134
  methods: {
159
- calculateMinAndMax: function() {
135
+ calculateMinAndMax: function () {
160
136
  if (this.zincObject) {
161
137
  const originalPos = this.zincObject?.userData?.originalPos;
162
- const morph = this.zincObject.getGroup();
163
138
  if (originalPos && this.boundingDims) {
164
139
  this.min = [
165
140
  originalPos[0] - this.boundingDims.size[0],
166
141
  originalPos[1] - this.boundingDims.size[1],
167
- originalPos[2] - this.boundingDims.size[2]
142
+ originalPos[2] - this.boundingDims.size[2],
168
143
  ];
169
144
  this.max = [
170
145
  originalPos[0] + this.boundingDims.size[0],
171
146
  originalPos[1] + this.boundingDims.size[1],
172
- originalPos[2] + this.boundingDims.size[2]
147
+ originalPos[2] + this.boundingDims.size[2],
173
148
  ];
174
149
  }
175
150
  }
@@ -178,7 +153,6 @@ export default {
178
153
  if (object.isZincObject) {
179
154
  this.zincObject = markRaw(object);
180
155
  const morph = this.zincObject.getGroup();
181
- const originalPos = this.zincObject.userData.originalPos;
182
156
  if (morph && morph.position) {
183
157
  this.x = morph.position.x;
184
158
  this.y = morph.position.y;
@@ -199,12 +173,12 @@ export default {
199
173
  this.scale = 1;
200
174
  }
201
175
  },
202
- modifyPosition: function() {
176
+ modifyPosition: function () {
203
177
  if (this.zincObject) {
204
178
  this.zincObject.setPosition(this.x, this.y, this.z);
205
179
  }
206
180
  },
207
- modifyScale: function() {
181
+ modifyScale: function () {
208
182
  this.zincObject.setScaleAll(this.scale);
209
183
  },
210
184
  },
@@ -263,9 +237,8 @@ export default {
263
237
  }
264
238
 
265
239
  .tool-row {
266
- align-items:center;
240
+ align-items: center;
267
241
  text-align: center;
268
- padding-top:4px;
242
+ padding-top: 4px;
269
243
  }
270
-
271
244
  </style>
@@ -1,6 +1,6 @@
1
1
  // The Vue build version to load with the `import` command
2
2
  // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
3
- import ScaffoldVuer from "./ScaffoldVuer.vue";
4
- import "../assets/fonts.scss";
3
+ import ScaffoldVuer from './ScaffoldVuer.vue';
4
+ import '../assets/fonts.scss';
5
5
 
6
6
  export { ScaffoldVuer };
package/src/main.js CHANGED
@@ -1,30 +1,28 @@
1
- import { createApp } from 'vue'
2
- import { createPinia } from 'pinia'
3
- import * as VueRouter from 'vue-router'
4
- import App from './App.vue'
5
- import { useMainStore } from '@/store/index'
6
- import './assets/fonts.scss'
1
+ import { createApp } from 'vue';
2
+ import { createPinia } from 'pinia';
3
+ import * as VueRouter from 'vue-router';
4
+ import App from './App.vue';
5
+ import { useMainStore } from '@/store/index';
6
+ import './assets/fonts.scss';
7
7
 
8
- const routes = [
9
- { path: '/'},
10
- ]
8
+ const routes = [{ path: '/' }];
11
9
 
12
- const app = createApp(App)
10
+ const app = createApp(App);
13
11
 
14
12
  const router = VueRouter.createRouter({
15
13
  // 4. Provide the history implementation to use. We are using the hash history for simplicity here.
16
14
  history: VueRouter.createWebHashHistory(),
17
15
  routes,
18
- })
19
- app.use(router)
20
- const pinia = createPinia()
16
+ });
17
+ app.use(router);
18
+ const pinia = createPinia();
21
19
 
22
- app.use(pinia)
20
+ app.use(pinia);
23
21
 
24
- const mainStore = useMainStore()
25
- const token = document.cookie.split("; ").find((row) => row.startsWith("user-token"))
22
+ const mainStore = useMainStore();
23
+ const token = document.cookie.split('; ').find((row) => row.startsWith('user-token'));
26
24
  if (mainStore && token) {
27
- mainStore.setUserToken(token.split("=")[1])
25
+ mainStore.setUserToken(token.split('=')[1]);
28
26
  }
29
27
 
30
- app.mount('#app')
28
+ app.mount('#app');
@@ -1,7 +1,7 @@
1
- const Annotation = function() {
2
- this.type = "anatomical";
1
+ const Annotation = function () {
2
+ this.type = 'anatomical';
3
3
  this.data = undefined;
4
4
  this.isAnnotation = true;
5
- }
5
+ };
6
6
 
7
7
  export { Annotation as default };
@@ -1,67 +1,63 @@
1
1
  const MODULE_CHANGE = { ALL: 0, DESTROYED: 1, NAME_CHANGED: 2, SETTINGS_CHANGED: 3 };
2
2
 
3
- const BaseModule = function() {
4
- this.typeName = "Base Module";
5
- this.instanceName = "default";
3
+ const BaseModule = function () {
4
+ this.typeName = 'Base Module';
5
+ this.instanceName = 'default';
6
6
  this.onChangedCallbacks = [];
7
7
  /** Notifier handle for informing other modules of any changes **/
8
8
  this.eventNotifiers = [];
9
- }
9
+ };
10
10
 
11
- BaseModule.prototype.setName = function(name) {
11
+ BaseModule.prototype.setName = function (name) {
12
12
  if (name && this.instanceName !== name) {
13
13
  this.instanceName = name;
14
14
  const callbackArray = this.onChangedCallbacks.slice();
15
15
  for (let i = 0; i < callbackArray.length; i++) {
16
- callbackArray[i]( this, MODULE_CHANGE.NAME_CHANGED );
16
+ callbackArray[i](this, MODULE_CHANGE.NAME_CHANGED);
17
17
  }
18
18
  }
19
- }
19
+ };
20
20
 
21
- BaseModule.prototype.settingsChanged = function() {
22
- const callbackArray = this.onChangedCallbacks.slice();
21
+ BaseModule.prototype.settingsChanged = function () {
22
+ const callbackArray = this.onChangedCallbacks.slice();
23
23
  for (let i = 0; i < callbackArray.length; i++) {
24
- callbackArray[i]( this, MODULE_CHANGE.SETTINGS_CHANGED );
24
+ callbackArray[i](this, MODULE_CHANGE.SETTINGS_CHANGED);
25
25
  }
26
- }
26
+ };
27
27
 
28
- BaseModule.prototype.publishChanges = function(annotations, eventType, zincObjects) {
28
+ BaseModule.prototype.publishChanges = function (annotations, eventType, zincObjects) {
29
29
  for (let i = 0; i < this.eventNotifiers.length; i++) {
30
30
  this.eventNotifiers[i].publish(this, eventType, annotations, zincObjects);
31
31
  }
32
- }
32
+ };
33
33
 
34
- BaseModule.prototype.getName = function() {
34
+ BaseModule.prototype.getName = function () {
35
35
  return this.instanceName;
36
- }
36
+ };
37
37
 
38
- BaseModule.prototype.destroy = function() {
38
+ BaseModule.prototype.destroy = function () {
39
39
  //Make a temorary copy as the array may be altered during the loop
40
40
  const callbackArray = this.onChangedCallbacks.slice();
41
41
  for (let i = 0; i < callbackArray.length; i++) {
42
- callbackArray[i]( this, MODULE_CHANGE.DESTROYED );
42
+ callbackArray[i](this, MODULE_CHANGE.DESTROYED);
43
43
  }
44
44
 
45
45
  delete this;
46
- }
46
+ };
47
47
 
48
- BaseModule.prototype.addChangedCallback = function(callback) {
49
- if (this.onChangedCallbacks.includes(callback) == false)
50
- this.onChangedCallbacks.push(callback);
51
- }
48
+ BaseModule.prototype.addChangedCallback = function (callback) {
49
+ if (this.onChangedCallbacks.includes(callback) == false) this.onChangedCallbacks.push(callback);
50
+ };
52
51
 
53
- BaseModule.prototype.removeChangedCallback = function(callback) {
52
+ BaseModule.prototype.removeChangedCallback = function (callback) {
54
53
  const index = this.onChangedCallbacks.indexOf(callback);
55
54
  if (index > -1) {
56
55
  this.onChangedCallbacks.splice(index, 1);
57
56
  }
58
- }
57
+ };
59
58
 
60
- BaseModule.prototype.addNotifier = function(eventNotifier) {
59
+ BaseModule.prototype.addNotifier = function (eventNotifier) {
61
60
  this.eventNotifiers.push(eventNotifier);
62
- }
61
+ };
63
62
 
64
- export {
65
- BaseModule,
66
- MODULE_CHANGE
67
- }
63
+ export { BaseModule, MODULE_CHANGE };
@@ -1,69 +1,63 @@
1
1
  const EVENT_TYPE = { ALL: 0, SELECTED: 1, HIGHLIGHTED: 2, MOVE: 3 };
2
2
 
3
- const SelectionEvent = function(eventTypeIn, identifiersIn, zincObjects) {
3
+ const SelectionEvent = function (eventTypeIn, identifiersIn, zincObjects) {
4
4
  this.eventType = eventTypeIn;
5
5
  this.identifiers = identifiersIn;
6
6
  this.zincObjects = zincObjects;
7
- }
7
+ };
8
8
 
9
- const returnFullID = function(sourceId) {
10
- //return full annotations with all different name
11
- }
12
-
13
- const Subscription = function(subscriberIn, callbackIn, eventType) {
9
+ const Subscription = function (subscriberIn, callbackIn, eventType) {
14
10
  this.targetedID = [];
15
11
  const subscriber = subscriberIn;
16
12
  const callback = callbackIn;
17
13
  this.targetEventType = eventType;
18
14
  const _this = this;
19
15
 
20
- if (eventType === undefined)
21
- this.targetEventType = EVENT_TYPE.ALL;
22
-
23
- this.getEventType = function() {
16
+ if (eventType === undefined) this.targetEventType = EVENT_TYPE.ALL;
17
+
18
+ this.getEventType = function () {
24
19
  return eventType;
25
- }
26
-
27
- this.notify = function(source, eventType, ids, zincObjects) {
28
- if (source !== subscriber && (_this.targetEventType === EVENT_TYPE.ALL ||
29
- _this.targetEventType === eventType)) {
20
+ };
21
+
22
+ this.notify = function (source, eventType, ids, zincObjects) {
23
+ if (
24
+ source !== subscriber &&
25
+ (_this.targetEventType === EVENT_TYPE.ALL || _this.targetEventType === eventType)
26
+ ) {
30
27
  //should support different type of id e.g lyph, name, fmas...
31
28
  //need a function that finds all relavant ids
32
29
  const event = new SelectionEvent(eventType, ids, zincObjects);
33
30
  callback(event);
34
31
  }
35
- }
36
- }
32
+ };
33
+ };
37
34
 
38
- const EventNotifier = function() {
35
+ const EventNotifier = function () {
39
36
  const subscriptions = [];
40
-
41
- this.publish = function(source, eventType, id, zincObjects) {
42
- for (let i = 0; i < subscriptions.length;i++) {
37
+
38
+ this.publish = function (source, eventType, id, zincObjects) {
39
+ for (let i = 0; i < subscriptions.length; i++) {
43
40
  subscriptions[i].notify(source, eventType, id, zincObjects);
44
41
  }
45
- }
46
-
47
- this.subscribe = function(subscriber, callbackFunction, eventType) {
48
- if (typeof callbackFunction === "function") {
42
+ };
43
+
44
+ this.subscribe = function (subscriber, callbackFunction, eventType) {
45
+ if (typeof callbackFunction === 'function') {
49
46
  const subscription = new Subscription(subscriber, callbackFunction, eventType);
50
47
  subscriptions.push(subscription);
51
48
  return subscription;
52
49
  }
53
50
  return undefined;
54
- }
55
-
56
- this.unsubscribe = function(subscription) {
57
- for (let i = 0; i < subscriptions.length;i++) {
51
+ };
52
+
53
+ this.unsubscribe = function (subscription) {
54
+ for (let i = 0; i < subscriptions.length; i++) {
58
55
  if (subscription === subscriptions[i]) {
59
56
  subscriptions.splice(i, 1);
60
57
  return;
61
58
  }
62
59
  }
63
- }
64
- }
65
-
66
- export {
67
- EventNotifier,
68
- EVENT_TYPE,
60
+ };
69
61
  };
62
+
63
+ export { EventNotifier, EVENT_TYPE };