fix(typescript): rename services to fix typescript (#3165)
* fix: Rename services to lower camel case, hp, measure * fix: Rename DisplaySetService instances to displaySetService * fix: Rename CornerstoneViewportService to lower camel case * fix: Added lower case segmentationService rename * rename other services (#3166) * rename uiDialogService * rename toolGroupService * rename uiNotificationService * rename viewportGridService * rename syncGroupService * rename CornerstoneCacheService * Fix a syntax error in hotkeys * Fix a couple of rename issues that were missed --------- Co-authored-by: Alireza <ar.sedghi@gmail.com>
This commit is contained in:
1 parent
a97fb2fc9a
commit
8af0362d12
97 files changed
+934
-908
No files matched your search
@@ -37,7 +37,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "7.16.3",
|
||||
"dcmjs": "^0.28.3",
|
||||
"dcmjs": "0.29.4",
|
||||
"dicomweb-client": "^0.6.0",
|
||||
"isomorphic-base64": "^1.0.2",
|
||||
"lodash.merge": "^4.6.1",
|
||||
|
||||
@@ -76,8 +76,8 @@ export class HotkeysManager {
|
||||
}
|
||||
definitions.forEach(definition => this.registerHotkeys(definition));
|
||||
} catch (error) {
|
||||
const { UINotificationService } = this._servicesManager.services;
|
||||
UINotificationService.show({
|
||||
const { uiNotificationService, } = this._servicesManager.services;
|
||||
uiNotificationService.show({
|
||||
title: 'Hotkeys Manager',
|
||||
message: 'Error while setting hotkeys',
|
||||
type: 'error',
|
||||
|
||||
@@ -347,11 +347,11 @@ export default class ExtensionManager {
|
||||
};
|
||||
|
||||
_initHangingProtocolsModule = (extensionModule, extensionId) => {
|
||||
const { HangingProtocolService } = this._servicesManager.services;
|
||||
const { hangingProtocolService } = this._servicesManager.services;
|
||||
extensionModule.forEach(({ id, protocol }) => {
|
||||
if (protocol) {
|
||||
// Only auto-register if protocol specified, otherwise let mode register
|
||||
HangingProtocolService.addProtocol(id, protocol);
|
||||
hangingProtocolService.addProtocol(id, protocol);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import HangingProtocolServiceClass from './HangingProtocolService';
|
||||
import HangingProtocolService from './HangingProtocolService';
|
||||
|
||||
const testProtocol = {
|
||||
id: 'test',
|
||||
@@ -149,7 +149,10 @@ describe('HangingProtocolService', () => {
|
||||
},
|
||||
},
|
||||
};
|
||||
const hps = new HangingProtocolServiceClass(commandsManager, servicesManager);
|
||||
const hangingProtocolService = new HangingProtocolService(
|
||||
commandsManager,
|
||||
servicesManager
|
||||
);
|
||||
let initialScaling;
|
||||
|
||||
afterEach(() => {
|
||||
@@ -158,36 +161,42 @@ describe('HangingProtocolService', () => {
|
||||
|
||||
describe('with a static protocol', () => {
|
||||
beforeAll(() => {
|
||||
hps.addProtocol(testProtocol.id, testProtocol);
|
||||
hangingProtocolService.addProtocol(testProtocol.id, testProtocol);
|
||||
});
|
||||
|
||||
it('has one protocol', () => {
|
||||
expect(hps.getProtocols().length).toBe(1);
|
||||
expect(hangingProtocolService.getProtocols().length).toBe(1);
|
||||
});
|
||||
|
||||
describe('run', () => {
|
||||
it('matches best image match', () => {
|
||||
checkHpsBestMatch(hps);
|
||||
checkHpsBestMatch(hangingProtocolService);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('with protocol generator', () => {
|
||||
beforeAll(() => {
|
||||
hps.addProtocol(testProtocol.id, testProtocolGenerator);
|
||||
hangingProtocolService.addProtocol(
|
||||
testProtocol.id,
|
||||
testProtocolGenerator
|
||||
);
|
||||
});
|
||||
|
||||
it('has one protocol', () => {
|
||||
expect(hps.getProtocols().length).toBe(1);
|
||||
expect(hangingProtocolService.getProtocols().length).toBe(1);
|
||||
});
|
||||
|
||||
describe('run', () => {
|
||||
it('matches best image match', () => {
|
||||
checkHpsBestMatch(hps);
|
||||
checkHpsBestMatch(hangingProtocolService);
|
||||
});
|
||||
|
||||
it('uses services manager', () => {
|
||||
hps.run({ studies: [studyMatch], displaySets: studyMatchDisplaySets });
|
||||
hangingProtocolService.run({
|
||||
studies: [studyMatch],
|
||||
displaySets: studyMatchDisplaySets,
|
||||
});
|
||||
expect(mockedFunction).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -866,13 +866,13 @@ class HangingProtocolService {
|
||||
protocol: Protocol,
|
||||
options: HangingProtocol.SetProtocolOptions
|
||||
) {
|
||||
const { DisplaySetService } = this._servicesManager.services;
|
||||
const { displaySetService } = this._servicesManager.services;
|
||||
|
||||
if (options.displaySetInstanceUIDs) {
|
||||
this._updateGlobalMatchByOptions(
|
||||
options as HangingProtocol.GlobalProtocolOptions,
|
||||
protocol,
|
||||
DisplaySetService
|
||||
displaySetService
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -893,7 +893,7 @@ class HangingProtocolService {
|
||||
options: HangingProtocol.ViewportSpecificProtocolOptions,
|
||||
protocol: HangingProtocol.Protocol
|
||||
) {
|
||||
const { DisplaySetService } = this._servicesManager.services;
|
||||
const { displaySetService } = this._servicesManager.services;
|
||||
const { displaySetSelectors = {} } = protocol;
|
||||
const protocolViewports = protocol.stages[this.stage].viewports;
|
||||
|
||||
@@ -914,7 +914,7 @@ class HangingProtocolService {
|
||||
|
||||
displaySetAndViewportOptions.displaySetInstanceUIDs.forEach(
|
||||
(displaySetInstanceUID, index) => {
|
||||
const displaySet = DisplaySetService.getDisplaySetByUID(
|
||||
const displaySet = displaySetService.getDisplaySetByUID(
|
||||
displaySetInstanceUID
|
||||
);
|
||||
|
||||
@@ -968,7 +968,7 @@ class HangingProtocolService {
|
||||
|
||||
displaySetAndViewportOptions?.displaySetInstanceUIDs?.forEach(
|
||||
(displaySetInstanceUID, index) => {
|
||||
const displaySet = DisplaySetService.getDisplaySetByUID(
|
||||
const displaySet = displaySetService.getDisplaySetByUID(
|
||||
displaySetInstanceUID
|
||||
);
|
||||
|
||||
@@ -999,7 +999,7 @@ class HangingProtocolService {
|
||||
protocolViewport: HangingProtocol.Viewport,
|
||||
displaySetSelectors: Record<string, HangingProtocol.DisplaySetSelector>
|
||||
) {
|
||||
const { DisplaySetService } = this._servicesManager.services;
|
||||
const { displaySetService } = this._servicesManager.services;
|
||||
const protocolViewportDisplaySets = protocolViewport.displaySets;
|
||||
const numDisplaySetsToSet =
|
||||
displaySetAndViewportOptions.displaySetInstanceUIDs.length;
|
||||
@@ -1015,7 +1015,7 @@ class HangingProtocolService {
|
||||
|
||||
displaySetAndViewportOptions.displaySetInstanceUIDs.forEach(
|
||||
displaySetInstanceUID => {
|
||||
const displaySet = DisplaySetService.getDisplaySetByUID(
|
||||
const displaySet = displaySetService.getDisplaySetByUID(
|
||||
displaySetInstanceUID
|
||||
);
|
||||
|
||||
@@ -1036,7 +1036,7 @@ class HangingProtocolService {
|
||||
private _updateGlobalMatchByOptions(
|
||||
options: HangingProtocol.GlobalProtocolOptions,
|
||||
protocol: Protocol,
|
||||
DisplaySetService: any
|
||||
displaySetService: any
|
||||
) {
|
||||
const { displaySetSelectors = {} } = protocol;
|
||||
const protocolViewports = protocol.stages[this.stage].viewports;
|
||||
@@ -1045,7 +1045,7 @@ class HangingProtocolService {
|
||||
// we need to check each displaySetInstanceUIDs to see if it satisfies the
|
||||
// seriesMatching criteria
|
||||
options.displaySetInstanceUIDs.forEach(displaySetInstanceUID => {
|
||||
const displaySet = DisplaySetService.getDisplaySetByUID(
|
||||
const displaySet = displaySetService.getDisplaySetByUID(
|
||||
displaySetInstanceUID
|
||||
);
|
||||
|
||||
@@ -1076,7 +1076,7 @@ class HangingProtocolService {
|
||||
Array.from(newDisplaySetIds).forEach((displaySetId, index) => {
|
||||
const displaySetInstanceUID = options.displaySetInstanceUIDs[index];
|
||||
|
||||
const displaySet = DisplaySetService.getDisplaySetByUID(
|
||||
const displaySet = displaySetService.getDisplaySetByUID(
|
||||
displaySetInstanceUID
|
||||
);
|
||||
|
||||
@@ -1115,7 +1115,7 @@ class HangingProtocolService {
|
||||
});
|
||||
|
||||
remainingDisplaySetMatches.forEach(({ displaySetInstanceUID }) => {
|
||||
const displaySet = DisplaySetService.getDisplaySetByUID(
|
||||
const displaySet = displaySetService.getDisplaySetByUID(
|
||||
displaySetInstanceUID
|
||||
);
|
||||
|
||||
@@ -1157,13 +1157,13 @@ class HangingProtocolService {
|
||||
}
|
||||
|
||||
_validateOptions(options: HangingProtocol.SetProtocolOptions) {
|
||||
const { DisplaySetService } = this._servicesManager.services;
|
||||
const { displaySetService } = this._servicesManager.services;
|
||||
|
||||
if (options.displaySetInstanceUIDs) {
|
||||
options = options as HangingProtocol.GlobalProtocolOptions;
|
||||
|
||||
options.displaySetInstanceUIDs.forEach(displaySetInstanceUID => {
|
||||
const displaySet = DisplaySetService.getDisplaySetByUID(
|
||||
const displaySet = displaySetService.getDisplaySetByUID(
|
||||
displaySetInstanceUID
|
||||
);
|
||||
|
||||
|
||||
@@ -62,12 +62,12 @@ The following services is available in the `OHIF-v3`.
|
||||
<tr>
|
||||
<td>
|
||||
<a href="./data/SegmentationService">
|
||||
SegmentationService (NEW)
|
||||
segmentationService (NEW)
|
||||
</a>
|
||||
</td>
|
||||
<td>Segmentation Service</td>
|
||||
<td>
|
||||
SegmentationService
|
||||
segmentationService
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
"cornerstone-math": "^0.1.9",
|
||||
"cornerstone-wado-image-loader": "^4.2.1",
|
||||
"dayjs": "^1.11.6",
|
||||
"dcmjs": "^0.28.3",
|
||||
"dcmjs": "0.29.4",
|
||||
"detect-gpu": "^4.0.16",
|
||||
"dicom-parser": "^1.8.9",
|
||||
"dotenv-webpack": "^1.7.0",
|
||||
|
||||
@@ -30,10 +30,10 @@ function ViewerViewportGrid(props) {
|
||||
|
||||
// TODO -> Need some way of selecting which displaySets hit the viewports.
|
||||
const {
|
||||
DisplaySetService,
|
||||
MeasurementService,
|
||||
HangingProtocolService,
|
||||
UINotificationService,
|
||||
displaySetService,
|
||||
measurementService,
|
||||
hangingProtocolService,
|
||||
uiNotificationService,
|
||||
} = servicesManager.services;
|
||||
|
||||
/**
|
||||
@@ -48,7 +48,7 @@ function ViewerViewportGrid(props) {
|
||||
const {
|
||||
viewportMatchDetails,
|
||||
hpAlreadyApplied,
|
||||
} = HangingProtocolService.getMatchDetails();
|
||||
} = hangingProtocolService.getMatchDetails();
|
||||
|
||||
if (!viewportMatchDetails.size) {
|
||||
return;
|
||||
@@ -104,7 +104,7 @@ function ViewerViewportGrid(props) {
|
||||
|
||||
const suppressEvent = true;
|
||||
const applied = true;
|
||||
HangingProtocolService.setHangingProtocolAppliedForViewport(
|
||||
hangingProtocolService.setHangingProtocolAppliedForViewport(
|
||||
viewportIndex,
|
||||
applied,
|
||||
suppressEvent
|
||||
@@ -119,13 +119,13 @@ function ViewerViewportGrid(props) {
|
||||
(viewportIndex, displaySetInstanceUID) => {
|
||||
let updatedViewports = [];
|
||||
try {
|
||||
updatedViewports = HangingProtocolService.getViewportsRequireUpdate(
|
||||
updatedViewports = hangingProtocolService.getViewportsRequireUpdate(
|
||||
viewportIndex,
|
||||
displaySetInstanceUID
|
||||
);
|
||||
} catch (error) {
|
||||
console.warn(error);
|
||||
UINotificationService.show({
|
||||
uiNotificationService.show({
|
||||
title: 'Drag and Drop',
|
||||
message:
|
||||
'The selected display sets could not be added to the viewport due to a mismatch in the Hanging Protocol rules.',
|
||||
@@ -136,18 +136,18 @@ function ViewerViewportGrid(props) {
|
||||
|
||||
return updatedViewports;
|
||||
},
|
||||
[HangingProtocolService, UINotificationService]
|
||||
[hangingProtocolService, uiNotificationService]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const displaySets = DisplaySetService.getActiveDisplaySets();
|
||||
const displaySets = displaySetService.getActiveDisplaySets();
|
||||
updateDisplaySetsForViewports(displaySets);
|
||||
}, [numRows, numCols]);
|
||||
|
||||
// Layout change based on hanging protocols
|
||||
useEffect(() => {
|
||||
const { unsubscribe } = HangingProtocolService.subscribe(
|
||||
HangingProtocolService.EVENTS.NEW_LAYOUT,
|
||||
const { unsubscribe } = hangingProtocolService.subscribe(
|
||||
hangingProtocolService.EVENTS.NEW_LAYOUT,
|
||||
({ layoutType, numRows, numCols, layoutOptions }) => {
|
||||
viewportGridService.setLayout({
|
||||
numRows,
|
||||
@@ -165,10 +165,10 @@ function ViewerViewportGrid(props) {
|
||||
|
||||
// Using Hanging protocol engine to match the displaySets
|
||||
useEffect(() => {
|
||||
const { unsubscribe } = HangingProtocolService.subscribe(
|
||||
HangingProtocolService.EVENTS.PROTOCOL_CHANGED,
|
||||
const { unsubscribe } = hangingProtocolService.subscribe(
|
||||
hangingProtocolService.EVENTS.PROTOCOL_CHANGED,
|
||||
() => {
|
||||
const displaySets = DisplaySetService.getActiveDisplaySets();
|
||||
const displaySets = displaySetService.getActiveDisplaySets();
|
||||
updateDisplaySetsForViewports(displaySets);
|
||||
}
|
||||
);
|
||||
@@ -179,8 +179,8 @@ function ViewerViewportGrid(props) {
|
||||
}, [viewports]);
|
||||
|
||||
useEffect(() => {
|
||||
const { unsubscribe } = MeasurementService.subscribe(
|
||||
MeasurementService.EVENTS.JUMP_TO_MEASUREMENT,
|
||||
const { unsubscribe } = measurementService.subscribe(
|
||||
measurementService.EVENTS.JUMP_TO_MEASUREMENT,
|
||||
({ viewportIndex, measurement }) => {
|
||||
const {
|
||||
displaySetInstanceUID: referencedDisplaySetInstanceUID,
|
||||
@@ -198,7 +198,7 @@ function ViewerViewportGrid(props) {
|
||||
}
|
||||
}
|
||||
|
||||
const displaySet = DisplaySetService.getDisplaySetByUID(
|
||||
const displaySet = displaySetService.getDisplaySetByUID(
|
||||
referencedDisplaySetInstanceUID
|
||||
);
|
||||
|
||||
@@ -335,7 +335,7 @@ function ViewerViewportGrid(props) {
|
||||
const displaySets = displaySetInstanceUIDsToUse.map(
|
||||
displaySetInstanceUID => {
|
||||
return (
|
||||
DisplaySetService.getDisplaySetByUID(displaySetInstanceUID) || {}
|
||||
displaySetService.getDisplaySetByUID(displaySetInstanceUID) || {}
|
||||
);
|
||||
}
|
||||
);
|
||||
@@ -343,7 +343,7 @@ function ViewerViewportGrid(props) {
|
||||
const ViewportComponent = _getViewportComponent(
|
||||
displaySets,
|
||||
viewportComponents,
|
||||
UINotificationService
|
||||
uiNotificationService
|
||||
);
|
||||
|
||||
// look inside displaySets to see if they need reRendering
|
||||
@@ -403,7 +403,7 @@ function ViewerViewportGrid(props) {
|
||||
}, [viewports, activeViewportIndex, viewportComponents, dataSource]);
|
||||
|
||||
/**
|
||||
* Loading indicator until numCols and numRows are gotten from the HangingProtocolService
|
||||
* Loading indicator until numCols and numRows are gotten from the hangingProtocolService
|
||||
*/
|
||||
if (!numRows || !numCols) {
|
||||
return null;
|
||||
@@ -428,7 +428,7 @@ ViewerViewportGrid.defaultProps = {
|
||||
function _getViewportComponent(
|
||||
displaySets,
|
||||
viewportComponents,
|
||||
UINotificationService
|
||||
uiNotificationService
|
||||
) {
|
||||
if (!displaySets || !displaySets.length) {
|
||||
return EmptyViewport;
|
||||
@@ -453,7 +453,7 @@ function _getViewportComponent(
|
||||
}
|
||||
|
||||
console.log("Can't show displaySet", SOPClassHandlerId, displaySets[0]);
|
||||
UINotificationService.show({
|
||||
uiNotificationService.show({
|
||||
title: 'Viewport Not Supported Yet',
|
||||
message: `Cannot display SOPClassId of ${displaySets[0].SOPClassUID} yet`,
|
||||
type: 'error',
|
||||
|
||||
@@ -23,8 +23,8 @@ function defaultRouteInit(
|
||||
hangingProtocol
|
||||
) {
|
||||
const {
|
||||
DisplaySetService,
|
||||
HangingProtocolService,
|
||||
displaySetService,
|
||||
hangingProtocolService,
|
||||
} = servicesManager.services;
|
||||
|
||||
const unsubscriptions = [];
|
||||
@@ -38,7 +38,7 @@ function defaultRouteInit(
|
||||
SeriesInstanceUID
|
||||
);
|
||||
|
||||
DisplaySetService.makeDisplaySets(seriesMetadata.instances, madeInClient);
|
||||
displaySetService.makeDisplaySets(seriesMetadata.instances, madeInClient);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -58,7 +58,7 @@ function defaultRouteInit(
|
||||
// until we run the hanging protocol matching service.
|
||||
|
||||
Promise.allSettled(allRetrieves).then(() => {
|
||||
const displaySets = DisplaySetService.getActiveDisplaySets();
|
||||
const displaySets = displaySetService.getActiveDisplaySets();
|
||||
|
||||
if (!displaySets || !displaySets.length) {
|
||||
return;
|
||||
@@ -84,7 +84,7 @@ function defaultRouteInit(
|
||||
|
||||
// run the hanging protocol matching on the displaySets with the predefined
|
||||
// hanging protocol in the mode configuration
|
||||
HangingProtocolService.run(
|
||||
hangingProtocolService.run(
|
||||
{ studies, activeStudy, displaySets },
|
||||
hangingProtocol
|
||||
);
|
||||
@@ -119,8 +119,8 @@ export default function ModeRoute({
|
||||
}
|
||||
|
||||
const {
|
||||
DisplaySetService,
|
||||
HangingProtocolService: hangingProtocolService,
|
||||
displaySetService,
|
||||
hangingProtocolService,
|
||||
} = servicesManager.services;
|
||||
|
||||
const { extensions, sopClassHandlers, hotkeys, hangingProtocol } = mode;
|
||||
@@ -242,7 +242,7 @@ export default function ModeRoute({
|
||||
// Extension
|
||||
|
||||
// Add SOPClassHandlers to a new SOPClassManager.
|
||||
DisplaySetService.init(extensionManager, sopClassHandlers);
|
||||
displaySetService.init(extensionManager, sopClassHandlers);
|
||||
|
||||
extensionManager.onModeEnter({
|
||||
servicesManager,
|
||||
|
||||
Reference in new issue
Block a user