Add secure TrizRis access control for OHIF toolbar
Build and Deploy Docs / build-and-deploy-docs (push) Waiting to run
Build and Deploy Docs / build-and-deploy-docs (push) Waiting to run
This commit is contained in:
1 parent
f00379a672
commit
1546a4c81a
4 files changed
+168
-8
No files matched your search
@@ -66,12 +66,96 @@ export default function ModeRoute({
|
||||
userAuthenticationService,
|
||||
customizationService,
|
||||
} = servicesManager.services;
|
||||
|
||||
console.log('displaySetService =', displaySetService);
|
||||
const { extensions, sopClassHandlers, hangingProtocol } = mode;
|
||||
|
||||
const runTimeHangingProtocolId = lowerCaseSearchParams.get('hangingprotocolid');
|
||||
const runTimeStageId = lowerCaseSearchParams.get('stageid');
|
||||
const token = lowerCaseSearchParams.get('token');
|
||||
// ==================== TRIZRIS : SOP INITIAL ====================
|
||||
const initialSopInstanceUID = new URLSearchParams(window.location.search).get(
|
||||
'initialSopInstanceUID'
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!initialSopInstanceUID) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { viewportGridService, cornerstoneViewportService } = servicesManager.services;
|
||||
|
||||
const essayerNavigation = () => {
|
||||
const displaySet = displaySetService.getDisplaySetForSOPInstanceUID(
|
||||
initialSopInstanceUID,
|
||||
null
|
||||
);
|
||||
|
||||
console.log('DISPLAY SET DU SOP APRES CHARGEMENT =', displaySet);
|
||||
|
||||
if (!displaySet) {
|
||||
return;
|
||||
}
|
||||
|
||||
const imageIndex = displaySet.instances.findIndex(
|
||||
instance => instance.SOPInstanceUID === initialSopInstanceUID
|
||||
);
|
||||
|
||||
console.log('INDEX DU SOP =', imageIndex);
|
||||
|
||||
if (imageIndex < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { viewports } = viewportGridService.getState();
|
||||
|
||||
let targetViewport = null;
|
||||
|
||||
viewports.forEach((viewport, viewportId) => {
|
||||
console.log('VIEWPORT', viewportId, 'displaySets =', viewport.displaySetInstanceUIDs);
|
||||
|
||||
if (viewport.displaySetInstanceUIDs?.includes(displaySet.displaySetInstanceUID)) {
|
||||
targetViewport = {
|
||||
id: viewportId,
|
||||
...viewport,
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
console.log('TARGET VIEWPORT =', targetViewport);
|
||||
|
||||
if (!targetViewport) {
|
||||
console.log('### VIEWPORT PAS ENCORE PRET -> ATTENTE ###');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('### VIEWPORT TROUVE POUR KEY IMAGE ###', targetViewport.id);
|
||||
|
||||
commandsManager.run('jumpToImage', {
|
||||
imageIndex,
|
||||
viewport: targetViewport,
|
||||
});
|
||||
};
|
||||
|
||||
// 1. essai immédiat
|
||||
essayerNavigation();
|
||||
|
||||
// 2. attendre les display sets
|
||||
const { unsubscribe: unsubscribeDisplaySets } = displaySetService.subscribe(
|
||||
displaySetService.EVENTS.DISPLAY_SETS_ADDED,
|
||||
essayerNavigation
|
||||
);
|
||||
|
||||
// 3. attendre que le viewport ait réellement reçu ses données
|
||||
const { unsubscribe: unsubscribeViewport } = cornerstoneViewportService.subscribe(
|
||||
cornerstoneViewportService.EVENTS.VIEWPORT_DATA_CHANGED,
|
||||
essayerNavigation
|
||||
);
|
||||
|
||||
return () => {
|
||||
unsubscribeDisplaySets();
|
||||
unsubscribeViewport();
|
||||
};
|
||||
}, [initialSopInstanceUID, displaySetService, servicesManager]); // ===============================================================
|
||||
|
||||
if (token) {
|
||||
updateAuthServiceAndCleanUrl(token, location, userAuthenticationService);
|
||||
@@ -232,6 +316,28 @@ export default function ModeRoute({
|
||||
// Add SOPClassHandlers to a new SOPClassManager.
|
||||
displaySetService.init(extensionManager, sopClassHandlers);
|
||||
|
||||
const displaySets = displaySetService.getActiveDisplaySets
|
||||
? displaySetService.getActiveDisplaySets()
|
||||
: displaySetService.getDisplaySets();
|
||||
|
||||
console.log('DISPLAY SETS =', displaySets);
|
||||
|
||||
if (displaySets && displaySets.length > 0) {
|
||||
displaySets.forEach((displaySet, index) => {
|
||||
console.log('================ DISPLAY SET', index, '================');
|
||||
|
||||
console.log('SeriesInstanceUID =', displaySet.SeriesInstanceUID);
|
||||
|
||||
console.log('displaySetInstanceUID =', displaySet.displaySetInstanceUID);
|
||||
|
||||
console.log('CHAMPS =', Object.keys(displaySet));
|
||||
|
||||
console.log('images =', displaySet.images);
|
||||
|
||||
console.log('instances =', displaySet.instances);
|
||||
});
|
||||
}
|
||||
|
||||
extensionManager.onModeEnter({
|
||||
servicesManager,
|
||||
extensionManager,
|
||||
|
||||
Reference in new issue
Block a user