Skip to content

Commit

Permalink
Merge pull request #51 from RadicalImaging/feat/bidirectional
Browse files Browse the repository at this point in the history
WIP: Bidirectional + Ellipse for Microscopy Ext
  • Loading branch information
wayfarer3130 authored Nov 3, 2021
2 parents 99e8444 + 145d832 commit e2b3b24
Show file tree
Hide file tree
Showing 12 changed files with 107 additions and 37 deletions.
2 changes: 1 addition & 1 deletion extensions/calibration-tool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"peerDependencies": {
"@ohif/core": "^0.50.0",
"cornerstone-core": "^2.2.8",
"dcmjs": "0.19.0",
"cornerstone-tools": "6.0.5",
"dcmjs": "0.18.3",
"prop-types": "^15.6.2",
"react": "^16.8.6",
"react-dom": "^16.8.6"
Expand Down
2 changes: 1 addition & 1 deletion extensions/cornerstone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"cornerstone-math": "^0.1.9",
"cornerstone-tools": "^6.0.5",
"cornerstone-wado-image-loader": "^4.0.3",
"dcmjs": "0.18.10",
"dcmjs": "0.19.0",
"dicom-parser": "^1.8.9",
"hammerjs": "^2.0.8",
"prop-types": "^15.6.2",
Expand Down
2 changes: 1 addition & 1 deletion extensions/dicom-html/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"peerDependencies": {
"@ohif/core": "^0.50.0",
"dcmjs": "0.18.10",
"dcmjs": "0.19.0",
"prop-types": "^15.6.2",
"react": "^16.8.6",
"react-dom": "^16.8.6"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import {
withTranslation,
} from '@ohif/ui';
import DEVICE_OBSERVER_UID from '../../utils/DEVICE_OBSERVER_UID';
import microscopyManager, {
EVENTS as MicroscopyEvents,
} from '../../tools/microscopyManager';
import { EVENTS as MicroscopyEvents } from '../../tools/microscopyManager';
import { utils, DICOMWeb, errorHandler } from '@ohif/core';
import { api } from 'dicomweb-client';
import dcmjs from 'dcmjs';
Expand Down Expand Up @@ -363,10 +361,13 @@ class MicroscopyPanel extends Component {
render() {
const { microscopyManager, promptSave } = this;
const rows = [];

this.state.roiAnnotations.forEach((roiAnnotation, index) => {
const label = roiAnnotation.getDetailedLabel();
const area = roiAnnotation.getArea();
const length = roiAnnotation.getLength();
const shortAxisLength =
roiAnnotation.roiGraphic.properties.shortAxisLength;
const isSelected = this.state.selectedAnnotation === roiAnnotation;

const onRelabel = () => microscopyManager.triggerRelabel(roiAnnotation);
Expand Down Expand Up @@ -405,7 +406,11 @@ class MicroscopyPanel extends Component {
{area} μm<sup>2</sup>
</div>
) : length !== undefined ? (
<div className={'measurementDisplayText'}>{length} μm</div>
<div className={'measurementDisplayText'}>
{shortAxisLength
? `${length} μm x ${shortAxisLength} μm`
: `${length} μm`}
</div>
) : null}
<div className="rowActions">{rowActions}</div>
</TableListItem>
Expand Down
73 changes: 50 additions & 23 deletions extensions/dicom-microscopy/src/toolbarModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,33 @@ const definitions = [
],
},
},
{
id: 'Bidirectional',
label: 'Bidirectional',
icon: 'measure-temp',
type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
commandName: 'activateInteractions',
commandOptions: {
interactions: [
...defaultInteractions,
[
'draw',
{
geometryType: 'line',
bidirectional: true,
styleOptions: styles.default,
markup: 'measurement',
maxPoints: 1,
minPoints: 1,
vertexEnabled: false,
bindings: {
mouseButtons: ['left'],
},
},
],
],
},
},
{
id: 'HideROIs',
label: 'Hide ROIs',
Expand Down Expand Up @@ -186,29 +213,29 @@ const definitions = [
],
},
},
// {
// id: 'EllipseROI',
// label: 'Ellipse ROI',
// icon: 'ellipse-circle',
// type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
// commandName: 'activateInteractions',
// commandOptions: {
// interactions: [
// ...defaultInteractions,
// [
// 'draw',
// {
// geometryType: 'ellipse',
// styleOptions: styles.default,
// markup: 'measurement',
// bindings: {
// mouseButtons: ['left'],
// },
// },
// ],
// ],
// },
// },
{
id: 'EllipseROI',
label: 'Ellipse ROI',
icon: 'ellipse-circle',
type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
commandName: 'activateInteractions',
commandOptions: {
interactions: [
...defaultInteractions,
[
'draw',
{
geometryType: 'ellipse',
styleOptions: styles.default,
markup: 'measurement',
bindings: {
mouseButtons: ['left'],
},
},
],
],
},
},
{
id: 'CircleROI',
label: 'Circle ROI',
Expand Down
2 changes: 1 addition & 1 deletion extensions/dicom-microscopy/src/tools/viewerManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ class ViewerManager extends Publisher {
dragZoom: activate =>
activate
? 'activateDragZoomInteraction'
: 'deactivateDragZoomInteraction',
: 'deactivateDragZoomInteraction'
};

const availableInteractionsName = Object.keys(interactionsMap);
Expand Down
3 changes: 3 additions & 0 deletions extensions/dicom-microscopy/src/utils/dcmCodeValues.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ const DCM_CODE_VALUES = {
TRACKING_UNIQUE_IDENTIFIER: '112039',
LENGTH: '410668003',
AREA: '42798000',
SHORT_AXIS: 'G-A186',
LONG_AXIS: 'G-A185',
ELLIPSE_AREA: 'G-D7FE', // TODO: Remove this
};

export default DCM_CODE_VALUES;
10 changes: 7 additions & 3 deletions extensions/dicom-microscopy/src/utils/loadSR.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,13 @@ async function _getROIsFromToolState(naturalizedDataset, FrameOfReferenceUID) {
}

let measurements = toArray(measurementGroup.ContentSequence).filter(ci =>
[DCM_CODE_VALUES.LENGTH, DCM_CODE_VALUES.AREA].includes(
ci.ConceptNameCodeSequence.CodeValue
)
[
DCM_CODE_VALUES.LENGTH,
DCM_CODE_VALUES.AREA,
DCM_CODE_VALUES.SHORT_AXIS,
DCM_CODE_VALUES.LONG_AXIS,
DCM_CODE_VALUES.ELLIPSE_AREA,
].includes(ci.ConceptNameCodeSequence.CodeValue)
);

let evaluations = toArray(measurementGroup.ContentSequence).filter(ci =>
Expand Down
2 changes: 1 addition & 1 deletion extensions/vtk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"cornerstone-core": "^2.5.0",
"cornerstone-tools": "^6.0.0",
"cornerstone-wado-image-loader": "^4.0.3",
"dcmjs": "0.18.10",
"dcmjs": "0.19.0",
"dicom-parser": "^1.8.9",
"i18next": "^17.0.3",
"i18next-browser-languagedetector": "^3.0.1",
Expand Down
2 changes: 1 addition & 1 deletion platform/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"dependencies": {
"@babel/runtime": "^7.5.5",
"ajv": "^6.10.0",
"dcmjs": "0.18.10",
"dcmjs": "0.19.0",
"dicomweb-client": "^0.8.1",
"immer": "6.0.2",
"isomorphic-base64": "^1.0.2",
Expand Down
2 changes: 1 addition & 1 deletion platform/viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"cornerstone-math": "^0.1.9",
"cornerstone-tools": "6.0.5",
"cornerstone-wado-image-loader": "^4.0.3",
"dcmjs": "0.18.10",
"dcmjs": "0.19.0",
"dicom-parser": "^1.8.9",
"dicomweb-client": "^0.8.1",
"hammerjs": "^2.0.8",
Expand Down
31 changes: 31 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6715,10 +6715,41 @@ dateformat@^3.0.0:
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae"
integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==

<<<<<<< HEAD
[email protected]:
version "0.18.11"
resolved "https://registry.yarnpkg.com/dcmjs/-/dcmjs-0.18.11.tgz#724cab26148503017d97bbcbb8fe9685dfae69dc"
integrity sha512-7C+tKWIzeo2ZzL1Fss+3HuztWyhZYWhQGXV5hrK7yi4s8ctIN0lCeTUNYPdRS1DyE2GEAI7gb9fDcQU9Wh1rgg==
dependencies:
"@babel/polyfill" "^7.8.3"
"@babel/runtime" "^7.8.4"
gl-matrix "^3.1.0"
lodash.clonedeep "^4.5.0"
loglevelnext "^3.0.1"
ndarray "^1.0.19"

[email protected]:
version "0.19.0"
resolved "https://registry.yarnpkg.com/dcmjs/-/dcmjs-0.19.0.tgz#822a39b0630e7bee869cf937cfabb1fd84bb8349"
integrity sha512-Ym+sSAgj8/4qh6SUWXNUdam0s3afkZkYxDfCpFlG6xr0yEvC6/dnpC2LZnMT/vDpprejjR/1upi2h9PlRSv5AQ==
dependencies:
"@babel/polyfill" "^7.8.3"
"@babel/runtime" "^7.8.4"
gl-matrix "^3.1.0"
lodash.clonedeep "^4.5.0"
loglevelnext "^3.0.1"
ndarray "^1.0.19"

dcmjs@^0.18.2:
version "0.18.9"
resolved "https://registry.yarnpkg.com/dcmjs/-/dcmjs-0.18.9.tgz#0e18fcff975aaae8ca01a96e781fa75c29ec97f3"
integrity sha512-aTu4fUo3TSgohJC+U509qdXL1per09XvlYdQva0BGtIZMr/iR5n8h/ojpcDTRJoVtSuaj331KJj1yCj8FMMK4Q==
=======
dcmjs@^0.19.0:
version "0.19.0"
resolved "https://registry.yarnpkg.com/dcmjs/-/dcmjs-0.19.0.tgz#822a39b0630e7bee869cf937cfabb1fd84bb8349"
integrity sha512-Ym+sSAgj8/4qh6SUWXNUdam0s3afkZkYxDfCpFlG6xr0yEvC6/dnpC2LZnMT/vDpprejjR/1upi2h9PlRSv5AQ==
>>>>>>> e9e8f84838652bae38f15c073a33bd531d07159e
dependencies:
"@babel/polyfill" "^7.8.3"
"@babel/runtime" "^7.8.4"
Expand Down

0 comments on commit e2b3b24

Please sign in to comment.