Skip to main content

imageLoader

Index

Interfaces

ImageLoaderOptions

ImageLoaderOptions:

optionaladditionalDetails

additionalDetails?: Record<string, unknown>

priority

priority: number

requestType

requestType: string

Functions

cancelLoadAll

  • cancelLoadAll(): void
  • Removes all the ongoing image loads by calling the cancel method on each imageLoadObject. If no cancel method is available, it will be ignored.


    Returns void

cancelLoadImage

  • cancelLoadImage(imageId: string): void
  • Removes the imageId from the request pool manager and executes the cancel function if it exists.


    Parameters

    • imageId: string

      A Cornerstone Image Object’s imageId

    Returns void

cancelLoadImages

  • cancelLoadImages(imageIds: string[]): void
  • Removes the imageIds from the request pool manager and calls the cancel function if it exists.


    Parameters

    • imageIds: string[]

      Array of Cornerstone Image Object’s imageIds

    Returns void

createAndCacheDerivedImage

  • createAndCacheDerivedImage(referencedImageId: string, options?: DerivedImageOptions, preventCache?: boolean): Promise<IImage>
  • Loads an image given an imageId and optional priority and returns a promise which will resolve to the loaded image object or fail if an error occurred. The image is stored in the cache.


    Parameters

    • referencedImageId: string

      A Cornerstone Image Object’s imageId

    • options: DerivedImageOptions = {}

      Options to be passed to the Image Loader

    • preventCache: boolean = false

    Returns Promise<IImage>

    Image Loader Object

createAndCacheDerivedImages

  • createAndCacheDerivedImages(referencedImageIds: string[], options?: LocalImageOptions & { imageId?: string; targetBufferType?: PixelDataTypedArrayString } & { getDerivedImageId?: (referencedImageId: string) => string; targetBufferType?: PixelDataTypedArrayString }): DerivedImages
  • Load and cache a list of imageIds


    Parameters

    • referencedImageIds: string[]

      list of imageIds

    • options: LocalImageOptions & { imageId?: string; targetBufferType?: PixelDataTypedArrayString } & { getDerivedImageId?: (referencedImageId: string) => string; targetBufferType?: PixelDataTypedArrayString } = {}

    Returns DerivedImages

createAndCacheDerivedSegmentationImage

  • createAndCacheDerivedSegmentationImage(referencedImageId: string, options?: DerivedImageOptions): Promise<IImage>
  • Creates and caches a derived segmentation image based on the referenced image ID. this is a helper function, we don’t have segmentation concept in the cornerstone core; however, this helper would make it clear that the segmentation images SHOULD be Uint8Array type always until we have a better solution.


    Parameters

    • referencedImageId: string

      The ID of the referenced image.

    • options: DerivedImageOptions = ...

      The options for creating the derived image (default: { targetBufferType: ‘Uint8Array’ }).

    Returns Promise<IImage>

    A promise that resolves to the created derived segmentation image.

createAndCacheDerivedSegmentationImages

  • createAndCacheDerivedSegmentationImages(referencedImageIds: string[], options?: DerivedImageOptions): DerivedImages
  • Creates and caches derived segmentation images based on the referenced imageIds, this is a helper function, we don’t have segmentation concept in the cornerstone core; however, this helper would make it clear that the segmentation images SHOULD be Uint8Array type always until we have a better solution.


    Parameters

    • referencedImageIds: string[]

      An array of referenced image IDs.

    • options: DerivedImageOptions = ...

      The options for creating the derived images (default: { targetBufferType: ‘Uint8Array’ }).

    Returns DerivedImages

    The derived images.

createAndCacheLocalImage

  • createAndCacheLocalImage(options: LocalImageOptions, imageId: string, preventCache?: boolean): IImage
  • Parameters

    • options: LocalImageOptions
    • imageId: string
    • preventCache: boolean = false

    Returns IImage

loadAndCacheImage

  • Loads an image given an imageId and optional priority and returns a promise which will resolve to the loaded image object or fail if an error occurred. The image is stored in the cache.


    Parameters

    • imageId: string

      A Cornerstone Image Object’s imageId

    • options: ImageLoaderOptions = ...

      Options to be passed to the Image Loader

    Returns Promise<IImage>

    Image Loader Object

loadAndCacheImages

  • Load and cache a list of imageIds


    Parameters

    Returns Promise<IImage>[]

loadImage

  • Loads an image given an imageId and optional priority and returns a promise which will resolve to the loaded image object or fail if an error occurred. The loaded image is not stored in the cache.


    Parameters

    • imageId: string

      A Cornerstone Image Object’s imageId

    • options: ImageLoaderOptions = ...

      Options to be passed to the Image Loader

    Returns Promise<IImage>

    An Object which can be used to act after an image is loaded or loading fails

registerImageLoader

  • registerImageLoader(scheme: string, imageLoader: ImageLoaderFn): void
  • Registers an imageLoader plugin with cornerstone for the specified scheme


    Parameters

    • scheme: string

      The scheme to use for this image loader (e.g. ‘dicomweb’, ‘wadouri’, ‘http’)

    • imageLoader: ImageLoaderFn

      A Cornerstone Image Loader function

    Returns void

registerUnknownImageLoader

  • Registers a new unknownImageLoader and returns the previous one


    Parameters

    Returns ImageLoaderFn

    The previous Unknown Image Loader

unregisterAllImageLoaders

  • unregisterAllImageLoaders(): void
  • Removes all registered and unknown image loaders. This should be called when the application is unmounted to prevent memory leaks.


    Returns void