fix(sr): correct jump to first image via viewRef (#4576)
This commit is contained in:
parent
6c7f535676
commit
6ec04ca65e
@ -9,6 +9,7 @@ import { Icon, Tooltip, useViewportGrid, ViewportActionArrows } from '@ohif/ui';
|
|||||||
import hydrateStructuredReport from '../utils/hydrateStructuredReport';
|
import hydrateStructuredReport from '../utils/hydrateStructuredReport';
|
||||||
import { useAppConfig } from '@state';
|
import { useAppConfig } from '@state';
|
||||||
import createReferencedImageDisplaySet from '../utils/createReferencedImageDisplaySet';
|
import createReferencedImageDisplaySet from '../utils/createReferencedImageDisplaySet';
|
||||||
|
import { usePositionPresentationStore } from '@ohif/extension-cornerstone';
|
||||||
|
|
||||||
const MEASUREMENT_TRACKING_EXTENSION_ID = '@ohif/extension-measurement-tracking';
|
const MEASUREMENT_TRACKING_EXTENSION_ID = '@ohif/extension-measurement-tracking';
|
||||||
|
|
||||||
@ -16,7 +17,6 @@ const SR_TOOLGROUP_BASE_NAME = 'SRToolGroup';
|
|||||||
|
|
||||||
function OHIFCornerstoneSRMeasurementViewport(props: withAppTypes) {
|
function OHIFCornerstoneSRMeasurementViewport(props: withAppTypes) {
|
||||||
const {
|
const {
|
||||||
commandsManager,
|
|
||||||
children,
|
children,
|
||||||
dataSource,
|
dataSource,
|
||||||
displaySets,
|
displaySets,
|
||||||
@ -29,7 +29,6 @@ function OHIFCornerstoneSRMeasurementViewport(props: withAppTypes) {
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
displaySetService,
|
displaySetService,
|
||||||
cornerstoneViewportService,
|
|
||||||
measurementService,
|
measurementService,
|
||||||
viewportActionCornersService,
|
viewportActionCornersService,
|
||||||
} = servicesManager.services;
|
} = servicesManager.services;
|
||||||
@ -43,6 +42,9 @@ function OHIFCornerstoneSRMeasurementViewport(props: withAppTypes) {
|
|||||||
|
|
||||||
const srDisplaySet = displaySets[0];
|
const srDisplaySet = displaySets[0];
|
||||||
|
|
||||||
|
const { setPositionPresentation } = usePositionPresentationStore();
|
||||||
|
|
||||||
|
|
||||||
const [viewportGrid, viewportGridService] = useViewportGrid();
|
const [viewportGrid, viewportGridService] = useViewportGrid();
|
||||||
const [measurementSelected, setMeasurementSelected] = useState(0);
|
const [measurementSelected, setMeasurementSelected] = useState(0);
|
||||||
const [measurementCount, setMeasurementCount] = useState(1);
|
const [measurementCount, setMeasurementCount] = useState(1);
|
||||||
@ -154,33 +156,17 @@ function OHIFCornerstoneSRMeasurementViewport(props: withAppTypes) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setMeasurementSelected(newMeasurementSelected);
|
setMeasurementSelected(newMeasurementSelected);
|
||||||
|
|
||||||
setActiveImageDisplaySetData(referencedDisplaySet);
|
setActiveImageDisplaySetData(referencedDisplaySet);
|
||||||
setReferencedDisplaySetMetadata(referencedDisplaySetMetadata);
|
setReferencedDisplaySetMetadata(referencedDisplaySetMetadata);
|
||||||
|
|
||||||
if (
|
const { presentationIds } = viewportOptions
|
||||||
referencedDisplaySet.displaySetInstanceUID ===
|
const measurement = srDisplaySet.measurements[newMeasurementSelected]
|
||||||
activeImageDisplaySetData?.displaySetInstanceUID
|
setPositionPresentation(presentationIds.positionPresentationId, {
|
||||||
) {
|
viewReference: {
|
||||||
const { measurements } = srDisplaySet;
|
referencedImageId: measurement.imageId
|
||||||
|
|
||||||
// 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
|
|
||||||
// new measurement
|
|
||||||
const csViewport = cornerstoneViewportService.getCornerstoneViewport(viewportId);
|
|
||||||
|
|
||||||
if (!csViewport) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
const imageIds = csViewport.getImageIds();
|
|
||||||
|
|
||||||
const imageIdIndex = imageIds.indexOf(measurements[newMeasurementSelected].imageId);
|
|
||||||
|
|
||||||
if (imageIdIndex !== -1) {
|
|
||||||
csViewport.setImageIdIndex(imageIdIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[dataSource, srDisplaySet, activeImageDisplaySetData, viewportId]
|
[dataSource, srDisplaySet, activeImageDisplaySetData, viewportId]
|
||||||
@ -202,9 +188,7 @@ function OHIFCornerstoneSRMeasurementViewport(props: withAppTypes) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const initialImageIndex = activeImageDisplaySetData.images.findIndex(
|
|
||||||
image => image.imageId === measurement.imageId
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Component
|
<Component
|
||||||
@ -230,7 +214,6 @@ function OHIFCornerstoneSRMeasurementViewport(props: withAppTypes) {
|
|||||||
props.onElementEnabled?.(evt);
|
props.onElementEnabled?.(evt);
|
||||||
onElementEnabled(evt);
|
onElementEnabled(evt);
|
||||||
}}
|
}}
|
||||||
initialImageIndex={initialImageIndex}
|
|
||||||
isJumpToMeasurementDisabled={true}
|
isJumpToMeasurementDisabled={true}
|
||||||
></Component>
|
></Component>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -441,8 +441,9 @@ class SegmentationService extends PubSubService {
|
|||||||
|
|
||||||
const segmentIndex = Number(SegmentNumber);
|
const segmentIndex = Number(SegmentNumber);
|
||||||
|
|
||||||
const imageCentroidXYZ = segDisplaySet.centroids.get(index).image || { x: 0, y: 0, z: 0 };
|
const centroid = segDisplaySet.centroids?.get(index);
|
||||||
const worldCentroidXYZ = segDisplaySet.centroids.get(index).world || { x: 0, y: 0, z: 0 };
|
const imageCentroidXYZ = centroid?.image || { x: 0, y: 0, z: 0 };
|
||||||
|
const worldCentroidXYZ = centroid?.world || { x: 0, y: 0, z: 0 };
|
||||||
|
|
||||||
segments[segmentIndex] = {
|
segments[segmentIndex] = {
|
||||||
segmentIndex,
|
segmentIndex,
|
||||||
|
|||||||
@ -86,7 +86,7 @@
|
|||||||
"@babel/preset-react": "^7.16.7",
|
"@babel/preset-react": "^7.16.7",
|
||||||
"@babel/preset-typescript": "^7.13.0",
|
"@babel/preset-typescript": "^7.13.0",
|
||||||
"prettier": "^3.3.3",
|
"prettier": "^3.3.3",
|
||||||
"prettier-plugin-tailwindcss": "0.6.8"
|
"prettier-plugin-tailwindcss": "0.6.9"
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"hooks": {
|
"hooks": {
|
||||||
|
|||||||
@ -73,7 +73,6 @@ const combineFrameInstance = (frame, instance) => {
|
|||||||
ImagePositionPatientToUse = [position[0], position[1], position[2]];
|
ImagePositionPatientToUse = [position[0], position[1], position[2]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.debug('🚀 ~ ImagePositionPatientToUse:', ImagePositionPatientToUse);
|
|
||||||
|
|
||||||
const newInstance = Object.assign(instance, { frameNumber: frameNumber });
|
const newInstance = Object.assign(instance, { frameNumber: frameNumber });
|
||||||
|
|
||||||
|
|||||||
@ -20198,10 +20198,10 @@ prettier-linter-helpers@^1.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
fast-diff "^1.1.2"
|
fast-diff "^1.1.2"
|
||||||
|
|
||||||
prettier-plugin-tailwindcss@0.6.8:
|
prettier-plugin-tailwindcss@0.6.9:
|
||||||
version "0.6.8"
|
version "0.6.9"
|
||||||
resolved "https://registry.yarnpkg.com/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.6.8.tgz#8a178e1679e3f941cc9de396f109c6cffea676d8"
|
resolved "https://registry.yarnpkg.com/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.6.9.tgz#db84c32918eae9b44e5a5f0aa4d1249cc39fa739"
|
||||||
integrity sha512-dGu3kdm7SXPkiW4nzeWKCl3uoImdd5CTZEJGxyypEPL37Wj0HT2pLqjrvSei1nTeuQfO4PUfjeW5cTUNRLZ4sA==
|
integrity sha512-r0i3uhaZAXYP0At5xGfJH876W3HHGHDp+LCRUJrs57PBeQ6mYHMwr25KH8NPX44F2yGTvdnH7OqCshlQx183Eg==
|
||||||
|
|
||||||
prettier-plugin-tailwindcss@^0.5.4:
|
prettier-plugin-tailwindcss@^0.5.4:
|
||||||
version "0.5.14"
|
version "0.5.14"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user