Comments (2)
my code:
import {
init,
RenderingEngine,
Types,
Enums,
volumeLoader,
getRenderingEngine,
utilities,
CONSTANTS,
} from '@cornerstonejs/core';
cornerstone.init();
cornerstoneWADOImageLoader.external.cornerstone = cornerstone;
cornerstoneWADOImageLoader.external.dicomParser = dicomParser;
const { ViewportType } = Enums;
const renderingEngineId = 'myRenderingEngine';
const viewportId = 'CT_SAGITTAL_STACK';
// Define a unique id for the volume
const volumeName = 'CT_VOLUME_ID'; // Id of the volume less loader prefix
const volumeLoaderScheme = 'cornerstoneStreamingImageVolume'; // Loader id which defines which volume loader to use
const volumeId = ${volumeLoaderScheme}:${volumeName}
; // VolumeId with loader id + volume id
// Get Cornerstone imageIds and fetch metadata into RAM
const imageIds = [
'dicomweb:https://d3t6nz73ql33tx.cloudfront.net/1.3.6.1.4.1.14519.5.2.1.7009.2403.334240657131972136850343327463',
'dicomweb:https://d3t6nz73ql33tx.cloudfront.net/1.3.6.1.4.1.14519.5.2.1.7009.2403.226151125820845824875394858561'
];
// const wadoRsRoot = 'https://d3t6nz73ql33tx.cloudfront.net/dicomweb';
// const imageId = dicomweb:${StudyInstanceUID}:${SeriesInstanceUID}
;
const content = document.getElementById('content');
const viewportGrid = document.createElement('div');
viewportGrid.style.display = 'flex';
viewportGrid.style.flexDirection = 'row';
from cornerstone3d.
I can't replicate this. I copy pasted the final code in the template location and run yarn run example tutorial
and it run fine. Here is my final tutorial code which is located here (packages/tools/examples/tutorial/index.ts)
/**
* WARNING
* DO NOT REMOVE ANY OF THE BELOW IMPORT STATEMENTS
* SOME ARE USED FOR SOME OF THE TUTORIALS, AND WILL BREAK IF REMOVED
*/
import {
RenderingEngine,
Types,
Enums,
setVolumesForViewports,
volumeLoader,
} from '@cornerstonejs/core';
import {
addTool,
BrushTool,
SegmentationDisplayTool,
BidirectionalTool,
ToolGroupManager,
WindowLevelTool,
ZoomTool,
segmentation,
Enums as csToolsEnums,
} from '@cornerstonejs/tools';
import {
initDemo,
createImageIdsAndCacheMetaData,
setTitleAndDescription,
} from '../../../../utils/demo/helpers';
// This is for debugging purposes
console.warn(
'Click on index.ts to open source code for this example --------->'
);
// ============================= //
// ======== Set up page ======== //
setTitleAndDescription(
'Tutorial Playground',
'The playground for you to copy paste the codes in the tutorials and run it'
);
const { ViewportType } = Enums;
/**
* Runs the demo
*/
async function run() {
// Init Cornerstone and related libraries
await initDemo();
// Get Cornerstone imageIds and fetch metadata into RAM
const imageIds = await createImageIdsAndCacheMetaData({
StudyInstanceUID:
'1.3.6.1.4.1.14519.5.2.1.7009.2403.334240657131972136850343327463',
SeriesInstanceUID:
'1.3.6.1.4.1.14519.5.2.1.7009.2403.226151125820845824875394858561',
wadoRsRoot: 'https://d3t6nz73ql33tx.cloudfront.net/dicomweb',
});
const content = document.getElementById('content');
const viewportGrid = document.createElement('div');
viewportGrid.style.display = 'flex';
viewportGrid.style.flexDirection = 'row';
// element for axial view
const element1 = document.createElement('div');
element1.style.width = '500px';
element1.style.height = '500px';
// element for sagittal view
const element2 = document.createElement('div');
element2.style.width = '500px';
element2.style.height = '500px';
viewportGrid.appendChild(element1);
viewportGrid.appendChild(element2);
content.appendChild(viewportGrid);
const renderingEngineId = 'myRenderingEngine';
const renderingEngine = new RenderingEngine(renderingEngineId);
// note we need to add the cornerstoneStreamingImageVolume: to
// use the streaming volume loader
const volumeId = 'cornerstoneStreamingImageVolume: myVolume';
// Define a volume in memory
const volume = await volumeLoader.createAndCacheVolume(volumeId, {
imageIds,
});
const viewportId1 = 'CT_AXIAL';
const viewportId2 = 'CT_SAGITTAL';
const viewportInput = [
{
viewportId: viewportId1,
element: element1,
type: ViewportType.ORTHOGRAPHIC,
defaultOptions: {
orientation: Enums.OrientationAxis.AXIAL,
},
},
{
viewportId: viewportId2,
element: element2,
type: ViewportType.ORTHOGRAPHIC,
defaultOptions: {
orientation: Enums.OrientationAxis.SAGITTAL,
},
},
];
renderingEngine.setViewports(viewportInput);
// Set the volume to load
volume.load();
setVolumesForViewports(
renderingEngine,
[{ volumeId }],
[viewportId1, viewportId2]
);
// Render the image
renderingEngine.renderViewports([viewportId1, viewportId2]);
}
run();
from cornerstone3d.
Related Issues (20)
- [Bug] Basic video tool demo
- [Bug] WSI demo HOT 2
- [Bug] Video viewport spline interpolations
- [Bug] labelmap shadow in video viewport
- [Bug] Enhanced livewire
- [Bug] interpolate on contour holes as well
- [Bug] Should not add childrens to the annoationUIDMap and also remove the shift click to be explicit for holes in the api
- [Bug] Freehand tool moving back to the previous drawn pixel removes the whole thing
- [Bug] Images wrongly loaded when size in x and y are different HOT 2
- [Feature Request] How to obtain scalar data in the coronal or sagittal plane? HOT 1
- [Bug] Annotation Tools are always synchronised across viewports
- [Bug] can not render US file HOT 3
- How can I get updated frames/dicoms and POST them? HOT 1
- [Bug] Cannot access 'InterpolationManager' before initialization HOT 6
- [Bug] StackScrollMouseWheel has already been added globally HOT 3
- [Feature Request] Freehand Segmentation Tool with Scalar Data HOT 1
- Add new customised tools in @cornerstonejs/tools package HOT 2
- [Bug] Segmentation Tools cannot be used on mobile devices due to compatibility issues HOT 1
- [Feature Request] mouse wheel in zoomtool
- [Bug] loadImageFromImageLoader: no image loader for imageId HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cornerstone3d.