-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(DICOM Overlay): The overlay data wasn't being refreshed on change (…
- Loading branch information
1 parent
c4e22c2
commit 00e7519
Showing
6 changed files
with
69 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
extensions/cornerstone/src/tools/OverlayPlaneModuleProvider.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { metaData } from '@cornerstonejs/core'; | ||
|
||
const _cachedOverlayMetadata: Map<string, any[]> = new Map(); | ||
|
||
/** | ||
* Image Overlay Viewer tool is not a traditional tool that requires user interactin. | ||
* But it is used to display Pixel Overlays. And it will provide toggling capability. | ||
* | ||
* The documentation for Overlay Plane Module of DICOM can be found in [C.9.2 of | ||
* Part-3 of DICOM standard](https://dicom.nema.org/medical/dicom/2018b/output/chtml/part03/sect_C.9.2.html) | ||
* | ||
* Image Overlay rendered by this tool can be toggled on and off using | ||
* toolGroup.setToolEnabled() and toolGroup.setToolDisabled() | ||
*/ | ||
const OverlayPlaneModuleProvider = { | ||
/** Adds the metadata for overlayPlaneModule */ | ||
add: (imageId, metadata) => { | ||
if (_cachedOverlayMetadata.get(imageId) === metadata) { | ||
// This is a no-op here as the tool re-caches the data | ||
return; | ||
} | ||
_cachedOverlayMetadata.set(imageId, metadata); | ||
}, | ||
|
||
/** Standard getter for metadata */ | ||
get: (type: string, query: string | string[]) => { | ||
if (Array.isArray(query)) { | ||
return; | ||
} | ||
if (type !== 'overlayPlaneModule') { | ||
return; | ||
} | ||
return _cachedOverlayMetadata.get(query); | ||
}, | ||
}; | ||
|
||
// Needs to be higher priority than default provider | ||
metaData.addProvider(OverlayPlaneModuleProvider.get, 10_000); | ||
|
||
export default OverlayPlaneModuleProvider; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters