Methods
addTask(taskType, data, priority, transferList) → {*}
Function to add a decode task to be performed
Parameters:
Name | Type | Default | Description |
---|---|---|---|
taskType |
the taskType for this task | ||
data |
data specific to the task | ||
priority |
0 | optional priority of the task (defaults to 0), > 0 is higher, < 0 is lower | |
transferList |
optional array of data to transfer to web worker |
- Source:
Returns:
- Type
- *
cancelTask(taskId, reason)
Cancels a queued task and rejects
Parameters:
Name | Type | Description |
---|---|---|
taskId |
the taskId to cancel | |
reason |
optional reason the task was rejected |
- Source:
Returns:
boolean - true on success, false if taskId not found
(async) decode(byteArray) → {Promise.<object>}
Decode image.
Parameters:
Name | Type | Description |
---|---|---|
byteArray |
Uint8Array | Image array |
Returns:
decoded array and frame information
- Type
- Promise.<object>
getStatistics()
Function to return the statistics on running web workers
- Source:
Returns:
object containing statistics
handleMessageFromWorker(msg)
Function to handle a message from a web worker
Parameters:
Name | Type | Description |
---|---|---|
msg |
- Source:
initialize(configObject)
Initialization function for the web worker manager - spawns web workers
Parameters:
Name | Type | Description |
---|---|---|
configObject |
- Source:
loadWebWorkerTask(sourcePath, taskConfig)
dynamically loads a web worker task
Parameters:
Name | Type | Description |
---|---|---|
sourcePath |
||
taskConfig |
- Source:
setTaskPriority(taskId, priority)
Changes the priority of a queued task
Parameters:
Name | Type | Default | Description |
---|---|---|---|
taskId |
the taskId to change the priority of | ||
priority |
0 | priority of the task (defaults to 0), > 0 is higher, < 0 is lower |
- Source:
Returns:
boolean - true on success, false if taskId not found
spawnWebWorker()
Spawns a new web worker
- Source:
startTaskOnWebWorker()
Function to start a task on a web worker
- Source:
terminateAllWebWorkers()
Terminate all running web workers.
- Source:
(async) transform(sopInstanceUID, decodedFrame) → {Promise.<Buffer>}
Transform image.
The transform is applied only is iccProfiles are available.
Otherwise the function return the original decoded frame.
Parameters:
Name | Type | Description |
---|---|---|
sopInstanceUID |
string | SOP Instance UID of current image that should be transformed |
decodedFrame |
Buffer | decoded Frame |
Returns:
transformed buffer
- Type
- Promise.<Buffer>