Compare commits

..
Author SHA1 Message Date
ohif-bot ea0963d75f chore(release): publish [skip ci]
- @ohif/extension-dicom-rt@0.6.14
 - @ohif/extension-dicom-segmentation@0.6.11
 - @ohif/extension-vtk@1.11.16
 - @ohif/core@2.13.15
 - @ohif/ui@1.9.3
 - @ohif/viewer@4.9.24
2021-09-03 21:01:01 +00:00
Igor Octaviano 46d5718011 Merge pull request #2491 from OHIF/feat/ohif-2482
OHIF-2482: Add badge numbers for seg and rtstruct
2021-09-03 17:57:42 -03:00
Davide Punzo f8740e04f3 Merge branch 'master' into feat/ohif-2482 2021-09-02 16:08:37 +02:00
igoroctaviano f6a0db753a Merge branch 'master' of github.com:OHIF/Viewers into feat/ohif-2482 2021-07-29 09:19:42 -03:00
igoroctaviano 8518e179ee Extract event 2021-07-29 09:18:31 -03:00
igoroctaviano 3f40cdced7 Add badge numbers for seg and rtstruct 2021-07-28 22:15:05 -03:00
21 changed files with 274 additions and 29 deletions

No files matched your search

+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [0.6.14](https://github.com/OHIF/Viewers/compare/@ohif/extension-dicom-rt@0.6.13...@ohif/extension-dicom-rt@0.6.14) (2021-09-03)
**Note:** Version bump only for package @ohif/extension-dicom-rt
## [0.6.13](https://github.com/OHIF/Viewers/compare/@ohif/extension-dicom-rt@0.6.12...@ohif/extension-dicom-rt@0.6.13) (2021-06-02)
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-dicom-rt",
"version": "0.6.13",
"version": "0.6.14",
"description": "OHIF extension for rendering DICOM RTSTRUCTs on top of cornerstone images.",
"author": "OHIF",
"license": "MIT",
+38 -1
View File
@@ -1,11 +1,12 @@
import React from 'react';
import { utils } from '@ohif/core';
import init from './init.js';
import sopClassHandlerModule from './OHIFDicomRTStructSopClassHandler';
import id from './id.js';
import RTPanel from './components/RTPanel/RTPanel';
import { version } from '../package.json';
import { utils } from '@ohif/core';
const { studyMetadataManager } = utils;
export default {
@@ -42,12 +43,48 @@ export default {
);
};
const RTPanelTabChangedEvent = 'rt-panel-tab-updated';
/**
* Trigger's an event to update the state of the panel's RoundedButtonGroup.
*
* This is required to avoid extension state
* coupling with the viewer's ToolbarRow component.
*
* @param {object} data
*/
const triggerRTPanelUpdatedEvent = data => {
const event = new CustomEvent(RTPanelTabChangedEvent, {
detail: data,
});
document.dispatchEvent(event);
};
const onRTStructsLoaded = ({ detail }) => {
const { rtStructDisplaySet, referencedDisplaySet } = detail;
const studyMetadata = studyMetadataManager.get(
rtStructDisplaySet.StudyInstanceUID
);
const referencedDisplaysets = studyMetadata.getDerivedDatasets({
referencedSeriesInstanceUID: referencedDisplaySet.SeriesInstanceUID,
Modality: 'RTSTRUCT',
});
triggerRTPanelUpdatedEvent({
badgeNumber: referencedDisplaysets.length,
target: 'rt-panel',
});
};
document.addEventListener('extensiondicomrtrtloaded', onRTStructsLoaded);
return {
menuOptions: [
{
icon: 'list',
label: 'RTSTRUCT',
target: 'rt-panel',
stateEvent: RTPanelTabChangedEvent,
isDisabled: (studies, activeViewport) => {
if (!studies) {
return true;
+15 -7
View File
@@ -90,11 +90,11 @@ export default async function loadRTStruct(
const sopInstanceUID = ContourImageSequence
? ContourImageSequence.ReferencedSOPInstanceUID
: _getClosestSOPInstanceUID(
ContourData,
ContourGeometricType,
NumberOfContourPoints,
imageIdSopInstanceUidPairs
);
ContourData,
ContourGeometricType,
NumberOfContourPoints,
imageIdSopInstanceUidPairs
);
const imageId = _getImageId(imageIdSopInstanceUidPairs, sopInstanceUID);
if (!imageId) {
@@ -171,7 +171,13 @@ export default async function loadRTStruct(
* allows us to easily watch the module or the rtstruct loading process in any other component
* without subscribing to external events.
*/
const event = new CustomEvent('extensiondicomrtrtloaded');
const event = new CustomEvent('extensiondicomrtrtloaded', {
detail: {
rtStructDisplaySet,
referencedDisplaySet,
studies,
},
});
document.dispatchEvent(event);
}
@@ -299,7 +305,9 @@ const _getImageId = (imageIdSopInstanceUidPairs, sopInstanceUID) => {
imageIdSopInstanceUidPairsEntry.sopInstanceUID === sopInstanceUID
);
return imageIdSopInstanceUidPairsEntry ? imageIdSopInstanceUidPairsEntry.imageId : null;
return imageIdSopInstanceUidPairsEntry
? imageIdSopInstanceUidPairsEntry.imageId
: null;
};
function _getImageIdSopInstanceUidPairsForDisplaySet(
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [0.6.11](https://github.com/OHIF/Viewers/compare/@ohif/extension-dicom-segmentation@0.6.10...@ohif/extension-dicom-segmentation@0.6.11) (2021-09-03)
**Note:** Version bump only for package @ohif/extension-dicom-segmentation
## [0.6.10](https://github.com/OHIF/Viewers/compare/@ohif/extension-dicom-segmentation@0.6.9...@ohif/extension-dicom-segmentation@0.6.10) (2021-06-02)
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-dicom-segmentation",
"version": "0.6.10",
"version": "0.6.11",
"description": "OHIF extension for viewing segmentations in the 2D MPR view",
"author": "OHIF",
"license": "MIT",
@@ -224,16 +224,20 @@ const SegmentationPanel = ({
)
);
};
}, [activeIndex, viewports]);
}, [
activeIndex,
updateSegmentationComboBox,
viewports,
]);
const updateSegmentationComboBox = (e) => {
const updateSegmentationComboBox = e => {
const index = e.detail.activatedLabelmapIndex;
if (index !== -1) {
setState(state => ({ ...state, selectedSegmentation: index }));
} else {
cleanSegmentationComboBox();
}
}
};
const cleanSegmentationComboBox = () => {
setState(state => ({
@@ -245,7 +249,7 @@ const SegmentationPanel = ({
isDisabled: true,
selectedSegmentation: -1,
}));
}
};
const refreshSegmentations = () => {
const activeViewport = getActiveViewport();
@@ -309,7 +313,8 @@ const SegmentationPanel = ({
);
const filteredReferencedSegDisplaysets = referencedSegDisplaysets.filter(
(segDisplay => segDisplay.loadError !== true));
segDisplay => segDisplay.loadError !== true
);
return filteredReferencedSegDisplaysets.map((displaySet, index) => {
const {
@@ -1,9 +1,12 @@
import React from 'react';
import OHIF from '@ohif/core';
import init from './init.js';
import toolbarModule from './toolbarModule.js';
import getSopClassHandlerModule from './getOHIFDicomSegSopClassHandler.js';
import SegmentationPanel from './components/SegmentationPanel/SegmentationPanel.js';
import { version } from '../package.json';
const { studyMetadataManager } = OHIF.utils;
export default {
/**
@@ -79,12 +82,50 @@ export default {
);
};
const SegmentationPanelTabUpdatedEvent = 'segmentation-panel-tab-updated';
/**
* Trigger's an event to update the state of the panel's RoundedButtonGroup.
*
* This is required to avoid extension state
* coupling with the viewer's ToolbarRow component.
*
* @param {object} data
*/
const triggerSegmentationPanelTabUpdatedEvent = data => {
const event = new CustomEvent(SegmentationPanelTabUpdatedEvent, {
detail: data,
});
document.dispatchEvent(event);
};
const onSegmentationsLoaded = ({ detail }) => {
const { segDisplaySet, segMetadata } = detail;
const studyMetadata = studyMetadataManager.get(
segDisplaySet.StudyInstanceUID
);
const referencedDisplaysets = studyMetadata.getDerivedDatasets({
referencedSeriesInstanceUID: segMetadata.seriesInstanceUid,
Modality: 'SEG',
});
triggerSegmentationPanelTabUpdatedEvent({
badgeNumber: referencedDisplaysets.length,
target: 'segmentation-panel',
});
};
document.addEventListener(
'extensiondicomsegmentationsegloaded',
onSegmentationsLoaded
);
return {
menuOptions: [
{
icon: 'list',
label: 'Segmentations',
target: 'segmentation-panel',
stateEvent: SegmentationPanelTabUpdatedEvent,
isDisabled: studies => {
if (!studies) {
return true;
@@ -59,7 +59,16 @@ export default async function loadSegmentation(
* without subscribing to external events.
*/
console.log('Segmentation loaded.');
const event = new CustomEvent('extensiondicomsegmentationsegloaded');
const event = new CustomEvent('extensiondicomsegmentationsegloaded', {
detail: {
imageIds,
segDisplaySet,
labelmapBuffer,
segMetadata,
segmentsOnFrame,
labelmapSegments,
},
});
document.dispatchEvent(event);
return labelmapIndex;
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.11.16](https://github.com/OHIF/Viewers/compare/@ohif/extension-vtk@1.11.15...@ohif/extension-vtk@1.11.16) (2021-09-03)
**Note:** Version bump only for package @ohif/extension-vtk
## [1.11.15](https://github.com/OHIF/Viewers/compare/@ohif/extension-vtk@1.11.14...@ohif/extension-vtk@1.11.15) (2021-08-30)
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-vtk",
"version": "1.11.15",
"version": "1.11.16",
"description": "OHIF extension for VTK.js",
"author": "OHIF",
"license": "MIT",
@@ -53,8 +53,8 @@
"react-vtkjs-viewport": "^0.14.2"
},
"devDependencies": {
"@ohif/core": "^2.13.14",
"@ohif/ui": "^1.9.2",
"@ohif/core": "^2.13.15",
"@ohif/ui": "^1.9.3",
"cornerstone-tools": "^4.20.1",
"cornerstone-wado-image-loader": "^3.1.0",
"dicom-parser": "^1.8.3",
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.13.15](https://github.com/OHIF/Viewers/compare/@ohif/core@2.13.14...@ohif/core@2.13.15) (2021-09-03)
**Note:** Version bump only for package @ohif/core
## [2.13.14](https://github.com/OHIF/Viewers/compare/@ohif/core@2.13.13...@ohif/core@2.13.14) (2021-08-30)
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/core",
"version": "2.13.14",
"version": "2.13.15",
"description": "Generic business logic for web-based medical imaging applications",
"author": "OHIF Core Team",
"license": "MIT",
@@ -260,7 +260,6 @@ class MeasurementService {
const sourceInfo = this._getSourceInfo(source);
if (!definition) {
console.log('TEST');
log.warn('No source definition provided. Exiting early.');
return;
}
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.9.3](https://github.com/OHIF/Viewers/compare/@ohif/ui@1.9.2...@ohif/ui@1.9.3) (2021-09-03)
**Note:** Version bump only for package @ohif/ui
## [1.9.2](https://github.com/OHIF/Viewers/compare/@ohif/ui@1.9.1...@ohif/ui@1.9.2) (2021-05-17)
**Note:** Version bump only for package @ohif/ui
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/ui",
"version": "1.9.2",
"version": "1.9.3",
"description": "A set of React components for Medical Imaging Viewers",
"author": "OHIF Contributors",
"license": "MIT",
@@ -4,6 +4,29 @@
z-index: 0;
}
.RoundedButtonGroup .badgeNumber-container {
background-color: var(--ui-border-color-dark);
width: 21px;
height: 21px;
justify-content: center;
align-items: center;
display: flex;
border-radius: 50%;
font-size: 12px;
font-weight: bold;
bottom: 10px;
left: 5px;
color: white;
position: absolute;
}
.RoundedButtonGroup .badgeNumber {
font-size: 10px;
font-weight: bold;
display: block;
width: 25px;
}
.roundedButtonWrapper {
cursor: pointer;
display: inline-block;
@@ -36,7 +59,12 @@
z-index: 1;
}
.roundedButtonWrapper .roundedButton svg .roundedButtonWrapper .roundedButton span {
.roundedButtonWrapper
.roundedButton
svg
.roundedButtonWrapper
.roundedButton
span {
margin: 0 2px;
}
@@ -13,6 +13,7 @@ class RoundedButtonGroup extends Component {
PropTypes.shape({
value: PropTypes.any,
label: PropTypes.string,
stateEvent: PropTypes.string,
icon: PropTypes.oneOfType([
PropTypes.string,
PropTypes.shape({
@@ -30,6 +31,15 @@ class RoundedButtonGroup extends Component {
value: null,
};
state = {
badgeNumbers: [],
};
constructor() {
super();
this.onStateEvent = this.onStateEvent.bind(this);
}
onClickOption = value => {
let newValue = value;
if (this.props.value === value) {
@@ -41,6 +51,48 @@ class RoundedButtonGroup extends Component {
}
};
onStateEvent(event) {
const optionIndex = this.props.options.findIndex(
o => o.value === event.detail.target
);
if (optionIndex > -1) {
const badgeNumbers = this.state.badgeNumbers;
badgeNumbers[optionIndex] = event.detail.badgeNumber;
this.setState({ badgeNumbers });
}
}
componentDidMount() {
this.props.options.forEach(option => {
if (option.stateEvent) {
document.addEventListener(option.stateEvent, this.onStateEvent);
}
});
}
componentDidUpdate(prevProps, prevState) {
this.props.options.forEach((option, index) => {
if (
option.stateEvent &&
option.stateEvent !==
(prevProps.options[index]
? prevProps.options[index].stateEvent
: null)
) {
document.removeEventListener(option.stateEvent, this.onStateEvent);
document.addEventListener(option.stateEvent, this.onStateEvent);
}
});
}
componentWillUnmount() {
this.props.options.forEach(option => {
if (option.stateEvent) {
document.removeEventListener(option.stateEvent, this.onStateEvent);
}
});
}
render() {
let className = classnames(
RoundedButtonGroup.className,
@@ -62,6 +114,14 @@ class RoundedButtonGroup extends Component {
<div className="bottomLabel">{option.bottomLabel}</div>
);
let badgeNumber = this.state.badgeNumbers[index];
const badgeNumberOverflow = String(badgeNumber).length > 2;
badgeNumber = badgeNumber
? badgeNumberOverflow
? 99
: badgeNumber
: null;
return (
<div
key={index}
@@ -70,6 +130,14 @@ class RoundedButtonGroup extends Component {
>
<div className="roundedButton">
{optionText}
{badgeNumber && (
<div className="badgeNumber-container">
<span className="badgeNumber">
{badgeNumber}
{badgeNumberOverflow && '+'}
</span>
</div>
)}
{iconProps && <Icon {...iconProps} />}
</div>
{bottomLabel}
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [4.9.24](https://github.com/OHIF/Viewers/compare/@ohif/viewer@4.9.23...@ohif/viewer@4.9.24) (2021-09-03)
**Note:** Version bump only for package @ohif/viewer
## [4.9.23](https://github.com/OHIF/Viewers/compare/@ohif/viewer@4.9.22...@ohif/viewer@4.9.23) (2021-08-30)
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/viewer",
"version": "4.9.23",
"version": "4.9.24",
"description": "OHIF Viewer",
"author": "OHIF Contributors",
"license": "MIT",
@@ -49,18 +49,18 @@
},
"dependencies": {
"@babel/runtime": "^7.5.5",
"@ohif/core": "^2.13.14",
"@ohif/core": "^2.13.15",
"@ohif/extension-cornerstone": "^2.10.10",
"@ohif/extension-debugging": "^0.2.2",
"@ohif/extension-dicom-html": "^1.3.10",
"@ohif/extension-dicom-microscopy": "^0.52.0",
"@ohif/extension-dicom-pdf": "^1.0.6",
"@ohif/extension-dicom-rt": "^0.6.13",
"@ohif/extension-dicom-segmentation": "^0.6.10",
"@ohif/extension-dicom-rt": "^0.6.14",
"@ohif/extension-dicom-segmentation": "^0.6.11",
"@ohif/extension-lesion-tracker": "^0.2.1",
"@ohif/extension-vtk": "^1.11.15",
"@ohif/extension-vtk": "^1.11.16",
"@ohif/i18n": "^0.53.0",
"@ohif/ui": "^1.9.2",
"@ohif/ui": "^1.9.3",
"@tanem/react-nprogress": "^1.1.25",
"classnames": "^2.2.6",
"core-js": "^3.2.1",
@@ -96,6 +96,8 @@ class ToolbarRow extends Component {
value: menuOption.target,
icon: menuOption.icon,
bottomLabel: menuOption.label,
badgeNumber: menuOption.badgeNumber,
stateEvent: menuOption.stateEvent,
};
const from = menuOption.from || 'right';