Skip to content

Commit

Permalink
merged with v3-stable (#3332)
Browse files Browse the repository at this point in the history
* fix(volumeLoad): should not have missing slices when loading (#3287)

* fix(volumeLoad): should not have missing slices when loading

* add review comments

* feat(DoubleClick): double click a viewport to one up and back (#3285)

* feat(DoubleClick): double click a viewport to one up and back

Added a toggleOneUp command that puts the active viewport into a 1x1 grid layout
and it toggles out of 'one-up' by restoring its saved 'toggleOneUpViewportGridStore'
from the StateSyncService.
Added double click customization for the Cornerstone extension with the
default double click handling being the toggleOneUp command.
Added a cypress test for the double click functionality.

* PR feedback:
- tracked viewport measurements no longer show as dashed when toggling one up
- disallowed double clicking near a measurement
- updated cornerstone3D dependencies to fix double click of TMTV and volume viewport 3D
- created ViewportGridService.getLayoutOptionsFromState

* Updated the ViewportGridService docs.

* Switched to using 'cornerstoneViewportClickCommands' and consistency with the context menu clicks.

* feat(tmtv): add more stages to pt/ct (#3290)

* feat(tmtv): add more stages to pt/ct

* make error stage change to info

* apply review comments

* fix(viewports): The display of linked viewports during drag and drop has a race (#3286)

* fix: The display of linked viewports during drag and drop has a race

* PR review comments

* fix: Segmentation display two up

* Removing console logs

* Fix the blank viewport can have stuff added to it

* Fix the null name on HP module

* Fix the navigate to initial image

* Fix the nth interleave loader

* Fix the unit tests

* PR comments - docs mostly

* fix: Exception thrown on change displayset after double click

* feat(multiframe): enhanced support for multiframe dicom (#3164)

* Changes in cswil version and multiframe

* Minor changes

* wip

* Adding support for NM multiframe images

* Applying PR suggestions

* fixing package versions

* Restoring default.js config file

* Check if NM subtype is reconstructable

* Restore default.js values

* refactore code

* feat: add flag for strict zspacing

---------

Co-authored-by: Alireza <[email protected]>

* feat(URL): add param for initial series and sop uids to display (#3265)

* feat: Allow navigating to a specified series and sop instance

This was a feature in OHIF v2, so adding it to v3, albeit with new
parameters.

feat: Allow comma separated as well as repeated args params

* docs

* Test fixes

* feat: Navigate to SOP selected - PR fixes

* Updated docs

* PR fixes

* fix(crosshairs): suppressed error for crosshair (#3237)

* fix(SRTool): Ellipse Display for DICOMSR Tool (#3307)

* feat(App): support async config function (#3313)

* fix(URL): allow multi filter query (#3314)

* fix(viewport): Initial blank image on SR/SEG initial display (#3304)

* fix: Blank display area on initial DICOM SR load

* Docs

* Fix a NPE

* fix(ROIThreshold): fix setWeight not updating properly for ROIThreshold panel (#3315)

* fix(hp): Add displaySetMatchDetails and displaySets to options in (#3320)

The sameAs function requires displaySetMatchDetails and displaySets to compare attributes between display sets, but these properties were not being passed into the options object. This commit adds the necessary lines of code to include displaySetMatchDetails and displaySets in the options object, fixing the issue where the  custom attribute function 'sameAs' was missing required data.

* feat(measurements): add CircleROI Tool (#3211)

* [refactor] measurement service mapping files - rename to .ts files

* [fix] RectangleROI - measurement service mapping _getReport() function - tool name fix

* [feat] added CircleROI tool from updated cornerstone3D

* [refactor] fix for typescript strong typing warnings

* [feat] cornerstone-dicom-sr extension - added CircleROI tool

* [feat] added toolbar button for CircleROI tool

* [doc] doc updates for CircleROI tool

* [update] library - dcmjs to 0.29.5

* [fix] roundNumber() function when given strings

* [fix] refactor after upgrading conerstonejs library 0.49.0

* yarn.lock file change

* fix: Service consistency typing (#3309)

* Use more consistent type/structure for services

* Fix restoring SR so the tests described work

* One more typed service

* Added types for the Cornerstone library

* Couple more type fixes

* feat: Add a new hanging protocol @ohif/mn (#3305)

* feat: Add a new hanging protocol @ohif/mn

* Add @ohif/seg example

* PR comments and a couple more fixes to make things cleaner

* PR comment

* Added an example to cause the PR checks to rerun
  • Loading branch information
lscoder authored Apr 20, 2023
1 parent c5c8285 commit c31d777
Show file tree
Hide file tree
Showing 125 changed files with 2,923 additions and 1,640 deletions.
78 changes: 78 additions & 0 deletions extensions/cornerstone-dicom-seg/src/getHangingProtocolModule.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { Types } from '@ohif/core';

const segProtocol: Types.HangingProtocol.Protocol = {
id: '@ohif/seg',
// Don't store this hanging protocol as it applies to the currently active
// display set by default
// cacheId: null,
hasUpdatedPriorsInformation: false,
name: 'Segmentations',
// Just apply this one when specifically listed
protocolMatchingRules: [],
toolGroupIds: ['default'],
// -1 would be used to indicate active only, whereas other values are
// the number of required priors referenced - so 0 means active with
// 0 or more priors.
numberOfPriorsReferenced: 0,
// Default viewport is used to define the viewport when
// additional viewports are added using the layout tool
defaultViewport: {
viewportOptions: {
viewportType: 'stack',
toolGroupId: 'default',
allowUnmatchedView: true,
},
displaySets: [
{
id: 'segDisplaySetId',
matchedDisplaySetsIndex: -1,
},
],
},
displaySetSelectors: {
segDisplaySetId: {
seriesMatchingRules: [
{
attribute: 'Modality',
constraint: {
equals: 'SEG',
},
},
],
},
},
stages: [
{
name: 'Segmentations',
viewportStructure: {
layoutType: 'grid',
properties: {
rows: 1,
columns: 1,
},
},
viewports: [
{
viewportOptions: { allowUnmatchedView: true },
displaySets: [
{
id: 'segDisplaySetId',
},
],
},
],
},
],
};

function getHangingProtocolModule() {
return [
{
name: segProtocol.id,
protocol: segProtocol,
},
];
}

export default getHangingProtocolModule;
export { segProtocol };
14 changes: 3 additions & 11 deletions extensions/cornerstone-dicom-seg/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Types } from '@ohif/core';

import getSopClassHandlerModule from './getSopClassHandlerModule';
import PanelSegmentation from './panels/PanelSegmentation';
import getHangingProtocolModule from './getHangingProtocolModule';

const Component = React.lazy(() => {
return import(
Expand All @@ -30,17 +31,6 @@ const extension = {
*/
id,

/**
* Perform any pre-registration tasks here. This is called before the extension
* is registered. Usually we run tasks such as: configuring the libraries
* (e.g. cornerstone, cornerstoneTools, ...) or registering any services that
* this extension is providing.
*/
preRegistration: ({
servicesManager,
commandsManager,
configuration = {},
}) => {},
/**
* PanelModule should provide a list of panels that will be available in OHIF
* for Modes to consume and render. Each panel is defined by a {name,
Expand Down Expand Up @@ -90,6 +80,8 @@ const extension = {
* Examples include the default sop class handler provided by the default extension
*/
getSopClassHandlerModule,

getHangingProtocolModule,
};

export default extension;
7 changes: 4 additions & 3 deletions extensions/cornerstone-dicom-seg/src/utils/_hydrateSEG.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ async function _hydrateSEGDisplaySet({
displaySetInstanceUID
);

viewportGridService.setDisplaySetsForViewports(updatedViewports);

// Todo: fix this after we have a better way for stack viewport segmentations

// check every viewport in the viewports to see if the displaySetInstanceUID
Expand All @@ -50,7 +48,7 @@ async function _hydrateSEGDisplaySet({
);

if (shouldDisplaySeg) {
viewportGridService.setDisplaySetsForViewport({
updatedViewports.push({
viewportIndex: index,
displaySetInstanceUIDs: viewport.displaySetInstanceUIDs,
viewportOptions: {
Expand All @@ -62,6 +60,9 @@ async function _hydrateSEGDisplaySet({
}
});

// Do the entire update at once
viewportGridService.setDisplaySetsForViewports(updatedViewports);

return true;
}

Expand Down
12 changes: 6 additions & 6 deletions extensions/cornerstone-dicom-sr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
"test:unit:ci": "jest --ci --runInBand --collectCoverage --passWithNoTests"
},
"peerDependencies": {
"@ohif/core": "^3.0.0",
"@ohif/extension-cornerstone": "^3.0.0",
"@ohif/core": ">=3.0.0",
"@ohif/extension-cornerstone": ">=3.0.0",
"@ohif/extension-measurement-tracking": "^3.0.0",
"@ohif/ui": "^2.0.0",
"dcmjs": "^0.29.4",
"dcmjs": "^0.29.5",
"dicom-parser": "^1.8.9",
"hammerjs": "^2.0.8",
"prop-types": "^15.6.2",
Expand All @@ -45,8 +45,8 @@
"dependencies": {
"@babel/runtime": "^7.20.13",
"classnames": "^2.3.2",
"@cornerstonejs/adapters": "^0.4.1",
"@cornerstonejs/core": "^0.36.5",
"@cornerstonejs/tools": "^0.55.1"
"@cornerstonejs/adapters": "^0.6.0",
"@cornerstonejs/core": "^0.40.0",
"@cornerstonejs/tools": "^0.60.1"
}
}
78 changes: 78 additions & 0 deletions extensions/cornerstone-dicom-sr/src/getHangingProtocolModule.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { Types } from '@ohif/core';

const srProtocol: Types.HangingProtocol.Protocol = {
id: '@ohif/sr',
// Don't store this hanging protocol as it applies to the currently active
// display set by default
// cacheId: null,
hasUpdatedPriorsInformation: false,
name: 'SR Key Images',
// Just apply this one when specifically listed
protocolMatchingRules: [],
toolGroupIds: ['default'],
// -1 would be used to indicate active only, whereas other values are
// the number of required priors referenced - so 0 means active with
// 0 or more priors.
numberOfPriorsReferenced: 0,
// Default viewport is used to define the viewport when
// additional viewports are added using the layout tool
defaultViewport: {
viewportOptions: {
viewportType: 'stack',
toolGroupId: 'default',
allowUnmatchedView: true,
},
displaySets: [
{
id: 'srDisplaySetId',
matchedDisplaySetsIndex: -1,
},
],
},
displaySetSelectors: {
srDisplaySetId: {
seriesMatchingRules: [
{
attribute: 'Modality',
constraint: {
equals: 'SR',
},
},
],
},
},
stages: [
{
name: 'SR Key Images',
viewportStructure: {
layoutType: 'grid',
properties: {
rows: 1,
columns: 1,
},
},
viewports: [
{
viewportOptions: { allowUnmatchedView: true },
displaySets: [
{
id: 'srDisplaySetId',
},
],
},
],
},
],
};

function getHangingProtocolModule() {
return [
{
name: srProtocol.id,
protocol: srProtocol,
},
];
}

export default getHangingProtocolModule;
export { srProtocol };
26 changes: 13 additions & 13 deletions extensions/cornerstone-dicom-sr/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import React from 'react';
import getSopClassHandlerModule from './getSopClassHandlerModule';
import getHangingProtocolModule, {
srProtocol,
} from './getHangingProtocolModule';
import onModeEnter from './onModeEnter';
import commandsModule from './commandsModule';
import init from './init';
import getCommandsModule from './commandsModule';
import preRegistration from './init';
import { id } from './id.js';
import toolNames from './tools/toolNames';
import hydrateStructuredReport from './utils/hydrateStructuredReport';
Expand Down Expand Up @@ -31,9 +34,7 @@ const dicomSRExtension = {
id,
onModeEnter,

preRegistration({ servicesManager, configuration = {} }) {
init({ servicesManager, configuration });
},
preRegistration,

/**
*
Expand All @@ -54,14 +55,11 @@ const dicomSRExtension = {

return [{ name: 'dicom-sr', component: ExtendedOHIFCornerstoneSRViewport }];
},
getCommandsModule({ servicesManager, commandsManager, extensionManager }) {
return commandsModule({
servicesManager,
commandsManager,
extensionManager,
});
},
getCommandsModule,
getSopClassHandlerModule,
getHangingProtocolModule,

// Include dynmically computed values such as toolNames not known till instantiation
getUtilityModule({ servicesManager }) {
return [
{
Expand All @@ -75,4 +73,6 @@ const dicomSRExtension = {
};

export default dicomSRExtension;
export { hydrateStructuredReport };

// Put static exports here so they can be type checked
export { hydrateStructuredReport, srProtocol };
3 changes: 3 additions & 0 deletions extensions/cornerstone-dicom-sr/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
BidirectionalTool,
CobbAngleTool,
EllipticalROITool,
CircleROITool,
LengthTool,
PlanarFreehandROITool,
} from '@cornerstonejs/tools';
Expand All @@ -24,6 +25,7 @@ export default function init({
addToolInstance(toolNames.SRLength, LengthTool, {});
addToolInstance(toolNames.SRBidirectional, BidirectionalTool);
addToolInstance(toolNames.SREllipticalROI, EllipticalROITool);
addToolInstance(toolNames.SRCircleROI, CircleROITool);
addToolInstance(toolNames.SRArrowAnnotate, ArrowAnnotateTool);
addToolInstance(toolNames.SRAngle, AngleTool);
// TODO - fix the SR display of Cobb Angle, as it joins the two lines
Expand All @@ -40,6 +42,7 @@ export default function init({
SRLength: dashedLine,
SRBidirectional: dashedLine,
SREllipticalROI: dashedLine,
SRCircleROI: dashedLine,
SRArrowAnnotate: dashedLine,
SRCobbAngle: dashedLine,
SRAngle: dashedLine,
Expand Down
21 changes: 17 additions & 4 deletions extensions/cornerstone-dicom-sr/src/tools/DICOMSRDisplayTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,26 @@ export default class DICOMSRDisplayTool extends AnnotationTool {

const ellipsePointsWorld = data;

const rotation = viewport.getRotation();

canvasCoordinates = ellipsePointsWorld.map(p =>
viewport.worldToCanvas(p)
);

const canvasCorners = <Array<Types.Point2>>(
utilities.math.ellipse.getCanvasEllipseCorners(canvasCoordinates)
);
let canvasCorners;
if (rotation == 90 || rotation == 270) {
canvasCorners = <Array<Types.Point2>>(
utilities.math.ellipse.getCanvasEllipseCorners([
canvasCoordinates[2],
canvasCoordinates[3],
canvasCoordinates[0],
canvasCoordinates[1],
])
);
} else {
canvasCorners = <Array<Types.Point2>>(
utilities.math.ellipse.getCanvasEllipseCorners(canvasCoordinates)
);
}

const lineUID = `${index}`;
drawing.drawEllipse(
Expand Down
1 change: 1 addition & 0 deletions extensions/cornerstone-dicom-sr/src/tools/toolNames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const toolNames = {
SRLength: 'SRLength',
SRBidirectional: 'SRBidirectional',
SREllipticalROI: 'SREllipticalROI',
SRCircleROI: 'SRCircleROI',
SRArrowAnnotate: 'SRArrowAnnotate',
SRAngle: 'SRAngle',
SRCobbAngle: 'SRCobbAngle',
Expand Down
Loading

0 comments on commit c31d777

Please sign in to comment.