Class HTMLViewport2D

Extends the abstract HTMLViewport class so it can display a 2D image

Hierarchy

Index

Constructors

constructor

  • new HTMLViewport2D(htmlElementName: string, width: number, height: number, repaintable?: boolean): HTMLViewport2D
  • description

    constructs the HTMLViewport2D object; the initialization is deferred till the init() call since this is executed synchronously and we never want the constructor to fail

    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

    Returns HTMLViewport2D

    Returns the newly created instance HTMLViewport2D

Properties

botLeftCorner

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

botRightCorner

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

Protected cachedRenderParams

cachedRenderParams: any

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 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: Point = new Fovia.Util.Point(0, 0)

topRightCorner

topRightCorner: Point = new Fovia.Util.Point(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

allowEventsOnViewport

  • allowEventsOnViewport(flag: boolean): void
  • Set flag to state whether mouse/key events are allowed to perform on the viewport

    Parameters

    • flag: boolean

      (true/false)

    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

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

doubleBufferResizeWindow

  • doubleBufferResizeWindow(width: number, height: number, adjustZoom?: boolean, useMax?: boolean): void
  • description

    update the internal offscreen buffer width / height

    Parameters

    • width: number

      Specifies the width of the window to be resized

    • height: number

      Specifies the height of the window to be resized

    • Default value adjustZoom: boolean = true

      Specifies the zoom level of the window to be resized

    • Default value useMax: boolean = false

      Specifies the boolean flag whether to use maximum values or not

      • @returns Returns value returned by resizeWindow method call

    Returns void

Protected drawClientData

  • drawClientData(context: any, image: any, width: number, height: number, data: any): 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

Private drawLocalizer

  • drawLocalizer(context: any, data: any, width: any, height: any): void
  • Parameters

    • context: any
    • data: any
    • width: any
    • height: any

    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

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

getHtmlElementName

  • getHtmlElementName(): string
  • description

    Get the html element name of the viewport

    Returns string

    Returns Html element name in success case

getHtmlViewportAdaptors

getPatientData

  • Get Fovia.DICOMDirEntry data from this series data context

    Returns DICOMDirEntry

getRenderEngine

getRenderEngineId

  • getRenderEngineId(): number
  • Get render engine associated with this series

    Returns number

    render engine id if valid render engine is available, otherwise 0

getStudyData

  • Get Fovia.DICOMStudy data from this series data context

    Returns DICOMStudy

init

  • init(seriesDataContext: SeriesDataContext, onDrawCallback?: any, imageMetaDataReceived?: any, callbackFunc?: any): any
  • description

    initialize the HTMLViewport2D

    Parameters

    • seriesDataContext: SeriesDataContext

      seriesDataContext instance associated with this viewport

    • Optional onDrawCallback: any

      call back method that will be called when viewport draw event occurs

    • Optional imageMetaDataReceived: any

      call back method that will be called when image received from viewport for processing

    • Optional callbackFunc: any

      call back function that will be called on success and failure case

    Returns any

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

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

Protected invokeObserver

  • invokeObserver(data: any): 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

reAlignViewport

  • reAlignViewport(current3DCursor: Vector): void
  • Parameters

    Returns void

releaseSessionResources

  • releaseSessionResources(callbackFunc?: any): any
  • description

    Release the session related resources

    Parameters

    • Optional callbackFunc: any

      call back method returned on success and failure case

    Returns any

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

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

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

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.

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

resizeWindow

  • resizeWindow(width: number, height: number, adjustZoom?: boolean, useMax?: boolean): void
  • Parameters

    • width: number
    • height: number
    • Default value adjustZoom: boolean = true
    • Default value useMax: boolean = false

    Returns void

setCustomMouseAdaptor

  • 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

setDefaultAdaptors

setHTMLViewportGroup

  • setHTMLViewportGroup(htmlViewportGroup: any): void
  • description

    Set the htmlViewportGroup instance

    Parameters

    • htmlViewportGroup: any

      Specifies the htmlViewportGroup instance

    Returns void

setMouseAdaptor

  • 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

setOverrideMouseAdaptor

setOverrideTouchAdaptor

setTouchAdaptor

  • 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