Skip to content

Instantly share code, notes, and snippets.

@jmhmd
Created January 19, 2022 16:24
Show Gist options
  • Save jmhmd/1cfb82839622a4738d89feae0a12fdc4 to your computer and use it in GitHub Desktop.
Save jmhmd/1cfb82839622a4738d89feae0a12fdc4 to your computer and use it in GitHub Desktop.
Pacsbin viewer embedding

Embed helper script

// initialize the embed client
var pbClient = new PacsbinClient();

// Prevent the parent page from scrolling when scrolling on embedded viewer
// This just watches for mouseover event on the iframe and sets the parent page style `overflow: hidden` to prevent scroll. Test to make sure this doesn't mess up something with your page layout.
pbClient.noPageScrollWheel({
  elementSelector: '.pacsbin-study', // default: 'iframe.pacsbin'
});

// Set active tool
pbClient.setTool('#study-1' /* id of the iframe */, tool);
// tool is a string:
// 'wwwc-tool', 'zoom-tool', 'pan-tool', 'scroll-tool', 'length-tool', 'arrow-tool', 'arrow-annotate', 'probe-tool', 'ellipse-tool', 'rectangle-tool'

// Change visibility of annotations
pbClient.toggleAnnotations('#study-1', true /* optionally set annotations on or off. If omitted, toggle state */);

Query string parameters

Querystring options:

  [layout] is optional, but if not included, [s] and [i] are required.
  May have [layout] only, or [layout, s, i], or [s, i, ww, wc] or all of the above
  Cannot have [ww, wc] only, or [i, ww, wc]

  header: Show case title header (true|false)
  an: Annotations (true|false)
  layout: Tile layout ([rows (integer)]x[columns (integer)]) ex: '2x2'. Tiles are indexed 0-n left-right, top-bottom.
  ww(:tile) : Window width (integer)
  wc(:tile) : Window center (integer)
  s(:tile) : Series (integer or objectid of series)
  i(:tile) : Image (integer or objectid of series)
  scale(:tile): floating point number representing relative image scale, ex: 1.756
  translation(:tile): comma separated floating point numbers
               representing x,y image pan in pixels, ex: 49.6,-35.9
  overlay: Image data overlay (true|false)

Example url: https://www.pacsbin.com/c/-18uBpPF6w?layout=2x1&s:0=1&i:0=10&s:1=61d2e569170a0e7cb04095f5&i:1=61d2e569170a0e7cb040961e&ww:0=400&wc:0=40&an=false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment