From 95c3b7c5d19da6d656be657249cae5b7e6791d92 Mon Sep 17 00:00:00 2001 From: Mike <814227+mikehazell@users.noreply.github.com> Date: Wed, 10 Nov 2021 00:59:27 +1100 Subject: [PATCH] fix: Don't use an unnecessary iterator (#1419) --- .../getSegmentsOnPixeldata.js | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/store/modules/segmentationModule/getSegmentsOnPixeldata.js b/src/store/modules/segmentationModule/getSegmentsOnPixeldata.js index d468d4578..f1ece5269 100644 --- a/src/store/modules/segmentationModule/getSegmentsOnPixeldata.js +++ b/src/store/modules/segmentationModule/getSegmentsOnPixeldata.js @@ -3,21 +3,5 @@ * @param {UInt16Array|Float32Array} pixelData The pixel data array. */ export default function getSegmentsOnPixelData(pixelData) { - const segmentSet = new Set(pixelData); - const iterator = segmentSet.values(); - - const segmentsOnLabelmap = []; - let done = false; - - while (!done) { - const next = iterator.next(); - - done = next.done; - - if (!done) { - segmentsOnLabelmap.push(next.value); - } - } - - return segmentsOnLabelmap; + return [...new Set(pixelData)]; }