Skip to content

Commit

Permalink
feat(colormap): add colormap to VOI synchronizer (#1125)
Browse files Browse the repository at this point in the history
* add colormap to voi synchronizer

* type

* fix event
  • Loading branch information
IbrahimCSAE authored Feb 26, 2024
1 parent c8a0662 commit be0d166
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 5 additions & 4 deletions packages/tools/src/synchronizers/callbacks/voiSyncCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ import {
* @param synchronizerInstance - The Instance of the Synchronizer
* @param sourceViewport - The list of IDs defining the source viewport.
* @param targetViewport - The list of IDs defining the target viewport.
* @param voiModifiedEvent - The VOI_MODIFIED event.
* @param modifiedEvent - The COLORMAP_MODIFIED or VOI_MODIFIED event.
* @param options - Options for the synchronizer.
*/
export default function voiSyncCallback(
synchronizerInstance,
sourceViewport: Types.IViewportId,
targetViewport: Types.IViewportId,
voiModifiedEvent: Types.EventTypes.VoiModifiedEvent,
modifiedEvent: any,
options?: any
): void {
const eventDetail = voiModifiedEvent.detail;
const { volumeId, range, invertStateChanged, invert } = eventDetail;
const eventDetail = modifiedEvent.detail;
const { volumeId, range, invertStateChanged, invert, colormap } = eventDetail;

const renderingEngine = getRenderingEngine(targetViewport.renderingEngineId);
if (!renderingEngine) {
Expand All @@ -37,6 +37,7 @@ export default function voiSyncCallback(
| Types.VolumeViewportProperties
| Types.StackViewportProperties = {
voiRange: range,
colormap,
};

if (options?.syncInvertState && invertStateChanged) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ export default function createVOISynchronizer(
synchronizerName,
Enums.Events.VOI_MODIFIED,
voiSyncCallback,
options
{
auxiliaryEventNames: [Enums.Events.COLORMAP_MODIFIED],
...options,
}
);

return VOISynchronizer;
Expand Down

0 comments on commit be0d166

Please sign in to comment.