@abi-software/scaffoldvuer 1.4.0-beta.2 → 1.4.1-image.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/scaffoldvuer",
3
- "version": "1.4.0-beta.2",
3
+ "version": "1.4.1-image.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -55,7 +55,7 @@
55
55
  "vue": "^3.4.15",
56
56
  "vue-router": "^4.2.5",
57
57
  "vue3-component-svg-sprite": "^0.0.1",
58
- "zincjs": "^1.11.3"
58
+ "zincjs": "^1.11.4"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@vitejs/plugin-vue": "^4.6.2",
package/src/App.vue CHANGED
@@ -412,7 +412,6 @@ export default {
412
412
  ElIconFolderOpened: shallowRef(ElIconFolderOpened),
413
413
  auto: NaN,
414
414
  sparcAPI: import.meta.env.VITE_SPARC_API,
415
- // sparcAPI: "http://localhost:8000/",
416
415
  };
417
416
  },
418
417
  computed: {
@@ -463,7 +462,9 @@ export default {
463
462
  },
464
463
  mounted: function () {
465
464
  this._objects = [];
466
- getOrganCuries(this.sparcAPI).then((organCuries) => this.settingsStore.updateOrganCuries(organCuries))
465
+ if (this.sparcAPI) {
466
+ getOrganCuries(this.sparcAPI).then((organCuries) => this.settingsStore.updateOrganCuries(organCuries))
467
+ }
467
468
  },
468
469
  created: function () {
469
470
  texture_prefix = import.meta.env.VITE_TEXTURE_FOOT_PREFIX;
@@ -313,41 +313,45 @@
313
313
  {{ viewingModes[viewingMode] }}
314
314
  </el-row>
315
315
  </el-row>
316
- <el-row class="backgroundSpacer" v-if="viewingMode === 'Exploration'"></el-row>
317
- <el-row class="backgroundText" v-if="viewingMode === 'Exploration'">Markers display</el-row>
318
- <el-row class="backgroundChooser" v-if="viewingMode === 'Exploration'">
319
- <el-col :span="14">
320
- <el-radio-group
321
- v-model="imageRadio"
322
- class="flatmap-radio"
323
- @change="setImage"
324
- >
325
- <el-radio :value="false">Standard</el-radio>
326
- <el-radio :value="true">Image</el-radio>
327
- </el-radio-group>
328
- </el-col>
329
- <el-col :span="10" v-if="imageRadio">
330
- <el-select
331
- :teleported="false"
332
- v-model="imageType"
333
- placeholder="Select"
334
- class="scaffold-select-box imageSelector"
335
- popper-class="scaffold_viewer_dropdown"
336
- @change="setImageType"
337
- >
338
- <el-option
339
- v-for="item in imageTypes"
340
- :key="item"
341
- :label="item"
342
- :value="item"
316
+ <template v-if="viewingMode === 'Exploration' && sparcAPI">
317
+ <el-row class="backgroundSpacer"></el-row>
318
+ <el-row class="backgroundText">Markers display</el-row>
319
+ <el-row class="backgroundChooser">
320
+ <el-col :span="14">
321
+ <el-radio-group
322
+ v-model="imageRadio"
323
+ class="flatmap-radio"
324
+ :disabled="imagesDownloading"
325
+ @change="setImage"
343
326
  >
344
- <el-row>
345
- <el-col :span="12">{{ item }}</el-col>
346
- </el-row>
347
- </el-option>
348
- </el-select>
349
- </el-col>
350
- </el-row>
327
+ <el-radio :value="false">Standard</el-radio>
328
+ <el-radio :value="true">Image</el-radio>
329
+ </el-radio-group>
330
+ </el-col>
331
+ <el-col :span="10" v-if="imageRadio">
332
+ <el-select
333
+ :teleported="false"
334
+ v-model="imageType"
335
+ placeholder="Select"
336
+ class="scaffold-select-box imageSelector"
337
+ popper-class="scaffold_viewer_dropdown"
338
+ :disabled="imagesDownloading"
339
+ @change="setImageType"
340
+ >
341
+ <el-option
342
+ v-for="item in imageTypes"
343
+ :key="item"
344
+ :label="item"
345
+ :value="item"
346
+ >
347
+ <el-row>
348
+ <el-col :span="12">{{ item }}</el-col>
349
+ </el-row>
350
+ </el-option>
351
+ </el-select>
352
+ </el-col>
353
+ </el-row>
354
+ </template>
351
355
  <el-row class="backgroundSpacer"></el-row>
352
356
  <el-row class="backgroundText"> Change background </el-row>
353
357
  <el-row class="backgroundChooser">
@@ -617,12 +621,12 @@ export default {
617
621
  * GroupName to value pair.
618
622
  * The value can be a single number or and object in the following
619
623
  * form:
620
- *
624
+ *
621
625
  * {
622
626
  * number: Number,
623
627
  * imgURL: String
624
628
  * }
625
- *
629
+ *
626
630
  * When imgURL is specified, scaffoldvuer will attempt to render
627
631
  * the image in imgURL as marker instead.
628
632
  *
@@ -745,7 +749,7 @@ export default {
745
749
  */
746
750
  sparcAPI: {
747
751
  type: String,
748
- default: 'https://api.sparc.science/',
752
+ default: '',
749
753
  },
750
754
  /**
751
755
  * The option to show image thumbnail in sidebar
@@ -805,6 +809,7 @@ export default {
805
809
  inHelp: false,
806
810
  helpModeActiveIndex: this.helpModeInitialIndex,
807
811
  loading: false,
812
+ imagesDownloading: false,
808
813
  duration: 3000,
809
814
  drawerOpen: true,
810
815
  currentBackground: "white",
@@ -879,6 +884,10 @@ export default {
879
884
  imageType: 'Image',
880
885
  imageTypes: ['Image', 'Segmentation', 'Scaffold', 'Plot'],
881
886
  imageClicked: '',
887
+ /**
888
+ * List of group names
889
+ */
890
+ groupNames: markRaw([]),
882
891
  };
883
892
  },
884
893
  watch: {
@@ -959,7 +968,10 @@ export default {
959
968
  immediate: true,
960
969
  },
961
970
  markerLabels: function (labels) {
962
- this.markerLabelEntry = markRaw({...labels})
971
+ if (this.imageRadio === false) {
972
+ //Only updates the following if marker mode is standard
973
+ this.markerLabelEntry = markRaw({...labels});
974
+ }
963
975
  },
964
976
  markerLabelEntry: function (entry) {
965
977
  for (const [key, value] of Object.entries(this.previousMarkerLabelEntry)) {
@@ -1040,6 +1052,9 @@ export default {
1040
1052
  if (this.timeVarying === false && zincObject.isTimeVarying()) {
1041
1053
  this.timeVarying = true;
1042
1054
  }
1055
+ if (zincObject.groupName) {
1056
+ this.groupNames.push(zincObject.groupName.toLowerCase());
1057
+ }
1043
1058
  //Emit when a new object is added to the scene
1044
1059
  //@arg The object added to the sceene
1045
1060
  this.$emit("zinc-object-added", zincObject);
@@ -1151,7 +1166,7 @@ export default {
1151
1166
  region, group, this.url, comment);
1152
1167
  if (this.enableLocalAnnotations) {
1153
1168
  annotation.group = group;
1154
- let regionPath = region;
1169
+ let regionPath = region;
1155
1170
  if (regionPath.slice(-1) === "/") {
1156
1171
  regionPath = regionPath.slice(0, -1);
1157
1172
  }
@@ -1254,7 +1269,7 @@ export default {
1254
1269
  }
1255
1270
  }
1256
1271
  this.cancelCreate();
1257
- },
1272
+ },
1258
1273
  formatTooltip(val) {
1259
1274
  if (this.timeMax >= 1000) {
1260
1275
  if (val) {
@@ -1341,7 +1356,7 @@ export default {
1341
1356
  return objects;
1342
1357
  },
1343
1358
  /**
1344
- * Switch active drawing type
1359
+ * Switch active drawing type
1345
1360
  * @arg shapeName shape to toggle
1346
1361
  *
1347
1362
  * @vuese
@@ -1466,7 +1481,7 @@ export default {
1466
1481
  this.createData.points.push(coords);
1467
1482
  }
1468
1483
  }
1469
- },
1484
+ },
1470
1485
  /**
1471
1486
  * Return renderer information
1472
1487
  *
@@ -2029,7 +2044,7 @@ export default {
2029
2044
  /**
2030
2045
  * Set the marker modes for objects with the provided name, mode can
2031
2046
  * be "on", "off" or "inherited".
2032
- * Value can either be number or an object containing number and
2047
+ * Value can either be number or an object containing number and
2033
2048
  * imgURL.
2034
2049
  */
2035
2050
  setMarkerModeForObjectsWithName: function (name, value, mode) {
@@ -2288,7 +2303,7 @@ export default {
2288
2303
  const region = annotation.region;
2289
2304
  let fullName = region.slice(-1) === "/" ? region : region + "/";
2290
2305
  const noSlash = fullName.slice(0, -1);
2291
- annotation.region = noSlash;
2306
+ annotation.region = noSlash;
2292
2307
  fullName = fullName + group;
2293
2308
  const featureID = encodeURIComponent(fullName);
2294
2309
  annotation.item.id = featureID;
@@ -2330,6 +2345,7 @@ export default {
2330
2345
  visibility: visibility,
2331
2346
  })
2332
2347
  );
2348
+ this.groupNames.length = 0;
2333
2349
  if (this.fileFormat === "gltf") {
2334
2350
  this.$module.loadGLTFFromURL(newValue, "scene", true);
2335
2351
  } else {
@@ -2426,54 +2442,59 @@ export default {
2426
2442
  }
2427
2443
  },
2428
2444
  removeImageThumbnails: function () {
2429
- this.imageThumbnails = {}
2430
- this.markerLabelEntry = markRaw(this.markerLabels)
2445
+ this.imageThumbnails = {};
2446
+ this.markerLabelEntry = markRaw(this.markerLabels);
2431
2447
  },
2432
- setImage: function (flag) {
2448
+ setImage: async function (flag) {
2433
2449
  if (flag) {
2434
- this.setImageType(this.imageType)
2450
+ await this.setImageType(this.imageType);
2451
+ this.$module.scene.enableMarkerCluster(false);
2435
2452
  } else {
2436
- this.removeImageThumbnails()
2453
+ this.removeImageThumbnails();
2454
+ this.$module.scene.enableMarkerCluster(this.markerCluster);
2437
2455
  }
2438
2456
  },
2439
2457
  setImageType: async function (type) {
2440
- this.imageType = type
2458
+ this.imageType = type;
2459
+ this.imagesDownloading = true;
2441
2460
  if (!this.settingsStore.imageTypeCached(type)) {
2442
- this.loading = true
2443
- await this.fetchImageThumbnails(type)
2444
- this.loading = false
2461
+ this.loading = true;
2462
+ await this.fetchImageThumbnails(type);
2463
+ this.loading = false;
2445
2464
  }
2446
- this.populateImageThumbnails(type)
2465
+ this.populateImageThumbnails(type);
2447
2466
  },
2448
2467
  fetchImageThumbnails: async function (type) {
2449
- let thumbnails = {}
2450
- const organCuries = this.settingsStore.organCuries
2468
+ let thumbnails = {};
2469
+ const organCuries = this.settingsStore.organCuries;
2451
2470
  if (type === 'Image') {
2452
- thumbnails = await getBiolucidaThumbnails(this.sparcAPI, organCuries, type)
2471
+ thumbnails = await getBiolucidaThumbnails(this.sparcAPI, organCuries, type);
2453
2472
  } else if (type === 'Segmentation') {
2454
- thumbnails = await getSegmentationThumbnails(this.sparcAPI, organCuries, type)
2473
+ thumbnails = await getSegmentationThumbnails(this.sparcAPI, organCuries, type);
2455
2474
  } else if (type === 'Scaffold') {
2456
- thumbnails = await getScaffoldThumbnails(this.sparcAPI, organCuries, type)
2475
+ thumbnails = await getScaffoldThumbnails(this.sparcAPI, organCuries, type);
2457
2476
  } else if (type === 'Plot') {
2458
- thumbnails = await getPlotThumbnails(this.sparcAPI, organCuries, type)
2477
+ thumbnails = await getPlotThumbnails(this.sparcAPI, organCuries, type);
2459
2478
  }
2460
- this.settingsStore.updateImageThumbnails(type, thumbnails)
2479
+ this.settingsStore.updateImageThumbnails(type, thumbnails);
2461
2480
  },
2462
2481
  convertUberonToName: function () {
2463
- const organCuries = this.settingsStore.organCuries
2464
- const identifiers = organCuries.filter((curie) => curie.name in this.markerLabels).map((curie) => curie.id)
2465
- const imageThumbnails = this.settingsStore.getImageThumbnails(this.imageType, identifiers)
2466
- return Object.assign({},
2467
- Object.fromEntries(
2482
+ const organCuries = this.settingsStore.organCuries;
2483
+ const identifiers = organCuries.filter(
2484
+ (curie) => this.groupNames.includes(curie.name.toLowerCase())
2485
+ ).map((curie) => curie.id);
2486
+ const imageThumbnails = this.settingsStore.getImageThumbnails(this.imageType, identifiers);
2487
+ return Object.fromEntries(
2468
2488
  Object.entries(imageThumbnails)
2469
- .map(([key, value]) => [organCuries.filter((curie) => curie.id === key)[0].name, value])))
2489
+ .map(([key, value]) => [organCuries.filter((curie) => curie.id === key)[0].name, value]));
2470
2490
  },
2471
2491
  populateImageThumbnails: async function (type) {
2472
- this.removeImageThumbnails()
2473
- const thumbnails = this.convertUberonToName()
2474
- this.loading = true
2475
- this.markerLabelEntry = markRaw(await this.populateMapWithImages(thumbnails, type))
2476
- this.loading = false
2492
+ this.removeImageThumbnails();
2493
+ const thumbnails = this.convertUberonToName();
2494
+ this.loading = true;
2495
+ this.markerLabelEntry = markRaw(await this.populateMapWithImages(thumbnails, type));
2496
+ this.loading = false;
2497
+ this.imagesDownloading = false;
2477
2498
  },
2478
2499
  onImageThumbnailOpen: function (payload) {
2479
2500
  this.$emit('image-thumbnail-open', payload);
@@ -6,8 +6,6 @@ export default {
6
6
  const response = await this.downloadImageThumbnail(key, list, type);
7
7
  if (response) {
8
8
  imageMarkerLabels[key] = response;
9
- } else {
10
- imageMarkerLabels[key] = this.markerLabels[key];
11
9
  }
12
10
  }
13
11
  return imageMarkerLabels;