Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP fix(SR): Fix/sr SCOORD3D not loading #3631

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
899905f
Calculate distance between point and image plane
rodrigobasilio2022 Aug 30, 2023
17a0d1f
Merge branch 'master' of https://github.com/rodrigobasilio2022/Viewer…
rodrigobasilio2022 Aug 30, 2023
b4786f3
Add point projection to image plane function
rodrigobasilio2022 Aug 30, 2023
a5c7139
Merge branch 'master' of https://github.com/rodrigobasilio2022/Viewer…
rodrigobasilio2022 Aug 30, 2023
29f5c83
Merge branch 'master' of https://github.com/rodrigobasilio2022/Viewer…
rodrigobasilio2022 Sep 1, 2023
bc9ca53
Update rehydrate
rodrigobasilio2022 Sep 4, 2023
c2ebd73
Merge branch 'master' of https://github.com/rodrigobasilio2022/Viewer…
rodrigobasilio2022 Sep 4, 2023
63a8f5b
Adapt IDC SR to be loaded as a FreeHandROI
rodrigobasilio2022 Sep 4, 2023
13d0c39
add scoord3d to scoord conversion
rodrigobasilio2022 Sep 5, 2023
5beb514
Merge branch 'master' of https://github.com/rodrigobasilio2022/Viewer…
rodrigobasilio2022 Sep 14, 2023
23601c7
Change scoord3d to scoord conversion
rodrigobasilio2022 Sep 14, 2023
e6f62da
Restore default.js
rodrigobasilio2022 Sep 14, 2023
6ca49b3
Refactor code to minimize changes
rodrigobasilio2022 Sep 15, 2023
ae9664a
Refactor some files
rodrigobasilio2022 Sep 15, 2023
92b5dc0
Fix error in getSopClassHandler
rodrigobasilio2022 Sep 15, 2023
aa41541
Merge branch 'master' of https://github.com/rodrigobasilio2022/Viewer…
rodrigobasilio2022 Sep 18, 2023
f4c48c8
Refactor convert function
rodrigobasilio2022 Sep 18, 2023
295da53
Minor typo
rodrigobasilio2022 Sep 18, 2023
4cd64f7
Refactor function names
rodrigobasilio2022 Sep 18, 2023
195f238
Merge branch 'master' of https://github.com/rodrigobasilio2022/Viewer…
rodrigobasilio2022 Sep 18, 2023
e78eadd
Add convertAnnotations to customizationService
rodrigobasilio2022 Sep 19, 2023
a647375
Add text property in measurement schema keys
rodrigobasilio2022 Sep 19, 2023
eef16d3
Merge branch 'master' into fix/SRNotLoading
rodrigobasilio2022 Sep 29, 2023
f975825
Merge branch 'master' of https://github.com/rodrigobasilio2022/Viewer…
rodrigobasilio2022 Oct 17, 2023
1c75217
Merge branch 'fix/SRNotLoading' of https://github.com/rodrigobasilio2…
rodrigobasilio2022 Oct 17, 2023
297a936
Merge branch 'master' into fix/SRNotLoading
igoroctaviano Nov 13, 2023
7d7d6a6
Merge branch 'master' of github.com:ohif/Viewers into fix/SRNotLoading
igoroctaviano Nov 23, 2023
24b4174
Merge branch 'master' into fix/SRNotLoading
igoroctaviano Dec 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions extensions/cornerstone-dicom-sr/src/getSopClassHandlerModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { utils, classes, DisplaySetService, Types } from '@ohif/core';
import addMeasurement from './utils/addMeasurement';
import isRehydratable from './utils/isRehydratable';
import { adaptersSR } from '@cornerstonejs/adapters';

type InstanceMetadata = Types.InstanceMetadata;

const { CodeScheme: Cornerstone3DCodeScheme } = adaptersSR.Cornerstone3D;
Expand Down Expand Up @@ -155,9 +154,31 @@ function _load(displaySet, servicesManager, extensionManager) {
const dataSources = extensionManager.getDataSources();
const dataSource = dataSources[0];

const { customizationService } = servicesManager.services;

const { ContentSequence } = displaySet.instance;

displaySet.referencedImages = _getReferencedImagesList(ContentSequence);
// get the dicomSRExtensionCustomizations object, if exists
const dicomSrExtensionCustomizations = customizationService.getModeCustomization(
'dicomSrExtensionCustomizations'
);

if (
dicomSrExtensionCustomizations?.convertAnnotations &&
typeof dicomSrExtensionCustomizations?.convertAnnotations === 'function'
) {
const referencedImages = dicomSrExtensionCustomizations.convertAnnotations(
displaySet.instance,
displaySetService
);
if (referencedImages && referencedImages.length) {
displaySet.referencedImages = referencedImages;
}
}

if (!displaySet.referencedImages) {
displaySet.referencedImages = _getReferencedImagesList(ContentSequence);
}
displaySet.measurements = _getMeasurements(ContentSequence);

const mappings = measurementService.getSourceMappings(
Expand Down
10 changes: 8 additions & 2 deletions extensions/cornerstone/src/initMeasurementService.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ const connectMeasurementServiceToTools = (
}

const annotationManager = annotation.state.getAnnotationManager();
annotationManager.addAnnotation({
const newAnnotation = {
annotationUID: measurement.uid,
highlighted: false,
isLocked: false,
Expand All @@ -369,13 +369,19 @@ const connectMeasurementServiceToTools = (
referencedImageId: imageId,
},
data: {
...data.annotation.data,
text: data.annotation.data.text,
handles: { ...data.annotation.data.handles },
cachedStats: { ...data.annotation.data.cachedStats },
label: data.annotation.data.label,
frameNumber: frameNumber,
},
});
};
if (data.annotation.data?.polyline) {
igoroctaviano marked this conversation as resolved.
Show resolved Hide resolved
newAnnotation.data.polyline = data.annotation.data.polyline;
}

annotationManager.addAnnotation(newAnnotation);
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { PubSubService } from '../_shared/pubSubServiceInterface';
* @property {Array} points -
* @property {MeasurementSource} source -
* @property {boolean} selected -
* @property {string} text -
*/

/* Measurement schema keys for object validation. */
Expand Down Expand Up @@ -58,6 +59,7 @@ const MEASUREMENT_SCHEMA_KEYS = [
'longestDiameter',
'cachedStats',
'selected',
'text',
];

const EVENTS = {
Expand Down
6 changes: 3 additions & 3 deletions platform/ui/src/contextProviders/ViewportGridProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,16 @@ export function ViewportGridProvider({ children, service }) {
);

const displaySetOptions = updatedViewport.displaySetOptions || [];
if (!displaySetOptions.length) {
if (!displaySetOptions.length && previousViewport?.displaySetOptions) {
// Copy all the display set options, assuming a full set of displaySet UID's is provided.
displaySetOptions.push(...previousViewport.displaySetOptions);
displaySetOptions.push(...previousViewport?.displaySetOptions);
if (!displaySetOptions.length) {
displaySetOptions.push({});
}
}

const newViewport = {
...previousViewport,
...previousViewport || {},
displaySetInstanceUIDs,
viewportOptions,
displaySetOptions,
Expand Down