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

Index

Constructors

Protected constructor

  • new HTMLViewport(htmlElementName: string, width: number, height: number, repaintable?: boolean): 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

    Returns HTMLViewport

    Returns the newly created instance HTMLViewport

Properties

botLeftCorner

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

botRightCorner

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

Protected cachedRenderParams

cachedRenderParams: any

Private canvas2

canvas2: any

Private context2

context2: any

Private currentMilliSecs1

currentMilliSecs1: number = new Date().getTime()

Private currentlyDrawing

currentlyDrawing: boolean = false

Private displayFPSinViewport

displayFPSinViewport: boolean = false

Protected displayPatientOrientationMarkersInViewport

displayPatientOrientationMarkersInViewport: boolean = false

Private doubleBuffer

doubleBuffer: boolean = false

Protected drawListenerList

drawListenerList: any[] = new Array()

Private fpsValue

fpsValue: number = 0

Protected height

height: number

Protected htmlElement

htmlElement: any

Protected htmlElementName

htmlElementName: string

Protected htmlViewportAdaptors

htmlViewportAdaptors: HTMLViewportAdaptors = null

Protected htmlViewportGroup

htmlViewportGroup: HTMLViewportGroup = null

Private image

image: HTMLImageElement = new Image()

Private lastImageProcessed

lastImageProcessed: number = new Date().getTime()

Protected modifiedOrientation

modifiedOrientation: string

Protected observer

observer: ObserverInterface = null

offsetX

offsetX: number = 0

offsetY

offsetY: number = 0

Protected onDrawCallback

onDrawCallback: any = null

Private printFPStoConsole

printFPStoConsole: boolean = false

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

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

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
  • 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

  • description

    Get the HTMLViewportGroup

    Returns HTMLViewportGroup

    Returns the HTMLViewportGroup instance

getHtmlElementName

  • getHtmlElementName(): string
  • description

    Get the html element name of the viewport

    Returns string

    Returns Html element name in success case

getHtmlViewportAdaptors

  • 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

Private gtHTMLViewportGroupMgr

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): 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
  • description

    needed for managing multi-finger gestueres

    Returns void

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 = true
    • Default value useMax: boolean = false

    Returns void

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

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

  • 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

  • description

    Set default adapter from the given render type

    Parameters

    Returns void

setHTMLViewportGroup

  • setHTMLViewportGroup(htmlViewportGroup: any): void
  • description

    Set the htmlViewportGroup instance

    Parameters

    • htmlViewportGroup: any

      Specifies the htmlViewportGroup instance

    Returns void

Private setHTMLViewportGroupMgr

  • setHTMLViewportGroupMgr(htmlViewportGroup: any): void
  • description

    PLEASE USE setHTMLViewportGroup()

    Parameters

    • htmlViewportGroup: any

    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

  • description

    Set the override MouseAdaptor into HtmlViewPortAdaptors

    Parameters

    Returns void

setOverrideTouchAdaptor

  • description

    Set the override ed TouchAdaptorInterface into HtmlViewPortAdaptors

    Parameters

    Returns void

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
  • Returns void