Import and create new Viewer Communication component in your project:
const viewerCommunication = new ViewerCommunication(targetURL, integration);
Parameters:
targetURL
- MedDream Viewer URL.integration
(Optional) - Integration type: study
or token
. Default value: study
.const windowReference = viewerCommunication.getWindowReference();
viewerCommunication.focusWindow();
viewerCommunication.postActionMessage(actionType, actionData);
Parameters:
actionType
- Action message command type.actionData
- Data needed for action message.For more details about available action messages check: MedDream communication documentation
.
viewerCommunication.openInMedDreamWindow(studies/token);
Parameters:
studies
(For study
integration) - Study uid's list separated with ,
.token
(For token
integration) - Token with study information.viewerCommunication.addToMedDreamWindow(studies/token);
Parameters:
studies
(For study
integration) - Study uid's list separated with ,
.token
(For token
integration) - Token with study information.viewerCommunication.replaceInMedDreamWindow(studies/token);
Parameters:
studies
(For study
integration) - Study uid's list separated with ,
.token
(For token
integration) - Token with study information.viewerCommunication.openMedDreamToIframe(iframeId, studies/token);
Parameters:
iframeId
- Iframe element id.studies
(For study
integration) - Study uid's list separated with ,
.token
(For token
integration) - Token with study information.viewerCommunication.openStudy(study);
Parameter:
study
- Study uid.viewerCommunication.openStudies(studies);
Parameter:
studies
- Array of study uid's.viewerCommunication.replaceStudies(studies);
Parameter:
studies
- Array of study uid's.viewerCommunication.preloadStudies(studies);
Parameter:
studies
- Array of study uid's.viewerCommunication.cacheStudies(studies);
Parameter:
studies
- Array of study objects. Each study object has studyUid and storageId parameters.Array example:
const studies = [
{
studyUid: 'study-uid-1',
storageId: 'storage-id'
},
{
studyUid: 'study-uid-2',
storageId: 'storage-id'
}
];
viewerCommunication.closeStudies(studies);
Parameter:
studies
- Array of study objects. Each study object has studyUid and storageId parameters.Array example:
const studies = [
{
studyUid: 'study-uid-1',
storageId: 'storage-id'
}
];
viewerCommunication.openStudies(token);
Parameter:
token
- Generated token with studies information.viewerCommunication.replaceStudies(token);
Parameter:
token
- Generated token with studies information.viewerCommunication.preloadStudies(token);
Parameter:
token
- Generated token with studies information.viewerCommunication.cacheStudies(token);
Parameter:
token
- Generated token with studies information.viewerCommunication.closeStudies(token);
Parameter:
token
- Generated token with studies information.viewerCommunication.cacheAllStudies();
viewerCommunication.closeAllStudies();
viewerCommunication.setLayout(columns, rows);
Parameters:
columns
- Number of columns.rows
- Number of rows.viewerCommunication.openInstance(instanceUid, viewportColumn, viewportRow, viewportActions);
Parameters:
instanceUid
- Unique instance uid which has to be opened to viewport.viewportColumn
- Column number of desired viewport.viewportRow
- Row number of desired viewport.viewportActions
- Object of actions which have to be performed on viewport after instance is loaded.Available viewport actions:
windowing
- Windowing level. Available options: "DEFAULT", "AUTO", "CUSTOM".
If "CUSTOM" windowing is selected, customWindowing parameter has to be defined in viewportActions object.customWindowing
- Custom windowing level. This parameter allows to set custom windowing width and center levels.
customWindowing has to be defined only when "CUSTOM" windowing is selected.rotation
- Instance rotation by defined number of degrees.verticalFlip
- Vertical instance flip. Available options: true/false.horizontalFlip
- Horizontal instance flip. Available options: true/false.scale
- Instance scaling option. Available options: "ORIGINAL", _"FIT_TOSCREEN", "CUSTOM".
If "CUSTOM" scale is selected, customScale parameter has to be defined in viewportActions object.customScale
- Custom scale number.alignment
- Instance alignment in viewport. Available options: "RIGHT", "LEFT", "CENTER".Viewport actions object example:
const viewportActions = {
windowing: 'CUSTOM', //DEFAULT, AUTO, CUSTOM
customWindowing: {width: 2, center: 2}, //Use if custom windowing
rotation: 45,
verticalFlip: true,
horizontalFlip: true,
scale: 'CUSTOM', //ORIGINAL, FIT_TO_SCREEN, CUSTOM
customScale: 0.5, //Use if custom scale
alignment: 'CENTER' //RIGHT, LEFT, CENTER
};
viewerCommunication.exportInstance(viewportColumn, viewportRow);
Parameters:
viewportColumn
(Optional) - Column number of desired viewport.viewportRow
(Optional) - Row number of desired viewport.Currently active viewport instance is exported, if viewportColumn
and viewportRow
are not provided.
viewerCommunication.updateSegmentationToolPermissions(permissions);
Parameter:
permissions
- Object with segmentation permissions.Available segmentation permissions:
boundingBoxView
- Permission to see bounding box tab. Default value: false.boundingBox2dEdit
- Permission to edit 2d bounding box tab. Default value: false.boundingBox3dEdit
- Permission to edit 3d bounding box tab. Default value: false.boundingBoxInfo
- Permission to see bounding box information button and panel. Default value: false.freeDrawView
- Permission to see free draw tab. Default value: false.freeDrawEdit
- Permission to edit free draw tab. Default value: false.freeDrawInfo
- Permission to see free draw information button and panel. Default value: false.smartPaintView
- Permission to see smart paint tab. Default value: false.smartPaint2dEdit
- Permission to use 2d smart paint tool. Default value: false.smartPaint3dEdit
- Permission to use 3d smart paint tool. Default value: false.smartPaintInfo
- Permission to see smart paint information button and panel. Default value: false.Usage example:
const permissions = {
boundingBoxView: true,
boundingBox2dEdit: true,
boundingBox3dEdit: true,
boundingBoxInfo: false,
freeDrawView: true,
freeDrawEdit: true,
freeDrawInfo: false,
smartPaintView: true,
smartPaint2dEdit: true,
smartPaint3dEdit: true,
smartPaintInfo: false
};
viewerCommunication.updateSegmentationToolPermissions(permissions);
const callback = (studies) => console.log(studies);
viewerCommunication.subscribeGetOpenedStudiesEvent(callback);
viewerCommunication.getOpenedStudies();
Usage:
const callback = (snapshot) => console.log(snapshot);
viewerCommunication.subscribeGetSnapshotEvent(callback);
viewerCommunication.getSnapshot();
Usage:
viewerCommunication.setSnapshot(layoutSnapshot);
Parameter:
layoutSnapshot
- layout and viewports snapshot which was requested by getSnapshot function and returned to callback function.const callback = (annotations) => console.log(annotations);
viewerCommunication.subscribeCommunicationServiceReadyEvent(callback);
Parameter:
callback
- Callback function which is called when event is triggered.viewerCommunication.unsubscribeCommunicationServiceReadyEvent();
const callback = (studies) => console.log(studies);
viewerCommunication.subscribeGetOpenedStudiesEvent(callback);
Parameter:
callback
- Callback function which is called when event is triggered.viewerCommunication.unsubscribeGetOpenedStudiesEvent();
const callback = (snapshot) => console.log(snapshot);
viewerCommunication.subscribeGetSnapshotEvent(callback);
Parameter:
callback
- Callback function which is called when event is triggered with generated snapshot information.viewerCommunication.unsubscribeGetSnapshotEvent();
const callback = (annotations) => console.log(annotations);
viewerCommunication.subscribeAnnotationsSavedEvent(callback);
Parameter:
callback
- Callback function which is called when event is triggered.viewerCommunication.unsubscribeAnnotationsSavedEvent();
getSnapshot
function to generate viewer layout and viewports snapshot.setSnapshot
function to set previously generated snapshot back to the viewer.subscribeGetSnapshotEvent
function to subscribe of get snapshot event callback.unsubscribeGetSnapshotEvent
function to unsubscribe of get snapshot event callback.updateSegmentationToolPermissions
function to support new permissions: smartPaintView
, smartPaint2dEdit
, smartPaint3dEdit
, smartPaintInfo
.boundingBoxEdit
to boundingBox2dEdit
and boundingBox3dEdit
for 2d and 3d bounding box permissions control.updateSegmentationToolPermissions
function to update segmentation tool permissions.subscribeCommunicationServiceReadyEvent
function to subscribe communication service ready event.unsubscribeCommunicationServiceReadyEvent
function to unsubscribe communication service ready event.unsubscribeGetOpenedStudiesEvent
function to unsubscribe get opened studies event.subscribeAnnotationsSavedEvent
function to subscribe annotation saved event.unsubscribeAnnotationsSavedEvent
function to unsubscribe annotation saved event.onGetOpenedStudies
function to subscribeGetOpenedStudiesEvent
.openMedDreamToIframe
function to open studies in iframe.openInMedDream
function to openInMedDreamWindow
.addToMedDream
function to addToMedDreamWindow
.replaceInMedDream
function to replaceInMedDreamWindow
.