-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
github-actions
committed
Nov 25, 2024
1 parent
1894b47
commit 06b170c
Showing
35 changed files
with
7,156 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,23 @@ | ||
importScripts("rle.js"),self.addEventListener("message",(function(e){var a=new dwvdecoder.RleDecoder;self.postMessage([a.decode(e.data.buffer,e.data.meta.bitsAllocated,e.data.meta.isSigned,e.data.meta.sliceSize,e.data.meta.samplesPerPixel,e.data.meta.planarConfiguration)])}),!1); | ||
/** | ||
* RLE decoder worker. | ||
*/ | ||
// Do not warn if these variables were not defined before. | ||
/* global importScripts */ | ||
|
||
importScripts('rle.js'); | ||
|
||
self.addEventListener('message', function (event) { | ||
|
||
// decode DICOM buffer | ||
// eslint-disable-next-line no-undef | ||
var decoder = new dwvdecoder.RleDecoder(); | ||
// post decoded data | ||
self.postMessage([decoder.decode( | ||
event.data.buffer, | ||
event.data.meta.bitsAllocated, | ||
event.data.meta.isSigned, | ||
event.data.meta.sliceSize, | ||
event.data.meta.samplesPerPixel, | ||
event.data.meta.planarConfiguration)]); | ||
|
||
}, false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,129 @@ | ||
var dwvdecoder=dwvdecoder||{};dwvdecoder.RleDecoder=function(){},dwvdecoder.RleDecoder.prototype.decode=function(e,r,n,t,a,f){var d=r/8,o=new DataView(e.buffer,e.byteOffset),w=new Int8Array(e.buffer,e.byteOffset),v=new ArrayBuffer(t*a*d),y=new Int8Array(v),c=o.getInt32(0,!0),i=1,l=1;1!==a&&0===f&&(l*=a),1!==d&&(l*=d),i*=l;for(var u=0,A=0,I=0,b=0,g=0,s=0;s<c;++s){1!==l&&(I=s%l,0===I&&(g=b),u=g+I,2===d&&(u+=I%d?-1:1));var D=o.getInt32(4*(s+1),!0),h=o.getInt32(4*(s+2),!0);s!==c-1&&0!==h||(h=e.length),A=D;var p=0;while(A<h)if(p=w[A],++A,p>=0&&p<=127)for(var O=0;O<p+1;++O)y[u]=w[A],++A,u+=i;else if(p<=-1&&p>=-127){var R=w[A];++A;for(var U=0;U<1-p;++U)y[u]=R,u+=i}u>b&&(b=u)}var B=null;return 8===r?B=n?new Int8Array(v):new Uint8Array(v):16===r&&(B=n?new Int16Array(v):new Uint16Array(v)),B}; | ||
// namespaces | ||
// (do not use dwv since it is the exported module name) | ||
var dwvdecoder = dwvdecoder || {}; | ||
|
||
/** | ||
* RLE (Run-length encoding) decoder class. | ||
* @constructor | ||
*/ | ||
dwvdecoder.RleDecoder = function () {}; | ||
|
||
/** | ||
* Decode a RLE buffer. | ||
* @param {Array} buffer The buffer to decode. | ||
* @param {Number} bitsAllocated The bits allocated per element in the buffer. | ||
* @param {Boolean} isSigned Is the data signed. | ||
* @param {Number} sliceSize The size of a slice | ||
(number of rows per number of columns). | ||
* @param {Number} samplesPerPixel The number of samples per pixel (3 for RGB). | ||
* @param {Number} planarConfiguration The planar configuration. | ||
* @returns The decoded buffer. | ||
* @see http://dicom.nema.org/dicom/2013/output/chtml/part05/sect_G.3.html | ||
*/ | ||
dwvdecoder.RleDecoder.prototype.decode = function (buffer, | ||
bitsAllocated, isSigned, sliceSize, samplesPerPixel, planarConfiguration) { | ||
|
||
// bytes per element | ||
var bpe = bitsAllocated / 8; | ||
|
||
// input | ||
var inputDataView = new DataView(buffer.buffer, buffer.byteOffset); | ||
var inputArray = new Int8Array(buffer.buffer, buffer.byteOffset); | ||
// output | ||
var outputBuffer = new ArrayBuffer(sliceSize * samplesPerPixel * bpe); | ||
var outputArray = new Int8Array(outputBuffer); | ||
|
||
// first value of the RLE header is the number of segments | ||
var numberOfSegments = inputDataView.getInt32(0, true); | ||
|
||
// index increment in output array | ||
var outputIndexIncrement = 1; | ||
var incrementFactor = 1; | ||
if (samplesPerPixel !== 1 && planarConfiguration === 0) { | ||
incrementFactor *= samplesPerPixel; | ||
} | ||
if (bpe !== 1) { | ||
incrementFactor *= bpe; | ||
} | ||
outputIndexIncrement *= incrementFactor; | ||
|
||
// loop on segments | ||
var outputIndex = 0; | ||
var inputIndex = 0; | ||
var remainder = 0; | ||
var maxOutputIndex = 0; | ||
var groupOutputIndex = 0; | ||
for (var segment = 0; segment < numberOfSegments; ++segment) { | ||
// handle special cases: | ||
// - more than one sample per pixel: one segment per channel | ||
// - 16bits: sort high and low bytes | ||
if (incrementFactor !== 1) { | ||
remainder = segment % incrementFactor; | ||
if (remainder === 0) { | ||
groupOutputIndex = maxOutputIndex; | ||
} | ||
outputIndex = groupOutputIndex + remainder; | ||
// 16bits data | ||
if (bpe === 2) { | ||
outputIndex += (remainder % bpe ? -1 : 1); | ||
} | ||
} | ||
|
||
// RLE header: list of segment sizes | ||
var segmentStartIndex = inputDataView.getInt32((segment + 1) * 4, true); | ||
var nextSegmentStartIndex = inputDataView.getInt32((segment + 2) * 4, true); | ||
if (segment === numberOfSegments - 1 || nextSegmentStartIndex === 0) { | ||
nextSegmentStartIndex = buffer.length; | ||
} | ||
// decode segment | ||
inputIndex = segmentStartIndex; | ||
var count = 0; | ||
while (inputIndex < nextSegmentStartIndex) { | ||
// get the count value | ||
count = inputArray[inputIndex]; | ||
++inputIndex; | ||
// store according to count | ||
if (count >= 0 && count <= 127) { | ||
// output the next count+1 bytes literally | ||
for (var i = 0; i < count + 1; ++i) { | ||
// store | ||
outputArray[outputIndex] = inputArray[inputIndex]; | ||
// increment indexes | ||
++inputIndex; | ||
outputIndex += outputIndexIncrement; | ||
} | ||
} else if (count <= -1 && count >= -127) { | ||
// output the next byte -count+1 times | ||
var value = inputArray[inputIndex]; | ||
++inputIndex; | ||
for (var j = 0; j < -count + 1; ++j) { | ||
// store | ||
outputArray[outputIndex] = value; | ||
// increment index | ||
outputIndex += outputIndexIncrement; | ||
} | ||
} | ||
} | ||
|
||
if (outputIndex > maxOutputIndex) { | ||
maxOutputIndex = outputIndex; | ||
} | ||
} | ||
|
||
var decodedBuffer = null; | ||
if (bitsAllocated === 8) { | ||
if (isSigned) { | ||
decodedBuffer = new Int8Array(outputBuffer); | ||
} else { | ||
decodedBuffer = new Uint8Array(outputBuffer); | ||
} | ||
} else if (bitsAllocated === 16) { | ||
if (isSigned) { | ||
decodedBuffer = new Int16Array(outputBuffer); | ||
} else { | ||
decodedBuffer = new Uint16Array(outputBuffer); | ||
} | ||
} | ||
|
||
return decodedBuffer; | ||
}; |
186 changes: 185 additions & 1 deletion
186
demo/stable/assets/dwv/decoders/pdfjs/arithmetic_decoder.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,185 @@ | ||
"use strict";var ArithmeticDecoder=function(){var s=[{qe:22017,nmps:1,nlps:1,switchFlag:1},{qe:13313,nmps:2,nlps:6,switchFlag:0},{qe:6145,nmps:3,nlps:9,switchFlag:0},{qe:2753,nmps:4,nlps:12,switchFlag:0},{qe:1313,nmps:5,nlps:29,switchFlag:0},{qe:545,nmps:38,nlps:33,switchFlag:0},{qe:22017,nmps:7,nlps:6,switchFlag:1},{qe:21505,nmps:8,nlps:14,switchFlag:0},{qe:18433,nmps:9,nlps:14,switchFlag:0},{qe:14337,nmps:10,nlps:14,switchFlag:0},{qe:12289,nmps:11,nlps:17,switchFlag:0},{qe:9217,nmps:12,nlps:18,switchFlag:0},{qe:7169,nmps:13,nlps:20,switchFlag:0},{qe:5633,nmps:29,nlps:21,switchFlag:0},{qe:22017,nmps:15,nlps:14,switchFlag:1},{qe:21505,nmps:16,nlps:14,switchFlag:0},{qe:20737,nmps:17,nlps:15,switchFlag:0},{qe:18433,nmps:18,nlps:16,switchFlag:0},{qe:14337,nmps:19,nlps:17,switchFlag:0},{qe:13313,nmps:20,nlps:18,switchFlag:0},{qe:12289,nmps:21,nlps:19,switchFlag:0},{qe:10241,nmps:22,nlps:19,switchFlag:0},{qe:9217,nmps:23,nlps:20,switchFlag:0},{qe:8705,nmps:24,nlps:21,switchFlag:0},{qe:7169,nmps:25,nlps:22,switchFlag:0},{qe:6145,nmps:26,nlps:23,switchFlag:0},{qe:5633,nmps:27,nlps:24,switchFlag:0},{qe:5121,nmps:28,nlps:25,switchFlag:0},{qe:4609,nmps:29,nlps:26,switchFlag:0},{qe:4353,nmps:30,nlps:27,switchFlag:0},{qe:2753,nmps:31,nlps:28,switchFlag:0},{qe:2497,nmps:32,nlps:29,switchFlag:0},{qe:2209,nmps:33,nlps:30,switchFlag:0},{qe:1313,nmps:34,nlps:31,switchFlag:0},{qe:1089,nmps:35,nlps:32,switchFlag:0},{qe:673,nmps:36,nlps:33,switchFlag:0},{qe:545,nmps:37,nlps:34,switchFlag:0},{qe:321,nmps:38,nlps:35,switchFlag:0},{qe:273,nmps:39,nlps:36,switchFlag:0},{qe:133,nmps:40,nlps:37,switchFlag:0},{qe:73,nmps:41,nlps:38,switchFlag:0},{qe:37,nmps:42,nlps:39,switchFlag:0},{qe:21,nmps:43,nlps:40,switchFlag:0},{qe:9,nmps:44,nlps:41,switchFlag:0},{qe:5,nmps:45,nlps:42,switchFlag:0},{qe:1,nmps:45,nlps:43,switchFlag:0},{qe:22017,nmps:46,nlps:46,switchFlag:0}];function t(s,t,l){this.data=s,this.bp=t,this.dataEnd=l,this.chigh=s[t],this.clow=0,this.byteIn(),this.chigh=this.chigh<<7&65535|this.clow>>9&127,this.clow=this.clow<<7&65535,this.ct-=7,this.a=32768}return t.prototype={byteIn:function(){var s=this.data,t=this.bp;if(255===s[t]){var l=s[t+1];l>143?(this.clow+=65280,this.ct=8):(t++,this.clow+=s[t]<<9,this.ct=7,this.bp=t)}else t++,this.clow+=t<this.dataEnd?s[t]<<8:65280,this.ct=8,this.bp=t;this.clow>65535&&(this.chigh+=this.clow>>16,this.clow&=65535)},readBit:function(t,l){var n,i=t[l]>>1,h=1&t[l],p=s[i],c=p.qe,a=this.a-c;if(this.chigh<c)a<c?(a=c,n=h,i=p.nmps):(a=c,n=1^h,1===p.switchFlag&&(h=n),i=p.nlps);else{if(this.chigh-=c,0!==(32768&a))return this.a=a,h;a<c?(n=1^h,1===p.switchFlag&&(h=n),i=p.nlps):(n=h,i=p.nmps)}do{0===this.ct&&this.byteIn(),a<<=1,this.chigh=this.chigh<<1&65535|this.clow>>15&1,this.clow=this.clow<<1&65535,this.ct--}while(0===(32768&a));return this.a=a,t[l]=i<<1|h,n}},t}(); | ||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ | ||
/* Copyright 2012 Mozilla Foundation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
/* This class implements the QM Coder decoding as defined in | ||
* JPEG 2000 Part I Final Committee Draft Version 1.0 | ||
* Annex C.3 Arithmetic decoding procedure | ||
* available at http://www.jpeg.org/public/fcd15444-1.pdf | ||
* | ||
* The arithmetic decoder is used in conjunction with context models to decode | ||
* JPEG2000 and JBIG2 streams. | ||
*/ | ||
var ArithmeticDecoder = (function ArithmeticDecoderClosure() { | ||
// Table C-2 | ||
var QeTable = [ | ||
{qe: 0x5601, nmps: 1, nlps: 1, switchFlag: 1}, | ||
{qe: 0x3401, nmps: 2, nlps: 6, switchFlag: 0}, | ||
{qe: 0x1801, nmps: 3, nlps: 9, switchFlag: 0}, | ||
{qe: 0x0AC1, nmps: 4, nlps: 12, switchFlag: 0}, | ||
{qe: 0x0521, nmps: 5, nlps: 29, switchFlag: 0}, | ||
{qe: 0x0221, nmps: 38, nlps: 33, switchFlag: 0}, | ||
{qe: 0x5601, nmps: 7, nlps: 6, switchFlag: 1}, | ||
{qe: 0x5401, nmps: 8, nlps: 14, switchFlag: 0}, | ||
{qe: 0x4801, nmps: 9, nlps: 14, switchFlag: 0}, | ||
{qe: 0x3801, nmps: 10, nlps: 14, switchFlag: 0}, | ||
{qe: 0x3001, nmps: 11, nlps: 17, switchFlag: 0}, | ||
{qe: 0x2401, nmps: 12, nlps: 18, switchFlag: 0}, | ||
{qe: 0x1C01, nmps: 13, nlps: 20, switchFlag: 0}, | ||
{qe: 0x1601, nmps: 29, nlps: 21, switchFlag: 0}, | ||
{qe: 0x5601, nmps: 15, nlps: 14, switchFlag: 1}, | ||
{qe: 0x5401, nmps: 16, nlps: 14, switchFlag: 0}, | ||
{qe: 0x5101, nmps: 17, nlps: 15, switchFlag: 0}, | ||
{qe: 0x4801, nmps: 18, nlps: 16, switchFlag: 0}, | ||
{qe: 0x3801, nmps: 19, nlps: 17, switchFlag: 0}, | ||
{qe: 0x3401, nmps: 20, nlps: 18, switchFlag: 0}, | ||
{qe: 0x3001, nmps: 21, nlps: 19, switchFlag: 0}, | ||
{qe: 0x2801, nmps: 22, nlps: 19, switchFlag: 0}, | ||
{qe: 0x2401, nmps: 23, nlps: 20, switchFlag: 0}, | ||
{qe: 0x2201, nmps: 24, nlps: 21, switchFlag: 0}, | ||
{qe: 0x1C01, nmps: 25, nlps: 22, switchFlag: 0}, | ||
{qe: 0x1801, nmps: 26, nlps: 23, switchFlag: 0}, | ||
{qe: 0x1601, nmps: 27, nlps: 24, switchFlag: 0}, | ||
{qe: 0x1401, nmps: 28, nlps: 25, switchFlag: 0}, | ||
{qe: 0x1201, nmps: 29, nlps: 26, switchFlag: 0}, | ||
{qe: 0x1101, nmps: 30, nlps: 27, switchFlag: 0}, | ||
{qe: 0x0AC1, nmps: 31, nlps: 28, switchFlag: 0}, | ||
{qe: 0x09C1, nmps: 32, nlps: 29, switchFlag: 0}, | ||
{qe: 0x08A1, nmps: 33, nlps: 30, switchFlag: 0}, | ||
{qe: 0x0521, nmps: 34, nlps: 31, switchFlag: 0}, | ||
{qe: 0x0441, nmps: 35, nlps: 32, switchFlag: 0}, | ||
{qe: 0x02A1, nmps: 36, nlps: 33, switchFlag: 0}, | ||
{qe: 0x0221, nmps: 37, nlps: 34, switchFlag: 0}, | ||
{qe: 0x0141, nmps: 38, nlps: 35, switchFlag: 0}, | ||
{qe: 0x0111, nmps: 39, nlps: 36, switchFlag: 0}, | ||
{qe: 0x0085, nmps: 40, nlps: 37, switchFlag: 0}, | ||
{qe: 0x0049, nmps: 41, nlps: 38, switchFlag: 0}, | ||
{qe: 0x0025, nmps: 42, nlps: 39, switchFlag: 0}, | ||
{qe: 0x0015, nmps: 43, nlps: 40, switchFlag: 0}, | ||
{qe: 0x0009, nmps: 44, nlps: 41, switchFlag: 0}, | ||
{qe: 0x0005, nmps: 45, nlps: 42, switchFlag: 0}, | ||
{qe: 0x0001, nmps: 45, nlps: 43, switchFlag: 0}, | ||
{qe: 0x5601, nmps: 46, nlps: 46, switchFlag: 0} | ||
]; | ||
|
||
// C.3.5 Initialisation of the decoder (INITDEC) | ||
function ArithmeticDecoder(data, start, end) { | ||
this.data = data; | ||
this.bp = start; | ||
this.dataEnd = end; | ||
|
||
this.chigh = data[start]; | ||
this.clow = 0; | ||
|
||
this.byteIn(); | ||
|
||
this.chigh = ((this.chigh << 7) & 0xFFFF) | ((this.clow >> 9) & 0x7F); | ||
this.clow = (this.clow << 7) & 0xFFFF; | ||
this.ct -= 7; | ||
this.a = 0x8000; | ||
} | ||
|
||
ArithmeticDecoder.prototype = { | ||
// C.3.4 Compressed data input (BYTEIN) | ||
byteIn: function ArithmeticDecoder_byteIn() { | ||
var data = this.data; | ||
var bp = this.bp; | ||
if (data[bp] === 0xFF) { | ||
var b1 = data[bp + 1]; | ||
if (b1 > 0x8F) { | ||
this.clow += 0xFF00; | ||
this.ct = 8; | ||
} else { | ||
bp++; | ||
this.clow += (data[bp] << 9); | ||
this.ct = 7; | ||
this.bp = bp; | ||
} | ||
} else { | ||
bp++; | ||
this.clow += bp < this.dataEnd ? (data[bp] << 8) : 0xFF00; | ||
this.ct = 8; | ||
this.bp = bp; | ||
} | ||
if (this.clow > 0xFFFF) { | ||
this.chigh += (this.clow >> 16); | ||
this.clow &= 0xFFFF; | ||
} | ||
}, | ||
// C.3.2 Decoding a decision (DECODE) | ||
readBit: function ArithmeticDecoder_readBit(contexts, pos) { | ||
// contexts are packed into 1 byte: | ||
// highest 7 bits carry cx.index, lowest bit carries cx.mps | ||
var cx_index = contexts[pos] >> 1, cx_mps = contexts[pos] & 1; | ||
var qeTableIcx = QeTable[cx_index]; | ||
var qeIcx = qeTableIcx.qe; | ||
var d; | ||
var a = this.a - qeIcx; | ||
|
||
if (this.chigh < qeIcx) { | ||
// exchangeLps | ||
if (a < qeIcx) { | ||
a = qeIcx; | ||
d = cx_mps; | ||
cx_index = qeTableIcx.nmps; | ||
} else { | ||
a = qeIcx; | ||
d = 1 ^ cx_mps; | ||
if (qeTableIcx.switchFlag === 1) { | ||
cx_mps = d; | ||
} | ||
cx_index = qeTableIcx.nlps; | ||
} | ||
} else { | ||
this.chigh -= qeIcx; | ||
if ((a & 0x8000) !== 0) { | ||
this.a = a; | ||
return cx_mps; | ||
} | ||
// exchangeMps | ||
if (a < qeIcx) { | ||
d = 1 ^ cx_mps; | ||
if (qeTableIcx.switchFlag === 1) { | ||
cx_mps = d; | ||
} | ||
cx_index = qeTableIcx.nlps; | ||
} else { | ||
d = cx_mps; | ||
cx_index = qeTableIcx.nmps; | ||
} | ||
} | ||
// C.3.3 renormD; | ||
do { | ||
if (this.ct === 0) { | ||
this.byteIn(); | ||
} | ||
|
||
a <<= 1; | ||
this.chigh = ((this.chigh << 1) & 0xFFFF) | ((this.clow >> 15) & 1); | ||
this.clow = (this.clow << 1) & 0xFFFF; | ||
this.ct--; | ||
} while ((a & 0x8000) === 0); | ||
this.a = a; | ||
|
||
contexts[pos] = cx_index << 1 | cx_mps; | ||
return d; | ||
} | ||
}; | ||
|
||
return ArithmeticDecoder; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,18 @@ | ||
importScripts("jpx.js","util.js","arithmetic_decoder.js"),self.addEventListener("message",(function(e){var s=new JpxImage;s.parse(e.data.buffer);var t=s.tiles[0].items;self.postMessage([t])}),!1); | ||
/** | ||
* JPEG 2000 decoder worker. | ||
*/ | ||
// Do not warn if these variables were not defined before. | ||
/* global importScripts, JpxImage */ | ||
|
||
importScripts('jpx.js', 'util.js', 'arithmetic_decoder.js'); | ||
|
||
self.addEventListener('message', function (event) { | ||
|
||
// decode DICOM buffer | ||
var decoder = new JpxImage(); | ||
decoder.parse(event.data.buffer); | ||
// post decoded data | ||
var res = decoder.tiles[0].items; | ||
self.postMessage([res]); | ||
|
||
}, false); |
19 changes: 18 additions & 1 deletion
19
demo/stable/assets/dwv/decoders/pdfjs/decode-jpegbaseline.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,18 @@ | ||
importScripts("jpg.js"),self.addEventListener("message",(function(e){var a=new JpegImage;a.parse(e.data.buffer);var s=a.getData(a.width,a.height);self.postMessage([s])}),!1); | ||
/** | ||
* JPEG Baseline decoder worker. | ||
*/ | ||
// Do not warn if these variables were not defined before. | ||
/* global importScripts, JpegImage */ | ||
|
||
importScripts('jpg.js'); | ||
|
||
self.addEventListener('message', function (event) { | ||
|
||
// decode DICOM buffer | ||
var decoder = new JpegImage(); | ||
decoder.parse(event.data.buffer); | ||
// post decoded data | ||
var res = decoder.getData(decoder.width, decoder.height); | ||
self.postMessage([res]); | ||
|
||
}, false); |
Oops, something went wrong.