@niivue/niivue 0.15.1 → 0.16.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/README.md CHANGED
@@ -38,7 +38,7 @@ We host many NiiVue examples via github pages. These are updated and deployed au
38
38
 
39
39
  ## existing html page
40
40
  ```html
41
- <script src="https://unpkg.com/@niivue/niivue@0.15.1/dist/niivue.umd.js"></script>
41
+ <script src="https://unpkg.com/@niivue/niivue@0.16.0/dist/niivue.umd.js"></script>
42
42
 
43
43
  <canvas id="gl" height=480 width=640></canvas>
44
44
 
package/dist/niivue.es.js CHANGED
@@ -12353,11 +12353,6 @@ var defaultFontMetrics = {
12353
12353
  glyphs,
12354
12354
  kerning
12355
12355
  };
12356
- function WorkerWrapper() {
12357
- return new Worker("./assets/niimathWorker.1f52eda8.js", {
12358
- "type": "module"
12359
- });
12360
- }
12361
12356
  const log = new Log();
12362
12357
  const Niivue = function(options = {}) {
12363
12358
  this.opts = {};
@@ -13111,65 +13106,7 @@ Niivue.prototype.initText = async function() {
13111
13106
  await this.loadDefaultFont();
13112
13107
  this.drawLoadingText(this.loadingText);
13113
13108
  };
13114
- Niivue.prototype.processImage = function(imageIndex, cmd, isNewLayer = true) {
13115
- let image = this.volumes[imageIndex].clone();
13116
- let metadata = image.getImageMetadata();
13117
- this.worker.postMessage([metadata, image.img.buffer, cmd, isNewLayer]);
13118
- };
13119
- Niivue.prototype.initWasm = async function() {
13120
- this.worker = WorkerWrapper;
13121
- this.worker.onmessage = (e) => {
13122
- const id = e.data.id;
13123
- let processedImage = this.volumes.find((image) => image.id == id);
13124
- if (!processedImage) {
13125
- console.log("image not found");
13126
- return;
13127
- }
13128
- const isNewLayer = e.data.isNewLayer;
13129
- if (isNewLayer) {
13130
- processedImage = processedImage.clone();
13131
- processedImage.id = v4();
13132
- }
13133
- let imageBytes = e.data.imageBytes;
13134
- switch (processedImage.hdr.datatypeCode) {
13135
- case processedImage.DT_UNSIGNED_CHAR:
13136
- processedImage.img = new Uint8Array(imageBytes);
13137
- break;
13138
- case processedImage.DT_SIGNED_SHORT:
13139
- processedImage.img = new Int16Array(imageBytes);
13140
- break;
13141
- case processedImage.DT_FLOAT:
13142
- processedImage.img = new Float32Array(imageBytes);
13143
- break;
13144
- case processedImage.DT_DOUBLE:
13145
- throw "datatype " + processedImage.hdr.datatypeCode + " not supported";
13146
- case processedImage.DT_RGB:
13147
- processedImage.img = new Uint8Array(imageBytes);
13148
- break;
13149
- case processedImage.DT_UINT16:
13150
- processedImage.img = new Uint16Array(imageBytes);
13151
- break;
13152
- case processedImage.DT_RGBA32:
13153
- processedImage.img = new Uint8Array(imageBytes);
13154
- break;
13155
- default:
13156
- throw "datatype " + processedImage.hdr.datatypeCode + " not supported";
13157
- }
13158
- processedImage.trustCalMinMax = false;
13159
- processedImage.calMinMax();
13160
- let imageIndex = this.volumes.length;
13161
- if (isNewLayer) {
13162
- this.setVolume(processedImage, this.volumes.length);
13163
- } else {
13164
- imageIndex = this.volumes.indexOf(processedImage);
13165
- }
13166
- this.refreshLayers(processedImage, imageIndex, this.volumes.length);
13167
- this.drawScene();
13168
- this.updateGLVolume();
13169
- };
13170
- };
13171
13109
  Niivue.prototype.init = async function() {
13172
- await this.initWasm();
13173
13110
  this.gl.enable(this.gl.CULL_FACE);
13174
13111
  this.gl.cullFace(this.gl.FRONT);
13175
13112
  this.gl.enable(this.gl.BLEND);