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:
Bill WallaceandAlireza authored and GitHub committed 2023-02-10 16:46:09 -05:00
1 parent a97fb2fc9a
commit 8af0362d12
97 files changed
+934 -908

No files matched your search

+10 -10
View File
@@ -25,10 +25,10 @@ const DEFAULT_MEATADATA = {
export default function PanelPetSUV({ servicesManager, commandsManager }) {
const { t } = useTranslation('PanelSUV');
const {
DisplaySetService,
ToolGroupService,
displaySetService,
toolGroupService,
toolbarService,
HangingProtocolService,
hangingProtocolService,
} = (servicesManager as ServicesManager).services;
const [metadata, setMetadata] = useState(DEFAULT_MEATADATA);
const [ptDisplaySet, setPtDisplaySet] = useState(null);
@@ -70,8 +70,8 @@ export default function PanelPetSUV({ servicesManager, commandsManager }) {
};
useEffect(() => {
const displaySets = DisplaySetService.getActiveDisplaySets();
const { viewportMatchDetails } = HangingProtocolService.getMatchDetails();
const displaySets = displaySetService.getActiveDisplaySets();
const { viewportMatchDetails } = hangingProtocolService.getMatchDetails();
if (!displaySets.length) {
return;
}
@@ -89,8 +89,8 @@ export default function PanelPetSUV({ servicesManager, commandsManager }) {
// get the patientMetadata from the StudyInstanceUIDs and update the state
useEffect(() => {
const { unsubscribe } = HangingProtocolService.subscribe(
HangingProtocolService.EVENTS.PROTOCOL_CHANGED,
const { unsubscribe } = hangingProtocolService.subscribe(
hangingProtocolService.EVENTS.PROTOCOL_CHANGED,
({ viewportMatchDetails }) => {
const displaySetInfo = getMatchingPTDisplaySet(viewportMatchDetails);
@@ -112,7 +112,7 @@ export default function PanelPetSUV({ servicesManager, commandsManager }) {
throw new Error('No ptDisplaySet found');
}
const toolGroupIds = ToolGroupService.getToolGroupIds();
const toolGroupIds = toolGroupService.getToolGroupIds();
// Todo: we don't have a proper way to perform a toggle command and update the
// state for the toolbar, so here, we manually toggle the toolbar
@@ -139,7 +139,7 @@ export default function PanelPetSUV({ servicesManager, commandsManager }) {
);
// update the displaySets
DisplaySetService.setDisplaySetMetadataInvalidated(
displaySetService.setDisplaySetMetadataInvalidated(
ptDisplaySet.displaySetInstanceUID
);
}
@@ -238,7 +238,7 @@ export default function PanelPetSUV({ servicesManager, commandsManager }) {
PanelPetSUV.propTypes = {
servicesManager: PropTypes.shape({
services: PropTypes.shape({
MeasurementService: PropTypes.shape({
measurementService: PropTypes.shape({
getMeasurements: PropTypes.func.isRequired,
subscribe: PropTypes.func.isRequired,
EVENTS: PropTypes.object.isRequired,
@@ -45,14 +45,14 @@ export default function PanelRoiThresholdSegmentation({
servicesManager,
commandsManager,
}) {
const { SegmentationService } = servicesManager.services;
const { segmentationService } = servicesManager.services;
const { t } = useTranslation('PanelSUV');
const [showConfig, setShowConfig] = useState(false);
const [labelmapLoading, setLabelmapLoading] = useState(false);
const [selectedSegmentationId, setSelectedSegmentationId] = useState(null);
const [segmentations, setSegmentations] = useState(() =>
SegmentationService.getSegmentations()
segmentationService.getSegmentations()
);
const [config, dispatch] = useReducer(reducer, {
@@ -90,7 +90,7 @@ export default function PanelRoiThresholdSegmentation({
const lesionGlyoclysisStats = lesionStats.volume * lesionStats.meanValue;
// update segDetails with the suv peak for the active segmentation
const segmentation = SegmentationService.getSegmentation(
const segmentation = segmentationService.getSegmentation(
selectedSegmentationId
);
@@ -101,7 +101,7 @@ export default function PanelRoiThresholdSegmentation({
};
const notYetUpdatedAtSource = true;
SegmentationService.addOrUpdateSegmentation(
segmentationService.addOrUpdateSegmentation(
{
...segmentation,
...Object.assign(segmentation.cachedStats, cachedStats),
@@ -118,13 +118,13 @@ export default function PanelRoiThresholdSegmentation({
*/
useEffect(() => {
// ~~ Subscription
const added = SegmentationService.EVENTS.SEGMENTATION_ADDED;
const updated = SegmentationService.EVENTS.SEGMENTATION_UPDATED;
const added = segmentationService.EVENTS.SEGMENTATION_ADDED;
const updated = segmentationService.EVENTS.SEGMENTATION_UPDATED;
const subscriptions = [];
[added, updated].forEach(evt => {
const { unsubscribe } = SegmentationService.subscribe(evt, () => {
const segmentations = SegmentationService.getSegmentations();
const { unsubscribe } = segmentationService.subscribe(evt, () => {
const segmentations = segmentationService.getSegmentations();
setSegmentations(segmentations);
});
subscriptions.push(unsubscribe);
@@ -138,10 +138,10 @@ export default function PanelRoiThresholdSegmentation({
}, []);
useEffect(() => {
const { unsubscribe } = SegmentationService.subscribe(
SegmentationService.EVENTS.SEGMENTATION_REMOVED,
const { unsubscribe } = segmentationService.subscribe(
segmentationService.EVENTS.SEGMENTATION_REMOVED,
() => {
const segmentations = SegmentationService.getSegmentations();
const segmentations = segmentationService.getSegmentations();
setSegmentations(segmentations);
if (segmentations.length > 0) {
@@ -223,15 +223,15 @@ export default function PanelRoiThresholdSegmentation({
setSelectedSegmentationId(id);
}}
onToggleVisibility={id => {
SegmentationService.toggleSegmentationVisibility(id);
segmentationService.toggleSegmentationVisibility(id);
}}
onToggleVisibilityAll={ids => {
ids.map(id => {
SegmentationService.toggleSegmentationVisibility(id);
segmentationService.toggleSegmentationVisibility(id);
});
}}
onDelete={id => {
SegmentationService.remove(id);
segmentationService.remove(id);
}}
onEdit={id => {
segmentationEditHandler({
@@ -285,7 +285,7 @@ PanelRoiThresholdSegmentation.propTypes = {
}),
servicesManager: PropTypes.shape({
services: PropTypes.shape({
SegmentationService: PropTypes.shape({
segmentationService: PropTypes.shape({
getSegmentation: PropTypes.func.isRequired,
getSegmentations: PropTypes.func.isRequired,
toggleSegmentationVisibility: PropTypes.func.isRequired,
@@ -2,14 +2,14 @@ import React from 'react';
import { Input, Dialog } from '@ohif/ui';
function segmentationItemEditHandler({ id, servicesManager }) {
const { SegmentationService, UIDialogService } = servicesManager.services;
const { segmentationService, uiDialogService } = servicesManager.services;
const segmentation = SegmentationService.getSegmentation(id);
const segmentation = segmentationService.getSegmentation(id);
const onSubmitHandler = ({ action, value }) => {
switch (action.id) {
case 'save': {
SegmentationService.addOrUpdateSegmentation(
segmentationService.addOrUpdateSegmentation(
{
...segmentation,
...value,
@@ -18,10 +18,10 @@ function segmentationItemEditHandler({ id, servicesManager }) {
);
}
}
UIDialogService.dismiss({ id: 'enter-annotation' });
uiDialogService.dismiss({ id: 'enter-annotation' });
};
UIDialogService.create({
uiDialogService.create({
id: 'enter-annotation',
centralize: true,
isDraggable: false,