From 400861d8b6dcfead27c06730e0937feecc64192b Mon Sep 17 00:00:00 2001 From: Alireza Date: Wed, 22 Nov 2023 17:05:27 -0500 Subject: [PATCH 1/4] Add useMemo hook to prevent unnecessary re-rendering --- extensions/dicom-microscopy/src/index.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/extensions/dicom-microscopy/src/index.tsx b/extensions/dicom-microscopy/src/index.tsx index a4589ed2dc7..486736407c9 100644 --- a/extensions/dicom-microscopy/src/index.tsx +++ b/extensions/dicom-microscopy/src/index.tsx @@ -1,5 +1,5 @@ import { id } from './id'; -import React, { Suspense } from 'react'; +import React, { Suspense, useMemo } from 'react'; import getPanelModule from './getPanelModule'; import getCommandsModule from './getCommandsModule'; @@ -58,8 +58,17 @@ export default { const [viewportGrid, viewportGridService] = useViewportGrid(); const { activeViewportId } = viewportGrid; + // a unique identifier based on the contents of displaySets. + // since we changed our rendering pipeline and if there is no + // element size change nor viewportId change we won't re-render + // we need a way to force re-rendering when displaySets change. + const displaySetsKey = useMemo(() => { + return props.displaySets.map(ds => ds.displaySetInstanceUID).join('-'); + }, [props.displaySets]); + return ( Date: Tue, 28 Nov 2023 11:41:16 -0500 Subject: [PATCH 2/4] Add translation for title in PanelMeasurementTable component --- extensions/default/src/Panels/PanelMeasurementTable.tsx | 5 ++++- platform/i18n/src/locales/en-US/MeasurementTable.json | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/extensions/default/src/Panels/PanelMeasurementTable.tsx b/extensions/default/src/Panels/PanelMeasurementTable.tsx index 791d878aa24..9b5d90543ba 100644 --- a/extensions/default/src/Panels/PanelMeasurementTable.tsx +++ b/extensions/default/src/Panels/PanelMeasurementTable.tsx @@ -1,5 +1,6 @@ import React, { useEffect, useState } from 'react'; import PropTypes from 'prop-types'; +import { useTranslation } from 'react-i18next'; import { utils, ServicesManager } from '@ohif/core'; import { MeasurementTable, Dialog, Input, useViewportGrid, ButtonEnums } from '@ohif/ui'; import ActionButtons from './ActionButtons'; @@ -18,6 +19,8 @@ export default function PanelMeasurementTable({ commandsManager, extensionManager, }): React.FunctionComponent { + const { t } = useTranslation('MeasurementTable'); + const [viewportGrid, viewportGridService] = useViewportGrid(); const { activeViewportId, viewports } = viewportGrid; const { measurementService, uiDialogService, uiNotificationService, displaySetService } = ( @@ -209,7 +212,7 @@ export default function PanelMeasurementTable({ data-cy={'measurements-panel'} > Date: Tue, 28 Nov 2023 11:57:17 -0500 Subject: [PATCH 3/4] Update medium-zoom version to 1.1.0 --- yarn.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/yarn.lock b/yarn.lock index ac4d71d6b44..2113b22b553 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14227,10 +14227,10 @@ media-typer@0.3.0: resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== -medium-zoom@^1.0.4: - version "1.0.8" - resolved "https://registry.yarnpkg.com/medium-zoom/-/medium-zoom-1.0.8.tgz#2bd1fbcf2961fa7b0e318fe284462aa9b8608ed2" - integrity sha512-CjFVuFq/IfrdqesAXfg+hzlDKu6A2n80ZIq0Kl9kWjoHh9j1N9Uvk5X0/MmN0hOfm5F9YBswlClhcwnmtwz7gA== +medium-zoom@^1.0.8: + version "1.1.0" + resolved "https://registry.yarnpkg.com/medium-zoom/-/medium-zoom-1.1.0.tgz#6efb6bbda861a02064ee71a2617a8dc4381ecc71" + integrity sha512-ewyDsp7k4InCUp3jRmwHBRFGyjBimKps/AJLjRSox+2q/2H4p/PNpQf+pwONWlJiOudkBXtbdmVbFjqyybfTmQ== memfs@^3.1.2, memfs@^3.4.1, memfs@^3.4.12, memfs@^3.4.3: version "3.6.0" @@ -16166,7 +16166,7 @@ plugin-image-zoom@ataft/plugin-image-zoom: version "1.1.0" resolved "https://codeload.github.com/ataft/plugin-image-zoom/tar.gz/3e64669f3c8fb998a556432ca3f56e0f617454f2" dependencies: - medium-zoom "^1.0.8" + medium-zoom "^1.0.4" polished@^4.2.2: version "4.2.2" From d40feba9e8b32141d01f95b9a6d4602731bb6b6e Mon Sep 17 00:00:00 2001 From: Alireza Date: Tue, 28 Nov 2023 12:03:43 -0500 Subject: [PATCH 4/4] Fix modeFactory isValidMode condition --- modes/segmentation/src/index.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modes/segmentation/src/index.tsx b/modes/segmentation/src/index.tsx index 0282435b265..8b24196f161 100644 --- a/modes/segmentation/src/index.tsx +++ b/modes/segmentation/src/index.tsx @@ -124,8 +124,11 @@ function modeFactory({ modeConfiguration }) { * segmentations and we should exclude them */ isValidMode: ({ modalities }) => { - if (modalities.length === 1) { - return !['SM', 'US', 'MG', 'OT', 'DOC', 'CR'].includes(modalities[0]); + // Don't show the mode if the selected studies have only one modality + // that is not supported by the mode + const modalitiesArray = modalities.split('\\'); + if (modalitiesArray.length === 1) { + return !['SM', 'US', 'MG', 'OT', 'DOC', 'CR'].includes(modalitiesArray[0]); } return true;