You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the example to display local files, i wrote a loadDicomFile that gets a file object. Problem is, that the viewport stays black. There is no error. The metadata is also undefined.
import{initascoreInit,Enums,RenderingEngine}from'@cornerstonejs/core';importcornerstoneDICOMImageLoader,{initasdicomImageLoaderInit}from'@cornerstonejs/dicom-image-loader';// Initialize the Cornerstone Core and DICOM Image Loader modulescoreInit();dicomImageLoaderInit();console.log('Cornerstone modules initialized');functionloadDicomFile(file,imagePreview){// Add the DICOM file to the file manager and get the image IDconstimageId=cornerstoneDICOMImageLoader.wadouri.fileManager.add(file);console.log('Image ID:',imageId);// Create a new element and append it to the image preview containerconstelement=document.createElement('div');element.style.width='512px';element.style.height='512px';// Append the element to the image preview containerimagePreview.appendChild(element);// Instantiate a rendering engineconstrenderingEngine=newRenderingEngine('CornerstoneRenderingEngine');constctVoiRange={windowWidth: 400,windowCenter: 40};// Create a stack viewportconstviewportId='CT_STACK';constviewportInput={
viewportId,type: Enums.ViewportType.STACK,
element,};renderingEngine.enableElement(viewportInput);// Get the stack viewport that was createdconstviewport=renderingEngine.getViewport(viewportId);// Set the stack on the viewportviewport.setStack([imageId]);// Set the VOI of the stackviewport.setProperties({voiRange: ctVoiRange});// Render the imageviewport.render();// Get the image data of the rendered imageconstmetadata=viewport.getImageData();console.log('Image metadata:',metadata);// Purge all loaded image data and empty the image cache before loading a new imagecornerstoneDICOMImageLoader.wadouri.fileManager.purge();}
Describe the Bug
Using the example to display local files, i wrote a loadDicomFile that gets a file object. Problem is, that the viewport stays black. There is no error. The metadata is also undefined.
Steps to Reproduce
"@cornerstonejs/core": "^2.14.9",
"@cornerstonejs/dicom-image-loader": "^2.14.9",
"@cornerstonejs/tools": "^2.14.9",
"@originjs/vite-plugin-commonjs": "^1.0.3"
files are bundled with vite
use python with flask, create a minimal project
upload dialog, then render the files
The current behavior
Rendering is not working.
The expected behavior
Render the Dicom file.
OS
Windows 11
Node version
v22.12.0
Browser
Chrome Version 131.0.6778.205
The text was updated successfully, but these errors were encountered: