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
@@ -119,7 +119,7 @@ function _getDisplaySetsFromSeries(
|
||||
}
|
||||
|
||||
function _load(displaySet, servicesManager, extensionManager) {
|
||||
const { DisplaySetService, MeasurementService } = servicesManager.services;
|
||||
const { displaySetService, measurementService } = servicesManager.services;
|
||||
const dataSources = extensionManager.getDataSources();
|
||||
const dataSource = dataSources[0];
|
||||
|
||||
@@ -128,7 +128,7 @@ function _load(displaySet, servicesManager, extensionManager) {
|
||||
displaySet.referencedImages = _getReferencedImagesList(ContentSequence);
|
||||
displaySet.measurements = _getMeasurements(ContentSequence);
|
||||
|
||||
const mappings = MeasurementService.getSourceMappings(
|
||||
const mappings = measurementService.getSourceMappings(
|
||||
CORNERSTONE_3D_TOOLS_SOURCE_NAME,
|
||||
CORNERSTONE_3D_TOOLS_SOURCE_VERSION
|
||||
);
|
||||
@@ -138,7 +138,7 @@ function _load(displaySet, servicesManager, extensionManager) {
|
||||
displaySet.isLoaded = true;
|
||||
|
||||
// Check currently added displaySets and add measurements if the sources exist.
|
||||
DisplaySetService.activeDisplaySets.forEach(activeDisplaySet => {
|
||||
displaySetService.activeDisplaySets.forEach(activeDisplaySet => {
|
||||
_checkIfCanAddMeasurementsToDisplaySet(
|
||||
displaySet,
|
||||
activeDisplaySet,
|
||||
@@ -147,8 +147,8 @@ function _load(displaySet, servicesManager, extensionManager) {
|
||||
});
|
||||
|
||||
// Subscribe to new displaySets as the source may come in after.
|
||||
DisplaySetService.subscribe(
|
||||
DisplaySetService.EVENTS.DISPLAY_SETS_ADDED,
|
||||
displaySetService.subscribe(
|
||||
displaySetService.EVENTS.DISPLAY_SETS_ADDED,
|
||||
data => {
|
||||
const { displaySetsAdded } = data;
|
||||
// If there are still some measurements that have not yet been loaded into cornerstone,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { SOPClassHandlerId } from './id';
|
||||
|
||||
export default function onModeEnter({ servicesManager }) {
|
||||
const { DisplaySetService } = servicesManager.services;
|
||||
const displaySetCache = DisplaySetService.getDisplaySetCache();
|
||||
const { displaySetService } = servicesManager.services;
|
||||
const displaySetCache = displaySetService.getDisplaySetCache();
|
||||
|
||||
const srDisplaySets = displaySetCache.filter(
|
||||
ds => ds.SOPClassHandlerId === SOPClassHandlerId
|
||||
|
||||
@@ -4,8 +4,8 @@ import { ArrowAnnotateTool } from '@cornerstonejs/tools';
|
||||
* The reason we are extending ArrowAnnotateTool is to create a new tool for SR
|
||||
* viewport which basically has a different name. This is done since Cornerstone
|
||||
* has shifted from creating tool instances for each annotation, and we have ArrowAnnotate
|
||||
* mappers at the MeasurementService, so if we didn't do this, we would be mapping
|
||||
* the SR annotation to the MeasurementService (since there is a ArrowAnnotateTool mapper),
|
||||
* mappers at the measurementService, so if we didn't do this, we would be mapping
|
||||
* the SR annotation to the measurementService (since there is a ArrowAnnotateTool mapper),
|
||||
* but with extending and renaming it, there is not mapper for SRArrowAnnotateTool; hence
|
||||
* no mapping; hence no new measurement, just temporary ones for the SR viewport.
|
||||
*/
|
||||
|
||||
@@ -4,8 +4,8 @@ import { BidirectionalTool } from '@cornerstonejs/tools';
|
||||
* The reason we are extending BidirectionalTool is to create a new tool for SR
|
||||
* viewport which basically has a different name. This is done since Cornerstone
|
||||
* has shifted from creating tool instances for each annotation, and we have Bidirectional
|
||||
* mappers at the MeasurementService, so if we didn't do this, we would be mapping
|
||||
* the SR annotation to the MeasurementService (since there is a BidirectionalTool mapper),
|
||||
* mappers at the measurementService, so if we didn't do this, we would be mapping
|
||||
* the SR annotation to the measurementService (since there is a BidirectionalTool mapper),
|
||||
* but with extending and renaming it, there is not mapper for SRBidirectionalTool; hence
|
||||
* no mapping; hence no new measurement, just temporary ones for the SR viewport.
|
||||
*/
|
||||
|
||||
@@ -4,8 +4,8 @@ import { EllipticalROITool } from '@cornerstonejs/tools';
|
||||
* The reason we are extending EllipticalROITool is to create a new tool for SR
|
||||
* viewport which basically has a different name. This is done since Cornerstone
|
||||
* has shifted from creating tool instances for each annotation, and we have EllipticalROI
|
||||
* mappers at the MeasurementService, so if we didn't do this, we would be mapping
|
||||
* the SR annotation to the MeasurementService (since there is a EllipticalROITool mapper),
|
||||
* mappers at the measurementService, so if we didn't do this, we would be mapping
|
||||
* the SR annotation to the measurementService (since there is a EllipticalROITool mapper),
|
||||
* but with extending and renaming it, there is not mapper for SREllipticalROITool; hence
|
||||
* no mapping; hence no new measurement, just temporary ones for the SR viewport.
|
||||
*/
|
||||
|
||||
@@ -4,8 +4,8 @@ import { LengthTool } from '@cornerstonejs/tools';
|
||||
* The reason we are extending LengthTool is to create a new tool for SR
|
||||
* viewport which basically has a different name. This is done since Cornerstone
|
||||
* has shifted from creating tool instances for each annotation, and we have Length
|
||||
* mappers at the MeasurementService, so if we didn't do this, we would be mapping
|
||||
* the SR annotation to the MeasurementService (since there is a LengthTool mapper),
|
||||
* mappers at the measurementService, so if we didn't do this, we would be mapping
|
||||
* the SR annotation to the measurementService (since there is a LengthTool mapper),
|
||||
* but with extending and renaming it, there is not mapper for SRLengthTool; hence
|
||||
* no mapping; hence no new measurement, just temporary ones for the SR viewport.
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Extracts the label from the toolData imported from dcmjs. We need to do this
|
||||
* as dcmjs does not depeend on OHIF/the MeasurementService, it just produces data for cornestoneTools.
|
||||
* as dcmjs does not depeend on OHIF/the measurementService, it just produces data for cornestoneTools.
|
||||
* This optional data is available for the consumer to process if they wish to.
|
||||
* @param {object} toolData The tooldata relating to the
|
||||
*
|
||||
|
||||
@@ -20,14 +20,14 @@ export default function hydrateStructuredReport(
|
||||
displaySetInstanceUID
|
||||
) {
|
||||
const dataSource = extensionManager.getActiveDataSource()[0];
|
||||
const { MeasurementService, DisplaySetService } = servicesManager.services;
|
||||
const { measurementService, displaySetService } = servicesManager.services;
|
||||
|
||||
const displaySet = DisplaySetService.getDisplaySetByUID(
|
||||
const displaySet = displaySetService.getDisplaySetByUID(
|
||||
displaySetInstanceUID
|
||||
);
|
||||
|
||||
// TODO -> We should define a strict versioning somewhere.
|
||||
const mappings = MeasurementService.getSourceMappings(
|
||||
const mappings = measurementService.getSourceMappings(
|
||||
CORNERSTONE_3D_TOOLS_SOURCE_NAME,
|
||||
CORNERSTONE_3D_TOOLS_SOURCE_VERSION
|
||||
);
|
||||
@@ -166,7 +166,7 @@ export default function hydrateStructuredReport(
|
||||
},
|
||||
};
|
||||
|
||||
const source = MeasurementService.getSource(
|
||||
const source = measurementService.getSource(
|
||||
CORNERSTONE_3D_TOOLS_SOURCE_NAME,
|
||||
CORNERSTONE_3D_TOOLS_SOURCE_VERSION
|
||||
);
|
||||
@@ -176,7 +176,7 @@ export default function hydrateStructuredReport(
|
||||
m => m.annotationType === annotationType
|
||||
);
|
||||
|
||||
MeasurementService.addRawMeasurement(
|
||||
measurementService.addRawMeasurement(
|
||||
source,
|
||||
annotationType,
|
||||
{ annotation },
|
||||
|
||||
@@ -6,11 +6,11 @@ const supportedLegacyCornerstoneTags = ['cornerstoneTools@^4.0.0'];
|
||||
const CORNERSTONE_3D_TAG = cornerstoneAdapters.CORNERSTONE_3D_TAG;
|
||||
|
||||
/**
|
||||
* Checks if the given `displaySet`can be rehydrated into the `MeasurementService`.
|
||||
* Checks if the given `displaySet`can be rehydrated into the `measurementService`.
|
||||
*
|
||||
* @param {object} displaySet The SR `displaySet` to check.
|
||||
* @param {object[]} mappings The CornerstoneTools 4 mappings to the `MeasurementService`.
|
||||
* @returns {boolean} True if the SR can be rehydrated into the `MeasurementService`.
|
||||
* @param {object[]} mappings The CornerstoneTools 4 mappings to the `measurementService`.
|
||||
* @returns {boolean} True if the SR can be rehydrated into the `measurementService`.
|
||||
*/
|
||||
export default function isRehydratable(displaySet, mappings) {
|
||||
if (!mappings || !mappings.length) {
|
||||
@@ -30,7 +30,7 @@ export default function isRehydratable(displaySet, mappings) {
|
||||
|
||||
adapterKeys.forEach(key => {
|
||||
if (mappingDefinitions.includes(key)) {
|
||||
// Must have both a dcmjs adapter and a MeasurementService
|
||||
// Must have both a dcmjs adapter and a measurementService
|
||||
// Definition in order to be a candidate for import.
|
||||
adapters.push(cornerstoneAdapters[key]);
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ function OHIFCornerstoneSRViewport(props) {
|
||||
const { t } = useTranslation('SRViewport');
|
||||
|
||||
const {
|
||||
DisplaySetService,
|
||||
CornerstoneViewportService,
|
||||
MeasurementService,
|
||||
displaySetService,
|
||||
cornerstoneViewportService,
|
||||
measurementService,
|
||||
} = servicesManager.services;
|
||||
|
||||
// SR viewport will always have a single display set
|
||||
@@ -84,12 +84,12 @@ function OHIFCornerstoneSRViewport(props) {
|
||||
// if no panels from measurement-tracking extension is used, this code will run
|
||||
trackedMeasurements = null;
|
||||
sendTrackedMeasurementsEvent = (eventName, { displaySetInstanceUID }) => {
|
||||
MeasurementService.clearMeasurements();
|
||||
measurementService.clearMeasurements();
|
||||
const { SeriesInstanceUIDs } = hydrateStructuredReport(
|
||||
{ servicesManager, extensionManager },
|
||||
displaySetInstanceUID
|
||||
);
|
||||
const displaySets = DisplaySetService.getDisplaySetsForSeries(
|
||||
const displaySets = displaySetService.getDisplaySetsForSeries(
|
||||
SeriesInstanceUIDs[0]
|
||||
);
|
||||
if (displaySets.length) {
|
||||
@@ -152,7 +152,7 @@ function OHIFCornerstoneSRViewport(props) {
|
||||
_getViewportReferencedDisplaySetData(
|
||||
srDisplaySet,
|
||||
newMeasurementSelected,
|
||||
DisplaySetService
|
||||
displaySetService
|
||||
).then(({ referencedDisplaySet, referencedDisplaySetMetadata }) => {
|
||||
setMeasurementSelected(newMeasurementSelected);
|
||||
setActiveImageDisplaySetData(referencedDisplaySet);
|
||||
@@ -166,13 +166,13 @@ function OHIFCornerstoneSRViewport(props) {
|
||||
|
||||
// it means that we have a new referenced display set, and the
|
||||
// imageIdIndex will handle it by updating the viewport, but if they
|
||||
// are the same we just need to use MeasurementService to jump to the
|
||||
// are the same we just need to use measurementService to jump to the
|
||||
// new measurement
|
||||
const viewportInfo = CornerstoneViewportService.getViewportInfoByIndex(
|
||||
const viewportInfo = cornerstoneViewportService.getViewportInfoByIndex(
|
||||
viewportIndex
|
||||
);
|
||||
|
||||
const csViewport = CornerstoneViewportService.getCornerstoneViewport(
|
||||
const csViewport = cornerstoneViewportService.getCornerstoneViewport(
|
||||
viewportInfo.getViewportId()
|
||||
);
|
||||
|
||||
@@ -259,8 +259,8 @@ function OHIFCornerstoneSRViewport(props) {
|
||||
Cleanup the SR viewport when the viewport is destroyed
|
||||
*/
|
||||
useEffect(() => {
|
||||
const onDisplaySetsRemovedSubscription = DisplaySetService.subscribe(
|
||||
DisplaySetService.EVENTS.DISPLAY_SETS_REMOVED,
|
||||
const onDisplaySetsRemovedSubscription = displaySetService.subscribe(
|
||||
displaySetService.EVENTS.DISPLAY_SETS_REMOVED,
|
||||
({ displaySetInstanceUIDs }) => {
|
||||
const activeViewport = viewports[activeViewportIndex];
|
||||
if (
|
||||
@@ -432,14 +432,14 @@ OHIFCornerstoneSRViewport.defaultProps = {
|
||||
async function _getViewportReferencedDisplaySetData(
|
||||
displaySet,
|
||||
measurementSelected,
|
||||
DisplaySetService
|
||||
displaySetService
|
||||
) {
|
||||
const { measurements } = displaySet;
|
||||
const measurement = measurements[measurementSelected];
|
||||
|
||||
const { displaySetInstanceUID } = measurement;
|
||||
|
||||
const referencedDisplaySet = DisplaySetService.getDisplaySetByUID(
|
||||
const referencedDisplaySet = displaySetService.getDisplaySetByUID(
|
||||
displaySetInstanceUID
|
||||
);
|
||||
|
||||
|
||||
Reference in new issue
Block a user