checkInstanceQueue()

in src/dicomImageSequencer.js [109:128]


  checkInstanceQueue(onImageReady) {
    while (this.instanceQueue.length > 0) {
      const nextImageId = this.instanceQueue[0];
      if (this.loadedImages.hasOwnProperty(nextImageId)) {
        // Remove this imageId from the queue
        this.instanceQueue.shift();

        // Get the image object and delete this sequencer's
        // reference to it to avoid memory leaks
        const image = this.loadedImages[nextImageId];
        delete this.loadedImages[nextImageId];

        // Call onImageReady with the prepared image
        onImageReady(image);
      } else {
        // If an instance in the queue is not ready, stop iterating
        return;
      }
    }
  }