Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Compression/bloscZarrDecompress.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { getSize } from '../IO/dtypeUtils'
const cores = navigator.hardwareConcurrency ? navigator.hardwareConcurrency : 4
const numberOfWorkers = cores + Math.floor(Math.sqrt(cores))
const workerPool = new WorkerPool(numberOfWorkers, runPipeline)
workerPool.terminateWorkers()

/**
* Input:
Expand Down Expand Up @@ -53,7 +54,7 @@ async function bloscZarrDecompress(chunkData) {
taskArgsArray.push(['BloscZarr', args, desiredOutputs, inputs])
}
const results = await workerPool.runTasks(taskArgsArray).promise

workerPool.terminateWorkers()
const decompressedChunks = []
for (let index = 0; index < results.length; index++) {
// console.log(results[index].stdout)
Expand Down
3 changes: 2 additions & 1 deletion src/IO/Analyze/computeHistograms.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const updateHistogramWorkerPool = webWorkerPromiseWorkerPool(
UpdateHistogramWorker,
'updateHistogram'
)

updateHistogramWorkerPool.terminateWorkers()
export const computeHistogram = async (
values,
component,
Expand Down Expand Up @@ -83,5 +83,6 @@ export const computeHistogram = async (
for (let ii = 0; ii < numberOfBins; ii++) {
histogram[ii] /= maxHistogram
}
updateHistogramWorkerPool.terminateWorkers()
return histogram
}
4 changes: 2 additions & 2 deletions src/IO/Analyze/computeRanges.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const computeRangeWorkerPool = webWorkerPromiseWorkerPool(
ComputeRangesWorker,
'computeRanges'
)

computeRangeWorkerPool.terminateWorkers()
export async function computeRanges(values, numberOfComponents = 1) {
const numberOfSplits = numberOfWorkers

Expand Down Expand Up @@ -58,6 +58,6 @@ export async function computeRanges(values, numberOfComponents = 1) {
helpers[compIdx].add(max)
})
})

computeRangeWorkerPool.terminateWorkers()
return helpers.map(h => h.getRange())
}
2 changes: 2 additions & 0 deletions src/IO/InMemoryMultiscaleSpatialImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const numberOfWorkers = navigator.hardwareConcurrency
? navigator.hardwareConcurrency
: 6
const downsampleWorkerPool = new WorkerPool(numberOfWorkers, runPipeline)
downsampleWorkerPool.terminateWorkers()

class Coords {
constructor(image, dims) {
Expand Down Expand Up @@ -269,6 +270,7 @@ class InMemoryMultiscaleSpatialImage extends MultiscaleSpatialImage {
}
const results = await downsampleWorkerPool.runTasks(downsampleTaskArgs)
.promise
downsampleWorkerPool.terminateWorkers()
const validResults = results.filter(r => r.returnValue === 0)
const imageSplits = validResults.map(({ outputs }) => outputs[0].data)
currentImage = stackImages(imageSplits)
Expand Down
4 changes: 2 additions & 2 deletions src/IO/MultiscaleSpatialImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const imageDataFromChunksWorker = new ImageDataFromChunksWorker()
const imageDataFromChunksWorkerPromise = new WebworkerPromise(
imageDataFromChunksWorker
)

imageDataFromChunksWorkerPromise.terminate()
/* Every element corresponds to a pyramid scale
Lower scales, corresponds to a higher index, correspond to a lower
resolution.
Expand Down Expand Up @@ -341,7 +341,7 @@ class MultiscaleSpatialImage {
'imageDataFromChunks',
args
)

imageDataFromChunksWorkerPromise.terminate()
return {
imageType: this.imageType,
name: this.scaleInfo[scale].name,
Expand Down
Empty file added src/``
Empty file.