@niivue/niivue 0.43.2 → 0.43.3

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/build/index.d.ts CHANGED
@@ -681,6 +681,7 @@ type DocumentData = {
681
681
  meshesString?: string;
682
682
  sceneData?: SceneData;
683
683
  connectomes?: string[];
684
+ customData?: string;
684
685
  };
685
686
  type ExportDocumentData = {
686
687
  encodedImageBlobs: string[];
@@ -693,6 +694,7 @@ type ExportDocumentData = {
693
694
  meshesString: string;
694
695
  labels: NVLabel3D[];
695
696
  connectomes: string[];
697
+ customData: string;
696
698
  };
697
699
  /**
698
700
  * Creates and instance of NVDocument
@@ -752,6 +754,8 @@ declare class NVDocument {
752
754
  * Sets the 3D labels of the {@link Niivue} instance
753
755
  */
754
756
  set labels(labels: NVLabel3D[]);
757
+ get customData(): string | undefined;
758
+ set customData(data: string);
755
759
  /**
756
760
  * Checks if document has an image by id
757
761
  */
package/build/index.js CHANGED
@@ -13,7 +13,7 @@ var __publicField = (obj, key, value) => {
13
13
  import { mat4 as mat46, vec2, vec3 as vec311, vec4 as vec48 } from "gl-matrix";
14
14
 
15
15
  // package.json
16
- var version = "0.43.2";
16
+ var version = "0.43.3";
17
17
 
18
18
  // src/logger.ts
19
19
  var _Log = class _Log {
@@ -21428,7 +21428,7 @@ var NVImage = class _NVImage {
21428
21428
  */
21429
21429
  toUint8Array(drawingBytes = null) {
21430
21430
  const isDrawing = drawingBytes !== null;
21431
- const hdrBytes = hdrToArrayBuffer(this.hdr, isDrawing);
21431
+ const hdrBytes = hdrToArrayBuffer({ ...this.hdr, vox_offset: 352 }, isDrawing);
21432
21432
  let drawingBytesToBeConverted = drawingBytes;
21433
21433
  if (isDrawing) {
21434
21434
  const perm = this.permRAS;
@@ -21805,6 +21805,12 @@ var NVDocument = class _NVDocument {
21805
21805
  set labels(labels) {
21806
21806
  this.data.labels = labels;
21807
21807
  }
21808
+ get customData() {
21809
+ return this.data.customData;
21810
+ }
21811
+ set customData(data) {
21812
+ this.data.customData = data;
21813
+ }
21808
21814
  /**
21809
21815
  * Checks if document has an image by id
21810
21816
  */
@@ -21877,6 +21883,7 @@ var NVDocument = class _NVDocument {
21877
21883
  data.opts.meshThicknessOn2D = "infinity";
21878
21884
  }
21879
21885
  data.labels = [...this.data.labels];
21886
+ data.customData = this.customData;
21880
21887
  if (this.volumes.length) {
21881
21888
  let imageOptions = this.imageOptionsArray[0];
21882
21889
  if (!imageOptions) {
@@ -26066,6 +26073,14 @@ var Niivue = class _Niivue {
26066
26073
  }
26067
26074
  const image = NVImage.loadFromBase64({ base64: base642, ...imageOptions });
26068
26075
  if (image) {
26076
+ if (image.colormapLabel) {
26077
+ const length = Object.keys(image.colormapLabel.lut).length;
26078
+ const uint8ClampedArray = new Uint8ClampedArray(length);
26079
+ for (const key in image.colormapLabel.lut) {
26080
+ uint8ClampedArray[key] = image.colormapLabel.lut[key];
26081
+ }
26082
+ image.colormapLabel.lut = uint8ClampedArray;
26083
+ }
26069
26084
  this.addVolume(image);
26070
26085
  }
26071
26086
  }