larvitar 1.5.6 → 1.5.8

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 CHANGED
@@ -6,9 +6,9 @@
6
6
 
7
7
  ## Dicom Image Toolkit for CornerstoneJS
8
8
 
9
- ### Current version: 1.5.6
9
+ ### Current version: 1.5.8
10
10
 
11
- ### Latest Published Release: 1.5.6
11
+ ### Latest Published Release: 1.5.8
12
12
 
13
13
  This library provides common DICOM functionalities to be used in web-applications: it's wrapper that simplifies the use of cornerstone-js environment.
14
14
  Orthogonal multiplanar reformat is included as well as custom loader/exporter for nrrd files and [Vuex](https://vuex.vuejs.org/) custom integration.
@@ -305,12 +305,14 @@ class Larvitar_Store {
305
305
  * @param {Object} vuexStore - The app vuex store [optional]
306
306
  * @param {String} vuexModule - The name of the vuex store module, can be null
307
307
  * @param {Boolean} registerModule - If true, the module is registered under Vuex global store
308
+ * @param {Object} _Vue - The Vue instance
308
309
  */
309
310
 
310
- export function initLarvitarStore(vuexStore, vuexModule, registerModule) {
311
+ export function initLarvitarStore(vuexStore, vuexModule, registerModule, _Vue) {
311
312
  if (vuexStore) {
312
313
  larvitar_store = new Larvitar_Store(vuexStore, vuexModule);
313
314
  if (registerModule) {
315
+ larvitar.defineVue(_Vue);
314
316
  vuexStore.registerModule(vuexModule, larvitar);
315
317
  }
316
318
  } else {
@@ -861,7 +861,16 @@ export const parseTag = function (dataSet, propertyName, element) {
861
861
  */
862
862
  export const getImageMetadata = function (seriesId, instanceUID) {
863
863
  const seriesData = getSeriesDataFromLarvitarManager(seriesId);
864
+ if (seriesData === undefined || seriesData === null) {
865
+ console.log(`Invalid Series ID: ${seriesId}`);
866
+ return [];
867
+ }
864
868
  const imageId = seriesData.instanceUIDs[instanceUID];
869
+ if (imageId === undefined) {
870
+ console.log(`Invalid InstanceUID ID: ${instanceUID}`);
871
+ return [];
872
+ }
873
+
865
874
  let metadata = seriesData.instances[imageId].metadata;
866
875
  // get elements from metadata where the key starts with x and is length 7
867
876
  let metadata_keys = filter(keys(metadata), function (key) {
@@ -870,7 +879,8 @@ export const getImageMetadata = function (seriesId, instanceUID) {
870
879
  // loop metadata using metadata_keys and return list of key value pairs
871
880
  let metadata_list = map(metadata_keys, function (key) {
872
881
  // if value is a dictionary return empty string
873
- const value = metadata[key].constructor == Object ? "" : metadata[key];
882
+ const value =
883
+ metadata[key] && metadata[key].constructor == Object ? "" : metadata[key];
874
884
  // convert key removing x and adding comma at position 4
875
885
  const tagKey = (
876
886
  "(" +
@@ -1,6 +1,5 @@
1
- // Larvitar Vuex storage
2
-
3
- import Vue from "vue";
1
+ // Larvitar Vuex instance
2
+ var Vue = null;
4
3
 
5
4
  // default viewport store object
6
5
  const DEFAULT_VIEWPORT = {
@@ -181,3 +180,8 @@ export default {
181
180
  commit("canvas", { id, d: { voi: { windowWidth, windowCenter } } })
182
181
  }
183
182
  };
183
+
184
+ // define Vue instance from outside dependency
185
+ export const defineVue = _Vue => {
186
+ Vue = _Vue;
187
+ };
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "medical",
7
7
  "cornerstone"
8
8
  ],
9
- "version": "1.5.6",
9
+ "version": "1.5.8",
10
10
  "description": "javascript library for parsing, loading, rendering and interacting with DICOM images",
11
11
  "repository": {
12
12
  "url": "https://github.com/dvisionlab/Larvitar.git",