@cornerstonejs/core
Cornerstone is a set of JavaScript libraries that can be used to build web-based medical imaging applications. It provides a framework to build radiology applications such as the OHIF Viewer.
This library, @cornerstonejs/core, provides CPU and GPU-based rendering support, image/volume loading API, and caching utilities.
You can find the Cornerstone documentation on the website.
Index
Classes
Functions
- addImageSlicesToViewports
- addVolumesToViewports
- canRenderFloatTextures
- createVolumeActor
- createVolumeMapper
- getConfiguration
- getEnabledElement
- getEnabledElementByIds
- getEnabledElementByViewportId
- getEnabledElements
- getOrCreateCanvas
- getRenderingEngine
- getRenderingEngines
- getShouldUseSharedArrayBuffer
- getWebWorkerManager
- resetUseSharedArrayBuffer
- setConfiguration
- setPreferSizeOverAccuracy
- setUseSharedArrayBuffer
- setVolumesForViewports
- triggerEvent
Initialization
Namespaces
References
Variables
References
EVENTS
IImagesLoader
IRetrieveConfiguration
ImageLoadListener
RetrieveOptions
RetrieveStage
imageLoadPoolManager
registerImageLoader
Variables
constcache
consteventTarget
EventTarget - Provides the EventTarget interface
constimageRetrievalPoolManager
ImageRetrievalPoolManager
You don’t need to directly use the imageRetrievalPoolManager to load images
since the imageLoadPoolManager will automatically use it for retrieval. However,
maximum number of concurrent requests can be set by calling setMaxConcurrentRequests
.
Retrieval (usually) === XHR requests
constrequestPoolManager
You can use the imageLoadPoolManager to load images, by providing a requestFn
that returns a promise for the image. You can provide a type
to specify the type of
request (interaction, thumbnail, prefetch), and you can provide additional details
that will be passed to the requestFn. Below is an example of a requestFn that loads
an image from an imageId:
const priority = -5
const requestType = RequestType.Interaction
const additionalDetails = { imageId }
const options = {
targetBuffer: {
type: 'Float32Array',
offset: null,
length: null,
},
preScale: {
enabled: true,
},
}
imageLoadPoolManager.addRequest(
loadAndCacheImage(imageId, options).then(() => { // set on viewport}),
requestType,
additionalDetails,
priority
)
This module deals with Caching of images and volumes The cache has two main components: a volatile portion for images and a non-volatile portion for volumes. Individual 2D images are volatile and will be replaced by new images hitting the cache. When you allocate volumes, these are non-volatile and reserve a block of memory from the cache. Volumes must be released manually. We will have a shared block of memory allocated for the entire cache, e.g. 1GB which will be shared for images and volumes.
When a new image is added: We check if there is enough unallocated + volatile space for the single image
if so
If not (cache is mostly/completely full with volumes)
When a new volume is added: Check if there is enough unallocated + volatile space to allocate the volume:
If so:
If not (cache is mostly/completely full with volumes),