PMA.UI Documentation by Pathomation

SlideLoader

SlideLoader

Helper class that wraps around the PMA.UI.View.Viewport class. It's purpose is mainly to automatically handle slide reloading and authentication, via the provided PMA.UI.Components.Context instance.

Constructor

new SlideLoader(context, slideLoaderOptions)

Source:
Tutorials:
  • Tutorial: 03-gallery
  • Tutorial: 04-tree
  • Tutorial: 05-annotations
Parameters:
Name Type Attributes Default Description
context PMA.UI.Components.Context
slideLoaderOptions Object Initialization options passed to each PMA.UI.View.Viewport that is created during a PMA.UI.Components.SlideLoader#load call. This is the same struct as the one accepted by the PMA.UI.View.Viewport constructor, omitting server URLs, credentials and specific slide paths. The omitted information is either available via the PMA.UI.Components.Context instance, or supplied during the PMA.UI.Components.SlideLoader#load call.
Properties
Name Type Attributes Default Description
element string | HTMLElement The element that hosts the viewer. It can be either a valid CSS selector or an HTMLElement instance
image string The path or UID of the image to load
keyboardPanFactor Number <optional>
0.5 A factor to calculate pan delta when pressing a keyboard arrow. The actual pan in pixels is calculated as keyboardPanFactor * viewportWidth.
theme PMA.UI.View.Themes <optional>
"default" The theme to use
overview boolean | Object <optional>
true Whether or not to display an overview map
Properties
Name Type Attributes Description
collapsed boolean <optional>
Whether or not to start the overview in collapsed state
dimensions boolean | Object <optional>
true Whether or not to display the dimensions selector for images that have more than one channel, z-stack or timeframe
Properties
Name Type Attributes Description
collapsed boolean <optional>
Whether or not to start the dimensions selector in collapsed state
barcode boolean | Object <optional>
false Whether or not to display the image's barcode if it exists
Properties
Name Type Attributes Description
collapsed boolean <optional>
Whether or not to start the barcode in collapsed state
rotation Number <optional>
Rotation in steps of 90 degrees
loadingBar boolean | Object <optional>
true Whether or not to display a loading bar while the image is loading
position PMA.UI.View.Viewport~position <optional>
The initial position of the viewport within the image
snapshot boolean <optional>
false Whether or not to display a button that generates a snapshot image
annotations PMA.UI.View.Viewport~annotationOptions <optional>
Annotation options
digitalZoomLevels Number <optional>
0 The number of digital zoom levels to add
scaleLine boolean <optional>
true Whether or not to display a scale line when resolution information is available
colorAdjustments boolean <optional>
false Whether or not to add a control that allows color adjustments
filename string | PMA.UI.View.Viewport~filenameCallback <optional>
A string to display as the file name or a callback function. If no value is supplied, no file name is displayed.
attributions boolean | PMA.UI.View.Viewport~attributionOptions <optional>
Whether or not to display Pathomation attribution in the viewer
customButtons Array.<PMA.UI.View.Viewport~customButton> <optional>
An array of one or more custom buttons to add to the viewer
options.magnifier Object | boolean <optional>
false Whether or not to show the magnifier control
Properties
Name Type Attributes Description
collapsed Object | boolean <optional>
Whether or not to show the magnifier control in collapsed state
options.grid Object <optional>
Options for measurement grid
Properties
Name Type Attributes Description
size Array.<number> <optional>
Grid cell width and height in micrometers
Fires:
  • PMA.UI.Components.Events#event:SlideInfoError
  • PMA.UI.Components.Events#event:BeforeSlideLoad
  • PMA.UI.Components.Events#event:SlideLoaded
  • PMA.UI.Components.Events#event:BeforeDrop

Classes

SlideLoader

Members

mainViewport

Source:
The currently loaded PMA.UI.View.Viewport instance, or null

Methods

drawCollageAnnotations(serverUrl, slidePathTransform)

Source:
Draw annotations for each slide in collage mode
Parameters:
Name Type Description
serverUrl string The server used to load the images
slidePathTransform function A function to transform each filename to a slide name

getLoadedImageInfo() → {object|null}

Source:
Gets the image info of the currently loaded image
Returns:
Type
object | null

getOption(option, value) → {any}

Source:
Gets the value of a viewer option.
Parameters:
Name Type Description
option string
value any
Returns:
The value of the option or undefined
Type
any

listen(eventName, callback)

Source:
Attaches an event listener
Parameters:
Name Type Description
eventName PMA.UI.Components.Events The name of the event to listen to
callback function The function to call when the event occurs

load(serverUrl, path, doneCbopt, droppedopt)

Source:
Creates a PMA.UI.View.Viewport instance that loads the requested slide
Parameters:
Name Type Attributes Description
serverUrl string PMA.core server URL
path string Path or UID of the slide load
doneCb function <optional>
Called when the slide has finished loading
dropped boolean <optional>
Whether this slide was loaded by a drag and drop operation
Fires:
  • PMA.UI.Components.Events#event:BeforeSlideLoad
  • PMA.UI.Components.Events#event:SlideLoaded
  • PMA.UI.Components.Events#event:SlideInfoError

reloadAnnotations(readyCallbackopt)

Source:
Reloads annotations from the server
Parameters:
Name Type Attributes Description
readyCallback function <optional>
Called when the annotations have finished loading

setOption(option, value)

Source:
Sets or overrides the value of an option. Useful when it is required to modify a viewer option before loading as slide.
Parameters:
Name Type Description
option string
value any