Issue while rendering volume from a set of local dicom files using Streaming Image Volume Loader

Below is the code Im using to render the volume from a set of dicom files. I have used dicomimageloader to generate the imageids and stored them in imageId1 and have parsed the metadata manually for rendering the volume.

I was able to generate the volume which got printed in the console(I have shared the screenshots) but getting the error “cornerstone.setVolumesForViewports” at that particular function. Its a very big error and could not understand why exactly its arising.

Earlier i got that sharedArrayBuffer is not supported in yout browser error then i have set the sharedarraybuffer to false with this line
cornerstone.setUseSharedArrayBuffer(false);



const element1 = document.getElementById("dicomImage1"); // Axial view
    const element2 = document.getElementById("dicomImage2"); // Sagittal view
    const element3 = document.getElementById("dicomImage3"); // Coronal view
     
    const volumeId = 'cornerstoneStreamingImageVolume:myVolumeId';
    const renderingEngine2 = new cornerstone.RenderingEngine(renderingEngineId);
    
    console.log(imageId1);
    const volume = await cornerstone.volumeLoader.createAndCacheVolume(volumeId, {
        imageIds: imageId1.map((id) =>id),
    });
    console.log(volume);
  
  const viewportId1 = "CT_AXIAL";
  const viewportId2 = "CT_SAGITTAL";
  const viewportId3 = "CT_CORONAL";
  const viewportInputArray = [
    {
      viewportId: viewportId1,
      type: cornerstone.Enums.ViewportType.ORTHOGRAPHIC,
      element: element1,
      defaultOptions: {
        orientation: cornerstone.Enums.OrientationAxis.AXIAL,
      },
    },
    {
      viewportId: viewportId2,
      type: cornerstone.Enums.ViewportType.ORTHOGRAPHIC,
      element: element2,
      defaultOptions: {
        orientation: cornerstone.Enums.OrientationAxis.SAGITTAL,
      },
    },
    {
      viewportId: viewportId3,
      type: cornerstone.Enums.ViewportType.ORTHOGRAPHIC,
      element: element3,
      defaultOptions: {
        orientation: cornerstone.Enums.OrientationAxis.CORONAL,
      },
    },
  ];
  renderingEngine2.setViewports(viewportInputArray);
  
    await volume.load();
  
    await cornerstone.setVolumesForViewports(
     renderingEngine2,
      [
        {
          volumeId,
        },
      ],
      [viewportId1, viewportId2, viewportId3]
    );
  
  renderingEngine2.renderViewports([viewportId1, viewportId2, viewportId3]);

Can anyone help me resolve this error?

Can you check the latest OHIF viewer, which now includes Cornerstone 3D 2.0?

Here are the migration guides:

Try OHIF locally: OHIF Viewer
Try Cornerstone3D 2.0 locally: https://www.cornerstonejs.org/live-examples/local.html