Class HTMLViewport

This is the view port base class, and it is a container to hold study information to render, and functionalities to render them.

Hierarchy

  • HTMLViewport

Index

Constructors

Properties

Methods

Constructors

Protected constructor

  • new HTMLViewport(htmlElementName: string, width: number, height: number, repaintable?: boolean, usePNG?: boolean, renderEngineLocation?: RenderLocation): HTMLViewport
  • description

    constructs the HTMLViewport object; the initialization is deferred till the init() call rather odd behavior if you attempt to create a Promise inside a constructor since it cannot return a value

    Parameters

    • htmlElementName: string

      name of HTML5 element

    • width: number

      Initial width of this viewport

    • height: number

      Initial height of this viewport

    • Default value repaintable: boolean = false

      Boolean flag specifies whether it is a repaintable or not

    • Default value usePNG: boolean = false

      Boolean flag specifies if renderEngine should generate PNG (lossless) output rather than JPEG

    • Default value renderEngineLocation: RenderLocation = Fovia.RenderLocation.Server

      specifies if the renderEngine to be associated with this viewport is Client, Hybrid, or Server

    Returns HTMLViewport

    Returns the newly created instance HTMLViewport

Properties

botLeftCorner

botLeftCorner: Vector = new Fovia.Util.Vector(0, 0, 0)

botRightCorner

botRightCorner: Vector = new Fovia.Util.Vector(0, 0, 0)

Protected displayPatientOrientationMarkersInViewport

displayPatientOrientationMarkersInViewport: boolean = false

Protected drawListenerList

drawListenerList: any[] = new Array()

Protected height

height: number

Protected htmlElement

htmlElement: any

Protected htmlElementName

htmlElementName: string

Protected htmlViewportAdaptors

htmlViewportAdaptors: HTMLViewportAdaptors = null

Protected htmlViewportGroup

htmlViewportGroup: HTMLViewportGroup = null

Protected modifiedOrientation

modifiedOrientation: string

Protected observer

observer: ObserverInterface = null

offsetX

offsetX: number = 0

offsetY

offsetY: number = 0

Protected onDrawCallback

onDrawCallback: any = null

Protected renderEngine

renderEngine: any

Protected renderEngineLocation

renderEngineLocation: RenderLocation = Fovia.RenderLocation.Server

Protected renderImageRescale

renderImageRescale: boolean = false

Protected renderedOnServer

renderedOnServer: boolean = false

Protected repaintData

repaintData: any

Protected repaintHeight

repaintHeight: any

Protected repaintImageBuffer

repaintImageBuffer: any = null

Protected repaintImageType

repaintImageType: any

Protected repaintUsePNG

repaintUsePNG: any

Protected repaintWidth

repaintWidth: any

Protected repaintableViewport

repaintableViewport: boolean = false

Protected seriesDataContext

seriesDataContext: SeriesDataContext

Protected showDICOMOverlay

showDICOMOverlay: boolean = false

Protected showLocalizerLines

showLocalizerLines: boolean = false

Protected showRuler

showRuler: boolean = false

topLeftCorner

topLeftCorner: Vector = new Fovia.Util.Vector(0, 0, 0)

topRightCorner

topRightCorner: Vector = new Fovia.Util.Vector(0, 0, 0)

Protected url

url: string

Protected width

width: number

Methods

addDrawListener

  • addDrawListener(drawListener: any): void
  • description

    Add the given event listener into event listener list

    Parameters

    • drawListener: any

      Specifies the event listener

    Returns void

Protected applyDrawImage

  • applyDrawImage(context: any, image: any, width: any, height: any, imageData?: any): void
  • Parameters

    • context: any
    • image: any
    • width: any
    • height: any
    • Default value imageData: any = null

    Returns void

changeHTMLCanvasID

  • changeHTMLCanvasID(newHTMLElement: any): void
  • description

    Change the viewport html element's canvasid from the given Html element

    Parameters

    • newHTMLElement: any

      Specifies the reference to HtmlElement

    Returns void

disableRightClickMenu

  • disableRightClickMenu(disableMenu?: boolean): void
  • description

    toggle the right-click popup menu

    Parameters

    • Default value disableMenu: boolean = true

      Specifies the boolean flag to toggle

    Returns void

displayAnnotations

  • displayAnnotations(showAnnotation: boolean): void
  • description

    base class signature that allows subclass to toggle its annotations on/off

    Parameters

    • showAnnotation: boolean

      true if annotations are to be displayed, false otherwise

    Returns void

displayDICOMOverlay

  • displayDICOMOverlay(showDICOMOverlay?: boolean): void
  • description

    Display or hide the overlay based on the given flag

    Parameters

    • Default value showDICOMOverlay: boolean = true

      Specifies the toggle boolean flag

    Returns void

displayFPS

  • displayFPS(showFPS: boolean): void
  • description

    Display the FPS text in the viewport

    Parameters

    • showFPS: boolean

      Set to true to display frames per seoond in the viewport, false to hide it

    Returns void

displayLocalizerLines

  • displayLocalizerLines(showLocalizerLines?: boolean): void
  • description

    Display or hide the localizer lines based on the given flag

    Parameters

    • Default value showLocalizerLines: boolean = true

      Specifies the toggle boolean flag

    Returns void

displayPatientOrientationMarkers

  • displayPatientOrientationMarkers(showMarkers?: boolean): void
  • description

    Display the image position markers (A/P/S/I/L/R) in the viewport

    Parameters

    • Default value showMarkers: boolean = true

      to true to display image markers in the viewport, false to hide it

    Returns void

displayRuler

  • displayRuler(showRuler?: boolean): void
  • description

    Display or hide the ruler based on the given flag

    Parameters

    • Default value showRuler: boolean = true

      Specifies the toggle boolean flag

    Returns void

Protected doubleBufferInit

  • doubleBufferInit(): void
  • description

    Initialize the canvas associated with this viewport

    Returns void

Protected doubleBufferPaint

  • doubleBufferPaint(bytes: any, width: any, height: any, imageType: any, usePNG: any, data: any): void
  • description

    Render the dicom image on the viewport form the given arguments

    Parameters

    • bytes: any

      Specifies the image data

    • width: any

      Specifies the image width

    • height: any

      Specifies the image height

    • imageType: any

      Specifies the image type

    • usePNG: any

      boolean flag that specifies whether the image to be render as png or not

    • data: any

      Specifies Dicom image data

    Returns void

Protected drawClientData

  • drawClientData(context: any, image: any, width: number, height: number, data: any): void
  • description

    draw given image data

    Parameters

    • context: any

      context fetched from canvas

    • image: any

      dicom image

    • width: number

      width of the viewport

    • height: number

      height of the viewpot

    • data: any

      dicom tag

    Returns void

Protected drawDICOMOverlay

  • drawDICOMOverlay(context: any, width: any, height: any, sdc: any, rp: any, imageTags: any): void
  • description

    render dicom overlay from the given arguments

    Parameters

    • context: any

      context retrieved from canvas

    • width: any

      width of the viewport

    • height: any

      height of the viewport

    • sdc: any

      Specifies the SeriesDataContext

    • rp: any

      renderparams

    • imageTags: any

      Specify the DICOMImageTags reference

    Returns void

Protected drawRuler

  • drawRuler(context: any, data: any): void
  • description

    draw the ruler on the canvas from the given data

    Parameters

    • context: any

      context fetched from canvas

    • data: any

      data to be rendered on ruler

    Returns void

getCachedRenderParams

  • getCachedRenderParams(): any
  • description

    Get the cached render parameter it holds

    Returns any

    Returns the Cached Render Params

Protected getFPS

  • getFPS(): number
  • description

    get FPS value for current frame but do not update lastimageprocessed

    Returns number

getHTMLElement

  • getHTMLElement(): any
  • description

    Gets the Html element

    Returns any

    HTML element associated with this viewport

getHTMLViewportGroup

  • getHTMLViewportGroup(): HTMLViewportGroup
  • description

    Get the HTMLViewportGroup

    Returns HTMLViewportGroup

    Returns the HTMLViewportGroup instance

getHeight

  • getHeight(): number
  • Returns number

getHtmlElementName

  • getHtmlElementName(): string
  • description

    Get the html element name of the viewport

    Returns string

    Returns Html element name in success case

getHtmlViewportAdaptors

  • getHtmlViewportAdaptors(): HTMLViewportAdaptors
  • description

    Get the HtmlViewportAdaptors associated with this ViewPort

    Returns HTMLViewportAdaptors

    Returns the HtmlViewportAdaptors

getRenderEngine

  • getRenderEngine(): any
  • description

    Get the render engine instance associated with this view port

    Returns any

    Returns the render engine instance in holds

getRenderImageRescale

  • getRenderImageRescale(): boolean
  • description

    Gets state of option to automaticly scale render image to fit viewport.

    Returns boolean

    Returns true if viewport scaling is on, false otherwise.

getRepaintImageBuffer

  • getRepaintImageBuffer(): any
  • Returns any

getSeriesDataContext

  • getSeriesDataContext(): SeriesDataContext
  • Returns series data context

    Returns SeriesDataContext

getWidth

  • getWidth(): number
  • Returns number

hasMatchingSeriesDataContext

  • hasMatchingSeriesDataContext(seriesInstaceUID: string): boolean
  • Returns true if the series data context is valid and matching with the given series instance uid

    Parameters

    • seriesInstaceUID: string

    Returns boolean

hasSeriesDataContext

  • hasSeriesDataContext(): boolean
  • Returns true if the series data context is valid

    Returns boolean

initOverrideMouseAdaptor

  • initOverrideMouseAdaptor(overrideMouseAdaptor: MouseAdaptorInterface, mouseButton?: MouseButton, modifier?: KeyboardModifier, character: any): void
  • description

    Set the override MouseAdaptor into HtmlViewPortAdaptors

    Parameters

    • overrideMouseAdaptor: MouseAdaptorInterface
    • Default value mouseButton: MouseButton = MouseButton.none

      Specifies the Mouse button to invoke this adapter

    • Default value modifier: KeyboardModifier = KeyboardModifier.none

      Specifies the Key modifier to invoke this Adapter

    • character: any

    Returns void

Protected invokeObserver

  • invokeObserver(data: any): void
  • Parameters

    • data: any

    Returns void

isRepaintable

  • isRepaintable(): boolean
  • description

    Get the Flag whether the viewport is repaint able or not

    Returns boolean

    Returns the repaint able flag

Protected paint

  • paint(bytes: any, width: any, height: any, imageType: any, usePNG: any, data: any): void
  • description

    paints the dicom image and overlay

    Parameters

    • bytes: any

      raw image

    • width: any

      width of the viewport

    • height: any

      height of the viewport

    • imageType: any

      image type

    • usePNG: any

      Specifies the boolean flag whether image rendered as png or not

    • data: any

      dicom image

    Returns void

Protected processImageFromServer

  • processImageFromServer(data: any): void
  • description

    processImageFromServer is called when image is ready to be rendered for a render engine. If data.image is null, there was an error, in which case we reset the mouse/touch state.
    At this point, there is no knowledge of the canvasID (either in our code, or external), so the mapping between the renderEngineID (data.name) is used to find the correct object, and then its render() method will be called. render the supplied bytes to the HTML element using paint(), and then update the internal state varaibles. If the mouse adaptor has a postRender step, such as during flythrough, invoke its postRender() method after the rendering is complete so the next frames can be requested.
    The renderImageData() method is extended in the subclass HTMLViewport3D to create a duplicate copy of the rendered image from the server, so it is possible to update the viewport without forcing a native renderImageData() if the render parameters have not changed.
    TODO: extend this to support postRender for the touch flythrough

    Parameters

    • data: any

      data to be processed

    Returns void

releaseSessionResources

  • releaseSessionResources(callbackFunc?: any): Promise<__type>
  • description

    Release the session related resources

    Parameters

    • Optional callbackFunc: any

      call back method returned on success and failure case

    Returns Promise<__type>

    This is an asynchronous method that returns a Promise as follows:

    Promise .then(void) .catch (err: ReturnCode )

removeAllDrawListener

  • removeAllDrawListener(): void
  • description

    Remove all the event listeners

    Returns void

removeDrawListener

  • removeDrawListener(drawListener: any): void
  • description

    Remove the given event listener from the event listener list

    Parameters

    • drawListener: any

      Specifies the event listener

    Returns void

removeMouseAdaptors

  • removeMouseAdaptors(): void
  • Returns void

render

  • render(): any
  • description

    Triggers an asynchronous intermedate render operation, and generate a JPEG image using the interactive quality setting.

    Returns any

    This is a synchronous method and returns ReturnCode.ok on success.

renderFinal

  • renderFinal(): any
  • description

    Triggers an asynchronous final render operation and generates either a JPEG image using the final quality setting, or a lossless compressed PNG file. This operation is much more costly than a render() and should not be done inside a mouseDrag loop, only done when the user finishes the operation, such as a mouseUp. The initial display should use a renderFinal to ensure the highest quality result is displayed.

    Returns any

    This is a synchronous method and returns ReturnCode.ok on success.

renderNoCachedImages

  • renderNoCachedImages(data: any): void
  • description

    "Image is not yet cached." label displayed in the viewer when the image is not cached or image is not available

    Parameters

    • data: any

    Returns void

repaint

  • repaint(): void
  • description

    Initiates a client-side repaint() of the viewport. This will not trigger a server operaiton, but instead will redraw the last server image onto the canvas, allowing the client to draw its objects onto the viewport (such as moving of annotations).

    Returns void

resetFPSTime

  • resetFPSTime(): void
  • description

    needed for managing multi-finger gestueres

    Returns void

Protected resizeCanvas

  • resizeCanvas(width: number, height: number, adjustZoom?: boolean, useMax?: boolean): void
  • Resizes this viewport element

    Parameters

    • width: number

      Updated width of this viewport

    • height: number

      Updated height of this viewport

    • Default value adjustZoom: boolean = true
    • Default value useMax: boolean = false

    Returns void

    This is a synchronous method and returns ReturnCode.ok on success.

resizeWindow

  • resizeWindow(width: number, height: number, adjustZoom?: boolean, useMax?: boolean): void
  • Resizes this component and triggers a render() / renderFinal() sequence

    Parameters

    • width: number

      Updated width of this viewport

    • height: number

      Updated height of this viewport

    • Default value adjustZoom: boolean = false

      set to true for fit to screen, or false to preserve existing zoom value.

    • Default value useMax: boolean = false

    Returns void

    This is a synchronous method and returns ReturnCode.ok on success.

setCustomMouseAdaptor

  • setCustomMouseAdaptor(mouseAdaptorInterface: any, mouseButton: MouseButton, modifier?: KeyboardModifier): void
  • description

    set custom Mouse Adapter into HtmlViewPortAdaptors

    Parameters

    • mouseAdaptorInterface: any

      Specifies the reference to MouseAdaptorInterface

    • mouseButton: MouseButton

      Specifies the Mouse button to invoke this adapter

    • Default value modifier: KeyboardModifier = KeyboardModifier.none

      Specifies the Key modifier to invoke this Adapter

    Returns void

setCustomTouchAdaptor

  • setCustomTouchAdaptor(touchAdaptorInterface: TouchAdaptorInterface, touchEvent: TouchEvents): void
  • description

    Set the custom adapter into HtmlViewPortAdaptors

    Parameters

    • touchAdaptorInterface: TouchAdaptorInterface

      Specifies the reference to TouchAdaptorInterface

    • touchEvent: TouchEvents

      Specifies the touch event to invoke this adapter

    Returns void

setDefaultAdaptors

  • setDefaultAdaptors(renderType: RenderType, forceInit?: boolean): void
  • description

    Set default adapter from the given render type

    Parameters

    • renderType: RenderType

      Specifies the render type

    • Default value forceInit: boolean = false

    Returns void

setHTMLViewportAdaptor

  • setHTMLViewportAdaptor(htmlViewportAdaptors?: any): void
  • Parameters

    • Default value htmlViewportAdaptors: any = Fovia.UI.HTMLViewportAdaptors

    Returns void

setHTMLViewportGroup

  • setHTMLViewportGroup(htmlViewportGroup: any): void
  • description

    Set the htmlViewportGroup instance

    Parameters

    • htmlViewportGroup: any

      Specifies the htmlViewportGroup instance

    Returns void

setMouseAdaptor

  • setMouseAdaptor(mouseAdaptorID: any, mouseButton: MouseButton, modifier?: KeyboardModifier, orientation?: ViewType): void
  • description

    Set Mouse Adapter into HtmlViewPortAdaptors

    Parameters

    • mouseAdaptorID: any

      Specifies the mouse adapter id

    • mouseButton: MouseButton

      Specifies the reference to mouse button to invoke this adapter

    • Default value modifier: KeyboardModifier = KeyboardModifier.none

      Specifies the Key modifier to invoke this adapter

    • Default value orientation: ViewType = Fovia.ViewType.oblique

      Specifies the view type

    Returns void

setOverrideKeyCharacter

  • setOverrideKeyCharacter(character: any): void
  • description

    Set the override Key Character into HtmlViewPortAdaptors

    Parameters

    • character: any

      Specifies the keyboard characters

    Returns void

setOverrideMouseAdaptor

  • setOverrideMouseAdaptor(overrideMouseAdaptor: MouseAdaptorInterface): void
  • description

    Set the override MouseAdaptor into HtmlViewPortAdaptors

    Parameters

    • overrideMouseAdaptor: MouseAdaptorInterface

      Specifies the MouseAdaptorInterface reference

    Returns void

setOverrideTouchAdaptor

  • setOverrideTouchAdaptor(overrideTouchAdaptor: TouchAdaptorInterface): void
  • description

    Set the override ed TouchAdaptorInterface into HtmlViewPortAdaptors

    Parameters

    • overrideTouchAdaptor: TouchAdaptorInterface

      Specifies the reference to TouchAdaptorInterface

    Returns void

setRenderImageRescale

  • setRenderImageRescale(doRescale: boolean): void
  • description

    Sets option to automaticly scale render image to fit viewport.

    Parameters

    • doRescale: boolean

      If true, do image rescaling. If false, render image at acutal size.

    Returns void

setRepaintImageBuffer

  • setRepaintImageBuffer(newRepaintImageBuffer: any): any
  • Parameters

    • newRepaintImageBuffer: any

    Returns any

setTouchAdaptor

  • setTouchAdaptor(touchAdaptorInterface: TouchAdaptors, touchEvent: TouchEvents, orientation?: ViewType): void
  • description

    Set touch Adaptor into HtmlViewPortAdaptors

    Parameters

    • touchAdaptorInterface: TouchAdaptors

      Specifies the reference to TouchAdaptorInterface

    • touchEvent: TouchEvents

      Specifies the touch event to invoke this adapter

    • Default value orientation: ViewType = Fovia.ViewType.oblique

      Specifies the view type

    Returns void

Protected updateFPS

  • updateFPS(): void
  • Returns void